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