|
|
1.1 ! root 1: /* ! 2: * sort_service.c ! 3: * Implements the server side of the sort_service. ! 4: */ ! 5: ! 6: #include <rpc/rpc.h> ! 7: #include "sort_prot.h" ! 8: ! 9: static int ! 10: comparestrings(sp1, sp2) ! 11: char **sp1, **sp2; ! 12: { ! 13: ! 14: return (strcmp(*sp1, *sp2)); ! 15: } ! 16: ! 17: static struct sortstrings * ! 18: sort(ssp) ! 19: struct sortstrings *ssp; ! 20: { ! 21: ! 22: qsort(ssp->s, ssp->ns, sizeof (char *), comparestrings); ! 23: return(ssp); ! 24: } ! 25: ! 26: main() ! 27: { ! 28: ! 29: /* register the serive */ ! 30: registerrpc(SORTPROG, SORTVERS, SORT, ! 31: sort, xdr_sortstrings, xdr_sortstrings); ! 32: ! 33: /* run the service forever */ ! 34: svc_run(); /* never returns */ ! 35: exit(1); ! 36: } ! 37:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.