diff options
Diffstat (limited to 'usr.bin/xargs/xargs.c')
| -rw-r--r-- | usr.bin/xargs/xargs.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/usr.bin/xargs/xargs.c b/usr.bin/xargs/xargs.c index 6ee3f36e2495e..e69314e58fa36 100644 --- a/usr.bin/xargs/xargs.c +++ b/usr.bin/xargs/xargs.c @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include <err.h> #include <errno.h> #include <fcntl.h> +#include <getopt.h> #include <langinfo.h> #include <locale.h> #include <paths.h> @@ -98,6 +99,22 @@ static volatile int childerr; extern char **environ; +static const char *optstr = "+0E:I:J:L:n:oP:pR:S:s:rtx"; + +static const struct option long_options[] = +{ + {"exit", no_argument, NULL, 'x'}, + {"interactive", no_argument, NULL, 'p'}, + {"max-args", required_argument, NULL, 'n'}, + {"max-chars", required_argument, NULL, 's'}, + {"max-procs", required_argument, NULL, 'P'}, + {"no-run-if-empty", no_argument, NULL, 'r'}, + {"null", no_argument, NULL, '0'}, + {"verbose", no_argument, NULL, 't'}, + + {NULL, no_argument, NULL, 0}, +}; + int main(int argc, char *argv[]) { @@ -137,7 +154,7 @@ main(int argc, char *argv[]) nline -= strlen(*ep++) + 1 + sizeof(*ep); } maxprocs = 1; - while ((ch = getopt(argc, argv, "0E:I:J:L:n:oP:pR:S:s:rtx")) != -1) + while ((ch = getopt_long(argc, argv, optstr, long_options, NULL)) != -1) switch (ch) { case 'E': eofstr = optarg; |
