diff options
Diffstat (limited to 'usr.bin/xargs/xargs.c')
-rw-r--r-- | usr.bin/xargs/xargs.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/xargs/xargs.c b/usr.bin/xargs/xargs.c index 8124464add8..e56bb92320d 100644 --- a/usr.bin/xargs/xargs.c +++ b/usr.bin/xargs/xargs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xargs.c,v 1.7 1998/04/26 17:12:48 deraadt Exp $ */ +/* $OpenBSD: xargs.c,v 1.8 1998/06/23 00:22:58 deraadt Exp $ */ /* $NetBSD: xargs.c,v 1.7 1994/11/14 06:51:41 jtc Exp $ */ /*- @@ -47,7 +47,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)xargs.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: xargs.c,v 1.7 1998/04/26 17:12:48 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: xargs.c,v 1.8 1998/06/23 00:22:58 deraadt Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -78,6 +78,7 @@ main(argc, argv) register char *p, *bbp, *ebp, **bxp, **exp, **xp; int cnt, indouble, insingle, nargs, nflag, nline, xflag; char **av, *argp; + int arg_max; setlocale(LC_ALL, ""); @@ -95,7 +96,9 @@ main(argc, argv) * probably not worthwhile. */ nargs = 5000; - nline = ARG_MAX - 4 * 1024; + if ((arg_max = sysconf(_SC_ARG_MAX)) == -1) + errx(1, "sysconf(_SC_ARG_MAX) failed"); + nline = arg_max - 4 * 1024; nflag = xflag = 0; while ((ch = getopt(argc, argv, "0n:s:tx")) != -1) switch(ch) { |