get rid of -f flag (and make it conform to posix)

This commit is contained in:
cgd 1993-07-13 22:18:13 +00:00
parent 10e3a8d21b
commit fcdad54fc2
2 changed files with 4 additions and 24 deletions

View File

@ -41,7 +41,7 @@
xargs \- construct argument list(s) and execute utility. xargs \- construct argument list(s) and execute utility.
.SH SYNOPSIS .SH SYNOPSIS
.ft B .ft B
xargs [\-ft] [[\-x] \-n number] [\-s size] [utility [argument ...]] xargs [\-t] [[\-x] \-n number] [\-s size] [utility [argument ...]]
.ft R .ft R
.SH DESCRIPTION .SH DESCRIPTION
The The
@ -70,21 +70,6 @@ Any single character, including newlines, may be escaped by a backslash.
.PP .PP
The options are as follows: The options are as follows:
.TP .TP
\-f
Force
.I xargs
to ignore the exit status returned by
.IR utility .
By default,
.I xargs
will exit immediately if
.I utility
exits with a non-zero exit status.
This does not include ignoring
.I utility
exiting due to a signal or without calling
.IR exit (2).
.TP
\-n number \-n number
Set the maximum number of arguments taken from standard input for each Set the maximum number of arguments taken from standard input for each
invocation of the utility. invocation of the utility.

View File

@ -54,7 +54,7 @@ static char sccsid[] = "@(#)xargs.c 5.11 (Berkeley) 6/19/91";
#include <limits.h> #include <limits.h>
#include "pathnames.h" #include "pathnames.h"
int fflag, tflag; int tflag;
void err __P((const char *, ...)); void err __P((const char *, ...));
void run(), usage(); void run(), usage();
@ -85,11 +85,8 @@ main(argc, argv)
nargs = 5000; nargs = 5000;
nline = ARG_MAX - 4 * 1024; nline = ARG_MAX - 4 * 1024;
nflag = xflag = 0; nflag = xflag = 0;
while ((ch = getopt(argc, argv, "fn:s:tx")) != EOF) while ((ch = getopt(argc, argv, "n:s:tx")) != EOF)
switch(ch) { switch(ch) {
case 'f':
fflag = 1;
break;
case 'n': case 'n':
nflag = 1; nflag = 1;
if ((nargs = atoi(optarg)) <= 0) if ((nargs = atoi(optarg)) <= 0)
@ -288,15 +285,13 @@ run(argv)
*/ */
if (noinvoke || !WIFEXITED(status) || WIFSIGNALED(status)) if (noinvoke || !WIFEXITED(status) || WIFSIGNALED(status))
exit(127); exit(127);
if (!fflag && WEXITSTATUS(status))
exit(WEXITSTATUS(status));
} }
void void
usage() usage()
{ {
(void)fprintf(stderr, (void)fprintf(stderr,
"usage: xargs [-ft] [[-x] -n number] [-s size] [utility [argument ...]]\n"); "usage: xargs [-t] [[-x] -n number] [-s size] [utility [argument ...]]\n");
exit(1); exit(1);
} }