History log of /freebsd-current/usr.bin/xargs/strnsubst.c
Revision Date Author Comments
# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 1e692b93 05-Jul-2022 Tom Jones <thj@FreeBSD.org>

xargs: fix description of strnsubst return value

Reported by: oshogbo
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D35574


# f058359b 05-Jul-2022 Tom Jones <thj@FreeBSD.org>

xargs: terminate if line replacement cannot be constructed

If the line with replacement cannot be constructed xargs should
terminate as documented in the man page

We encounter this error, but gnu/xargs doesn't because they have a much
larger limit for created outputs (~10000 lines).

Reviewed by: oshogbo
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D35574


# dae3a64f 26-Dec-2017 Eitan Adler <eadler@FreeBSD.org>

userland: Fix several typos and minor errors

- duplicate words
- typos
- references to old versions of FreeBSD

Reviewed by: imp, benno


# df4110b6 04-Jan-2013 Xin LI <delphij@FreeBSD.org>

Follow calloc convention in other code, this is functionally identical
to its previous form.


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 38e62c69 30-Dec-2005 Juli Mallett <jmallett@FreeBSD.org>

Handle maxsize==0 in such a way that we don't modify the string.


# 5578bd8c 18-Oct-2004 Colin Percival <cperciva@FreeBSD.org>

Modify behaviour of `xargs -I` in order to:
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.


# 5058dcb4 21-Jun-2002 Juli Mallett <jmallett@FreeBSD.org>

Check for results of repeated calls to strnsubst(), as well as for the
behaviour with NULL match string, as that has changed over time.


# 986d829b 30-May-2002 Juli Mallett <jmallett@FreeBSD.org>

Allow the input line to be NULL, and teach strnsubst() that NULL means to use
a nil-string.


# 38dff9a4 03-May-2002 Juli Mallett <jmallett@FreeBSD.org>

Fix a bug whereby we were getting ~0 and comparing it to maxsize, i.e. if
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.


# 299ea75a 01-May-2002 Juli Mallett <jmallett@FreeBSD.org>

*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.


# 0fa5e8dc 01-May-2002 Juli Mallett <jmallett@FreeBSD.org>

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.


# fc17b349 19-Apr-2002 Juli Mallett <jmallett@FreeBSD.org>

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