aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorKris Kennaway <kris@FreeBSD.org>1999-12-06 04:35:06 +0000
committerKris Kennaway <kris@FreeBSD.org>1999-12-06 04:35:06 +0000
commiteaf13cabda704bcb9f77b5fdbf516d685d3eb8d1 (patch)
tree98a7c46c665a653a0f95d0f5dc886bf627031a6a /usr.bin
parent080b5dd65d27981c147f7bc70317c7a13845793c (diff)
Notes
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/apply/apply.120
-rw-r--r--usr.bin/apply/apply.c12
2 files changed, 20 insertions, 12 deletions
diff --git a/usr.bin/apply/apply.1 b/usr.bin/apply/apply.1
index b2d4873a7010..39b827ed8f8e 100644
--- a/usr.bin/apply/apply.1
+++ b/usr.bin/apply/apply.1
@@ -30,6 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)apply.1 8.2 (Berkeley) 4/4/94
+.\" $FreeBSD$
.\"
.Dd April 4, 1994
.Dt APPLY 1
@@ -39,10 +40,10 @@
.Nd apply a command to a set of arguments
.Sh SYNOPSIS
.Nm apply
-.Op Fl a Ns Ar c
-.Op Fl Ns Ar #
-.Ar command argument
-.Op Ar ...
+.Op Fl a Ar c
+.Op Fl d
+.Op Fl #
+.Ar command argument ...
.Sh DESCRIPTION
.Nm apply
runs the named
@@ -67,8 +68,8 @@ each execution of
.Ar command .
.Pp
The options are as follows:
-.Bl -tag -width "-ac"
-.It Fl Ns Ar #
+.Bl -tag -width indent
+.It Fl #
Normally arguments are taken singly; the optional number
.Fl #
specifies the number of arguments to be passed to
@@ -85,16 +86,19 @@ occur in
the
.Fl #
option is ignored.
-.It Fl a Ns Ar c
+.It Fl a Ar c
The use of the character
.Sq Li %
as a magic character may be changed with the
.Fl a
option.
+.It Fl d
+Display the commands that would have been executed, but do not actually
+execute them.
.El
.Sh ENVIRONMENT
The following environment variable affects the execution of
-.Nm apply :
+.Nm Ns :
.Bl -tag -width SHELL
.It Ev SHELL
Pathname of shell to use.
diff --git a/usr.bin/apply/apply.c b/usr.bin/apply/apply.c
index 5499becd3055..fe060a0de8e7 100644
--- a/usr.bin/apply/apply.c
+++ b/usr.bin/apply/apply.c
@@ -35,7 +35,11 @@
*/
#ifndef lint
+#if 0
static const char sccsid[] = "@(#)apply.c 8.4 (Berkeley) 4/4/94";
+#endif
+static const char rcsid[] =
+ "$FreeBSD$";
#endif /* not lint */
#include <sys/wait.h>
@@ -68,7 +72,7 @@ main(argc, argv)
case 'a':
if (optarg[1] != '\0')
errx(1,
- "illegal magic character specification.");
+ "illegal magic character specification");
magic = optarg[0];
break;
case 'd':
@@ -78,7 +82,7 @@ main(argc, argv)
case '5': case '6': case '7': case '8': case '9':
if (nargs != -1)
errx(1,
- "only one -# argument may be specified.");
+ "only one -# argument may be specified");
nargs = optopt - '0';
break;
default:
@@ -152,7 +156,7 @@ main(argc, argv)
* there's enough space to build it.
*/
for (l = strlen(cmd), i = 0; i < nargs; i++)
- l += strlen(argv[i]);
+ l += strlen(argv[i+1]);
if (l > clen && (c = realloc(c, clen = l)) == NULL)
err(1, NULL);
@@ -228,6 +232,6 @@ usage()
{
(void)fprintf(stderr,
- "usage: apply [-a magic] [-0123456789] command arguments ...\n");
+ "usage: apply [-a magic] [-d] [-0123456789] command arguments ...\n");
exit(1);
}