BSD 4_3_Reno release
[unix-history] / usr / src / usr.bin / apply / apply.c
index bb3ebf0..d02eb66 100644 (file)
@@ -1,4 +1,18 @@
-static char sccsid[] = "@(#)apply.c    4.1     (Berkeley)      %G%";
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ */
+
+#ifndef lint
+char copyright[] =
+"@(#) Copyright (c) 1980 Regents of the University of California.\n\
+ All rights reserved.\n";
+#endif not lint
+
+#ifndef lint
+static char sccsid[] = "@(#)apply.c    5.3 (Berkeley) 5/11/89";
+#endif not lint
 
 /*%cc -s -O %
  * apply - apply a command to a set of arguments
 
 /*%cc -s -O %
  * apply - apply a command to a set of arguments
@@ -7,7 +21,9 @@ static char sccsid[] = "@(#)apply.c    4.1     (Berkeley)      %G%";
  *     apply -2 cmp A1 B1 A2 B2   compares A's with B's
  *     apply "ln %1 /usr/fred/dir" *  duplicates a directory
  */
  *     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];
@@ -15,6 +31,8 @@ char  defargs=1;
 #define        DEFARGCHAR      '%'
 char   argchar=DEFARGCHAR;
 int    nchars;
 #define        DEFARGCHAR      '%'
 char   argchar=DEFARGCHAR;
 int    nchars;
+extern char *getenv();
+
 main(argc, argv)
        char *argv[];
 {
 main(argc, argv)
        char *argv[];
 {
@@ -32,7 +50,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;
@@ -109,7 +127,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){