diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-06-23 00:22:59 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-06-23 00:22:59 +0000 |
commit | ee45b1c043d6177334a1c7a465c05ce6730da46d (patch) | |
tree | c1bcf7cb05b7f2b4a28e3146e7291383ff45728e /usr.bin/xargs | |
parent | 78161b52aece5f846fe740001d0a10807199b881 (diff) |
use sysconf() to get ARG_MAX
Diffstat (limited to 'usr.bin/xargs')
-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) { |