rdist doesn't propagate sticky bits; bug report 4.3BSD/ucb/41
[unix-history] / usr / src / usr.bin / rdist / expand.c
index 225d1f5..593f1b4 100644 (file)
@@ -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
 #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"
 
 
 #include "defs.h"
 
@@ -25,6 +37,10 @@ char *entp;
 char   **sortbase;
 
 char   *index();
 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.
 
 /*
  * Take a list of names and expand any macros, etc.
@@ -194,23 +210,12 @@ expstr(s)
        sort();
 }
 
        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));
 }
 
 /*
 }
 
 /*