summaryrefslogtreecommitdiffstats
path: root/usr.bin/xargs
diff options
context:
space:
mode:
authorjmallett <jmallett@FreeBSD.org>2002-05-30 19:34:31 +0000
committerjmallett <jmallett@FreeBSD.org>2002-05-30 19:34:31 +0000
commitd0bc9fa06e35e28f8a9974345e487334eb96429a (patch)
tree7f72b4550973a22ac2e3656c59aca4304bac46fb /usr.bin/xargs
parenta2f7c4e9ca9c5b8eb5cee77480f66ad591a851fa (diff)
downloadFreeBSD-src-d0bc9fa06e35e28f8a9974345e487334eb96429a.zip
FreeBSD-src-d0bc9fa06e35e28f8a9974345e487334eb96429a.tar.gz
Restructure sanity checks so that -I and -J just override eachother, rather
than triggering a usage(). Allow -R and -I to be specified in any order, and thus change how -R checks for -I not being given and triggering a usage(). Partially requested by: gad
Diffstat (limited to 'usr.bin/xargs')
-rw-r--r--usr.bin/xargs/xargs.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.bin/xargs/xargs.c b/usr.bin/xargs/xargs.c
index 832e999..3616249 100644
--- a/usr.bin/xargs/xargs.c
+++ b/usr.bin/xargs/xargs.c
@@ -126,12 +126,13 @@ main(int argc, char **argv)
eofstr = optarg;
break;
case 'I':
+ Jflag = 0;
Iflag = 1;
Lflag = 1;
- Rflag = 5;
replstr = optarg;
break;
case 'J':
+ Iflag = 0;
Jflag = 1;
replstr = optarg;
break;
@@ -147,8 +148,6 @@ main(int argc, char **argv)
pflag = 1;
break;
case 'R':
- if (!Iflag)
- usage();
if ((Rflag = atoi(optarg)) <= 0)
errx(1, "illegal number of replacements");
break;
@@ -171,8 +170,10 @@ main(int argc, char **argv)
argc -= optind;
argv += optind;
- if (Iflag && Jflag)
- errx(1, "the -I and -J options may not be used together");
+ if (!Iflag && Rflag)
+ usage();
+ if (Iflag && !Rflag)
+ Rflag = 5;
if (xflag && !nflag)
usage();
if (Iflag || Lflag)
OpenPOWER on IntegriCloud