1 #include <rpc/rpc.h> 2 #include "sort.h" 3 4 static int comparestrings(sp1,sp2)5comparestrings(sp1, sp2) 6 char **sp1, **sp2; 7 { 8 return (strcmp(*sp1, *sp2)); 9 } 10 11 struct sortstrings * sort_1(ssp)12sort_1(ssp) 13 struct sortstrings *ssp; 14 { 15 static struct sortstrings ss_res; 16 17 if (ss_res.ss.ss_val != (str *)NULL) 18 free(ss_res.ss.ss_val); 19 20 qsort(ssp->ss.ss_val, ssp->ss.ss_len, sizeof (char *), comparestrings); 21 ss_res.ss.ss_len = ssp->ss.ss_len; 22 ss_res.ss.ss_val = (str *)malloc(ssp->ss.ss_len * sizeof(str *)); 23 bcopy(ssp->ss.ss_val, ss_res.ss.ss_val, 24 ssp->ss.ss_len * sizeof(str *)); 25 return(&ss_res); 26 } 27