X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/6bc62d90603a2104074c82e4048276c18a128f65..aad0f9960ea2169bd7e95b726bb5570e03234bfb:/usr/src/usr.bin/rdist/expand.c diff --git a/usr/src/usr.bin/rdist/expand.c b/usr/src/usr.bin/rdist/expand.c index 225d1f5d07..593f1b40d6 100644 --- a/usr/src/usr.bin/rdist/expand.c +++ b/usr/src/usr.bin/rdist/expand.c @@ -1,6 +1,18 @@ +/* + * Copyright (c) 1983 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of California at Berkeley. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. This software + * is provided ``as is'' without express or implied warranty. + */ + #ifndef lint -static char *sccsid = "@(#)expand.c 4.13 (Berkeley) 85/04/03"; -#endif +static char sccsid[] = "@(#)expand.c 5.3 (Berkeley) %G%"; +#endif /* not lint */ #include "defs.h" @@ -25,6 +37,10 @@ char *entp; char **sortbase; char *index(); +int argcmp(); + +#define sort() qsort((char *)sortbase, &eargv[eargc] - sortbase, \ + sizeof(*sortbase), argcmp), sortbase = &eargv[eargc] /* * Take a list of names and expand any macros, etc. @@ -194,23 +210,12 @@ expstr(s) sort(); } -/* - * Bubble sort any new entries - */ -sort() +static +argcmp(a1, a2) + char **a1, **a2; { - register char **p1, **p2, *c; - char **ap = &eargv[eargc]; - - p1 = sortbase; - while (p1 < ap-1) { - p2 = p1; - while (++p2 < ap) - if (strcmp(*p1, *p2) > 0) - c = *p1, *p1 = *p2, *p2 = c; - p1++; - } - sortbase = ap; + + return (strcmp(*a1, *a2)); } /*