Commit Graph

132 Commits

Author SHA1 Message Date
Juli Mallett
b50a72861d Make -J a proper flag internal to the code (rather than just check for
use of replstr and lack of Iflag), and add -R, which when given with
-I controls the number of arguments on which replacement will be done.

Some people happen to think it's idiotic to limit to 5 arguments, so
let the user override it if they like.
2002-05-02 02:42:34 +00:00
Juli Mallett
299ea75ab7 *str is spelled 's1' inside the body of the code.
Make 'this' not a local variable, since it isn't necessary or complex enough
to warrant such.
2002-05-02 02:15:06 +00:00
Juli Mallett
0fa5e8dc42 Rework some of the -I support so I can't find a way to make xargs(1) core or
corrupt memory.  Simplifies the code in one or two places, also removes some
code that looks like it was bogus or incomplete.

Update strnsubst to have one or two extra conditions which maybe would make
it more efficient, or at least more versatile.  This is likely a no-op.
2002-05-02 02:06:03 +00:00
Juli Mallett
91ae52cb17 In the case where we can't open /dev/tty, fall back to -t behaviour.
Submitted by:	fenner
2002-04-19 23:58:00 +00:00
Juli Mallett
5e61dfa3ca Bump WARNS to 4. 2002-04-19 23:46:45 +00:00
Juli Mallett
0c7c579ba6 Compound two fprintf(3)s into 1 using string concatenation. 2002-04-19 23:41:56 +00:00
Juli Mallett
fc17b349c8 After 3 months...
Merge xargs(1) with that of xMach.

Bring in xargs(1) changes to add -L and -I as per the Single Unix Specification
version 3.  Proper exit status numbers are implemented, and the manual page has
been updated to reflect reality.

The code has been ANSIfied, and a new file has been added to xargs(1) to do the
substring substitution as SUSv3 requires.

Traditional behaviour should not be affected, use of -J should be deprecated
in favor of the more portable -I (though -J has been left, for now).

Submitted by:	me, tjr (the exit status stuff)
Obtained from:	xMach
2002-04-19 23:28:54 +00:00
Juli Mallett
73385ac644 ANSIfy: Function declarations and prototypes, use of environ(7).
Reviewed by:	mike
Approved by:	mike
2002-03-15 22:54:58 +00:00
Dag-Erling Smørgrav
8ad749a45d Change back to using vfork() now that execvp() is vfork()-safe. If execvp()
fails, errno is saved to a volatile variable that the parent later inspects.

PR:		bin/34898
Submitted by:	Tim J. Robbins <tim@robbins.dropbear.id.au>
MFC after:	1 week
2002-03-09 22:08:14 +00:00
Mike Barcroft
064692095c Leave the `copyright' variable exposed, since the main purpose of it
is to put a copyright in the object file.

Submitted by:	bde
2002-03-07 10:06:00 +00:00
Mike Barcroft
51883012f6 Fix vendor ID (mostly obtained from Rev 1.1). 2002-03-05 05:17:30 +00:00
Mark Murray
16b07a33f9 WARNS=2 fixes, remove register keyword, use __FBSDID() 2001-12-11 22:36:26 +00:00
Dima Dorfman
ffb9c240d7 Spelling police: extention -> extension. 2001-07-05 08:51:08 +00:00
Dima Dorfman
8d904f1537 Add a -J replstr option that allows the user to tell xargs to insert
the data read from standard input at a specific point in the command
line arguments rather than at the end.

Submitted by:	dd, gad
Reviewed by:	gad, brian
2001-05-15 00:31:19 +00:00
Dima Dorfman
a9bc34c882 Alphabetize command-line options in the synopsis. 2001-05-02 06:41:46 +00:00
Ruslan Ermilov
471b9c332c mdoc(7) police: Fixed typo and markup in rev.1.11. 2001-04-13 09:15:16 +00:00
Brian Somers
c42584e853 o The -s limit is ARG_MAX - 4K, not ARG_MAX - 2K.
o Mention that the current environment is part of the -s calculation.
o Add a BUGS section that warns against executing a program that increases
  the size of the argument list or the size of the environment.

  I have wondered for a while what the difference is between

    get a big list | xargs sudo command

  which fails and

    get a big list | sudo xargs command

  which succeeds.  The answer is that in the first case, sudo expands
  the environment and pushes the amount of data passed into execve over
  the E2BIG threshold.
2001-04-10 23:16:55 +00:00
Ruslan Ermilov
f4ddfb3865 Prepare for mdoc(7)NG. 2000-12-27 16:52:31 +00:00
Ruslan Ermilov
9b88faecd3 Prepare for mdoc(7)NG. 2000-12-19 16:00:12 +00:00
Ruslan Ermilov
8fe908ef0c mdoc(7) police: use the new features of the Nm macro. 2000-11-20 19:21:22 +00:00
Philippe Charnier
5e8eb81aac Use .Xr 2000-03-26 15:05:40 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Nik Clayton
3be5f1f5ce Add $Id$, to make it simpler for members of the translation teams to
track.

The $Id$ line is normally at the bottom of the main comment block in the
man page, separated from the rest of the manpage by an empty comment,
like so;

     .\"    $Id$
     .\"

If the immediately preceding comment is a @(#) format ID marker than the
the $Id$ will line up underneath it with no intervening blank lines.
Otherwise, an additional blank line is inserted.

Approved by:            bde
1999-07-12 20:24:20 +00:00
Jean-Marc Zucconi
ef9866be68 xargs was spliting the input in a very different way from everyone else,
and was also a bit inconsistent: leading blanks, or any double blanks
generated empty arguments, but a trailing blank did not.

PR:		bin/2630, bin/10914
Submitted by:	Arne Henrik Juul <arnej@imf.unit.no>
1999-05-23 15:58:22 +00:00
Dag-Erling Smørgrav
1fd98d7d88 Calls one or more of malloc(), warn(), err(), syslog(), execlp() or
execvp() in the child branch of a vfork(). Changed to use fork()
instead.

Some of these (mv, find, apply, xargs) might benefit greatly from
being rewritten to use vfork() properly.

PR:		Loosely related to bin/8252
Approved by:	jkh and bde
1998-10-13 14:52:33 +00:00
Joseph Koshy
a3e5bc4fb5 Remove compile time dependency on ARG_MAX.
This fix only removes the dependency on compile time constants.  The code
has other (old) problems that need to be addressed.

PR: 1791
Reviewed-by: bde, tegge
1998-06-17 12:58:43 +00:00
Daniel O'Callaghan
749f6a2934 Submitted by: Peter Hawkins <peter@clari.net.au>
Spelling police.
1997-12-13 06:34:47 +00:00
Philippe Charnier
a51024e289 Use err(3) instead of local redefinition. 1997-08-27 06:26:23 +00:00
Warner Losh
1c8af87873 compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.
1997-03-29 04:34:07 +00:00
Warner Losh
d919888163 Reviewed by: Warner Losh <imp@village.org>
Submitted by:	Marc Slemko <marcs@znep.com>
Obtained from:	OpenBSD

Add -0 for reading the results of find -0.
1996-11-01 18:46:05 +00:00
Satoshi Asami
e5009da0f9 Make xargs take into account the bytes occupied by the environment.
Original by: peter
1996-03-05 07:43:40 +00:00
Rodney W. Grimes
9b50d90275 BSD 4.4 Lite Usr.bin Sources 1994-05-27 12:33:43 +00:00