summaryrefslogtreecommitdiffstats
path: root/usr.bin/xargs/strnsubst.c
Commit message (Collapse)AuthorAgeFilesLines
* Handle maxsize==0 in such a way that we don't modify the string.jmallett2005-12-301-0/+12
|
* Modify behaviour of `xargs -I` in order to:cperciva2004-10-181-2/+2
| | | | | | | | | | | | | | | | | 1. Conform to IEEE Std 1003.1-2004, which state that "Constructed arguments cannot grow larger than 255 bytes", and 2. Avoid a buffer overflow. Unfortunately the standard doesn't indicate how xargs is supposed to handle arguments which (with the appropriate substitutions) would grow larger than 255 bytes; this solution handles those by making as many substitutions as possible without overflowing the buffer. OpenBSD's xargs resolves this in a different direction, by making all the substitutions and then silently truncating the resulting string. Since this change may break existing scripts which rely upon the buffer overflow (255 bytes isn't really all that long...) it will not be MFCed.
* Check for results of repeated calls to strnsubst(), as well as for thejmallett2002-06-221-6/+17
| | | | behaviour with NULL match string, as that has changed over time.
* Allow the input line to be NULL, and teach strnsubst() that NULL means to usejmallett2002-05-301-0/+5
| | | | a nil-string.
* Fix a bug whereby we were getting ~0 and comparing it to maxsize, i.e. ifjmallett2002-05-031-1/+1
| | | | | | | s1 was 0 length, and replstr was 0 length, etc., we would end up subtracting one from zero and seeing if it was greater than the size_t (unsigned) var maxsize... This would cause us to return a string consisting of essentially only match, which is not the right behaviour if we have 0 length inpline.
* *str is spelled 's1' inside the body of the code.jmallett2002-05-021-4/+2
| | | | | Make 'this' not a local variable, since it isn't necessary or complex enough to warrant such.
* Rework some of the -I support so I can't find a way to make xargs(1) core orjmallett2002-05-021-0/+5
| | | | | | | | 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.
* After 3 months...jmallett2002-04-191-0/+78
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
OpenPOWER on IntegriCloud