BSD 4_4 release
[unix-history] / usr / src / usr.bin / apply / apply.c
index bf6d6b1..57d18e1 100644 (file)
@@ -1,27 +1,32 @@
-/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.  The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
+/*-
+ * Copyright (c) 1983, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This module is believed to contain source code proprietary to AT&T.
+ * Use and redistribution is subject to the Berkeley Software License
+ * Agreement and your Software Agreement with AT&T (Western Electric).
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-char copyright[] =
-"@(#) Copyright (c) 1980 Regents of the University of California.\n\
- All rights reserved.\n";
-#endif not lint
+static char copyright[] =
+"@(#) Copyright (c) 1983, 1993\n\
      The Regents of the University of California.  All rights reserved.\n";
+#endif /* not lint */
 
 #ifndef lint
 
 #ifndef lint
-static char sccsid[] = "@(#)apply.c    5.1 (Berkeley) %G%";
-#endif not lint
+static char sccsid[] = "@(#)apply.c    8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
 
 
-/*%cc -s -O %
+/*
  * apply - apply a command to a set of arguments
  *
  *     apply echo * == ls
  *     apply -2 cmp A1 B1 A2 B2   compares A's with B's
  *     apply "ln %1 /usr/fred/dir" *  duplicates a directory
  */
  * apply - apply a command to a set of arguments
  *
  *     apply echo * == ls
  *     apply -2 cmp A1 B1 A2 B2   compares A's with B's
  *     apply "ln %1 /usr/fred/dir" *  duplicates a directory
  */
+#include <paths.h>
 #include <stdio.h>
 #include <stdio.h>
+
 char   *cmdp;
 #define        NCHARS 512
 char   cmd[512];
 char   *cmdp;
 #define        NCHARS 512
 char   cmd[512];
@@ -48,7 +53,7 @@ main(argc, argv)
                --argc; ++argv;
        }
        if(argc<2){
                --argc; ++argv;
        }
        if(argc<2){
-               fprintf(stderr, "usage: apply [-14] [-a%] cmd arglist\n");
+               fprintf(stderr, "usage: apply [-#] [-ac] cmd arglist\n");
                exit(1);
        }
        argc -= 2;
                exit(1);
        }
        argc -= 2;
@@ -125,7 +130,7 @@ char *s;
        char *shell = getenv("SHELL");
 
        if ((pid = fork()) == 0) {
        char *shell = getenv("SHELL");
 
        if ((pid = fork()) == 0) {
-               execl(shell ? shell : "/bin/sh", "sh", "-c", s, 0);
+               execl(shell ? shell : _PATH_BSHELL, "sh", "-c", s, 0);
                _exit(127);
        }
        if(pid == -1){
                _exit(127);
        }
        if(pid == -1){