From d0bc9fa06e35e28f8a9974345e487334eb96429a Mon Sep 17 00:00:00 2001 From: jmallett Date: Thu, 30 May 2002 19:34:31 +0000 Subject: 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 --- usr.bin/xargs/xargs.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'usr.bin/xargs') 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) -- cgit v1.1