Home | History | Annotate | Download | only in sed
History log of /src/usr.bin/sed/process.c
RevisionDateAuthorComments
 1.54  17-Sep-2024  kre PR lib/58674

When building the tools version of sed, treat all wide characters
as if they occupy just one column for the purposes of sed's 'l'
command (which it is very unlikely to be used from the tools sed).

wdwidth() is another XSI function, not necessarily available everywhere.
 1.53  15-May-2020  christos branches: 1.53.6;
sed(1): Don't force a newline on last line, if input stream doesn't have one

While here, change how we check if the current line is the last one.
Before, we just checked if there were more files after the current one.
Now, we check the actual content of those files: they files may not have
a line at all. This matches the definition of the "last line" by the
Open Group.

The new behavior is closer to GNU sed.

From FreeBSD (9dd857db3dc558dc61dc8674d204ebc83cac0739), requested by mrg@
 1.52  12-Mar-2015  christos branches: 1.52.18;
The latest refactoring changes broke sed -i:
cd /tmp; echo foo > test; sed -i.orig s,fo,ba, test
Back them out until they are fixed.
 1.51  01-Mar-2015  asau Hide more subroutines in processing phase.
 1.50  01-Mar-2015  asau Close files opened at processing time within processing phase.
 1.49  01-Mar-2015  asau Move run-time data structures into processing part.
 1.48  01-Mar-2015  asau Move data I/O file pointers into processing part.
 1.47  28-Feb-2015  asau Improve modularity of "sed" source:
- move program source input subroutines into compiler part;
- move data I/O subroutines into processor part.
 1.46  13-Aug-2014  christos PR/49109: Jeremie Le Hen: fix sed relative addressin (1,+N)
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=192108
http://svnweb.freebsd.org/base?view=revision&revision=269302
XXX: pullup 7.
 1.45  26-Jun-2014  christos branches: 1.45.2;
restore sccsid[]'s per core@'s decision
 1.44  09-Jun-2014  christos PR/48883: Justin Cormack: Cope with systems that don't provide REG_STARTEND
 1.43  07-Jun-2014  christos PR/48880: Ryo ONODERA: Unapply one of our patches that broke 'G'.
 1.42  07-Jun-2014  ryoon Restore G command
 1.41  06-Jun-2014  joerg usage is __dead. Kill useless sccsid.
 1.40  06-Jun-2014  christos Merge our changes.
 1.39  17-Mar-2013  uwe branches: 1.39.6;
The change ("c") command should start a new cycle.

Apply one line patch I posted in PR #45981 and document this in the
manual page.
 1.38  13-Apr-2009  lukem branches: 1.38.6; 1.38.8; 1.38.12;
Fix WARNS=4 issues (-Wcast-qual -Wsign-compare)
 1.37  18-Jun-2006  gdamore branches: 1.37.28;
Make TOOL_SED, to allow using our own sed in cases where the host's version
is busted in some way.

The TOOL_SED doesn't use TIOCGWINSIZE, and has some changes to include
nbtool_config.h in a cross build environment.

Combined with some other changes (not yet committed), this allows cross
compiling m68k code on Solaris 10/amd64.
 1.36  02-Apr-2006  christos branches: 1.36.2;
Coverity CID 1181: Protect access against NULL.
 1.35  07-Nov-2003  itojun safer realloc, from openbsd
 1.34  07-Nov-2003  itojun prevent integer underflow. freebsd rev 1.32. via openbsd
 1.33  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.
 1.32  14-Jun-2002  wiz Remove #if __STDC__. De-__P() and ANSIfy.
 1.31  11-Jun-2002  itojun err/errx/warn/warnx do not need \n at the end
 1.30  02-Oct-2001  atatat branches: 1.30.2;
Back out last patch (again). This patch seems to satisfy test suites
that I've found, while the previous one did not.
 1.29  28-Sep-2001  atatat New fix for PR bin/14074. This one doesn't make sed hang.
 1.28  28-Sep-2001  atatat Back out the pr fix. It doesn't work.
 1.27  27-Sep-2001  atatat Don't attempt to memmove() if psl (pattern space length) is zero.
Fixes PR bin/14074: Simple expression core dumps sed.
 1.26  09-Nov-1999  drochner branches: 1.26.4;
Since our gcc doesn't warn about NULL format strings anymore, we can
fix the incorrect err(1, "%s", "") et al.
Closes PR bin/7592 by cgd.
 1.25  31-May-1999  kim branches: 1.25.4;
Fix bug pointed out by Jerry Peek <jpeek@jpeek.com> in PR bin/7674.
If hold space null when doing an 'G', make sure it contains a newline.
Fix copied from revision 1.17 where cgd applied a fix for 'x'.
 1.24  19-Dec-1998  christos branches: 1.24.2;
char -> unsigned char
compensate for not having REG_STARTEND
 1.23  25-Aug-1998  ross Add { and } to shut up egcs. Reformat the more questionable code.
 1.22  30-Mar-1998  mrg use int as array index.
 1.21  22-Oct-1997  thorpej Remove an extra semicolon that broke processing of the "r" directive.
 1.20  19-Oct-1997  lukem branches: 1.20.2;
WARNSify, fix .Nm usage, deprecate register, getopt returns -1 not EOF
 1.19  19-Oct-1997  mrg merge lite-2 -- was mostly already done. grr.
 1.18  09-Jan-1997  tls RCS ID police
 1.17  11-Jul-1995  cgd fix bug pointed out by Dennis Ferguson <dennis@mci.net>. if hold space null
when doing an 'x', make sure it contains a newline.
 1.16  15-Mar-1995  mycroft The `D' command should only input a new line if the pattern space becomes empty.
 1.15  15-Mar-1995  mycroft Fix the P command, and optimize D slightly.
 1.14  15-Mar-1995  mycroft Remove an old #ifndef of little value.
 1.13  24-Mar-1994  mycroft Fix bug with D leaving junk at end of pattern space.
 1.12  01-Mar-1994  cgd DTRT with empty RE matches. or at least, do something better. fix off
to bostic and dspin.
 1.11  28-Feb-1994  andrew Restore the traditional behaviour of the "n" command.
 1.10  09-Feb-1994  cgd patch from Diomidis Spinellis to fix 'infinite' loop
 1.9  03-Feb-1994  cgd RCS id's
 1.8  03-Feb-1994  cgd update from Diomidis Spinellis <dspin@leon.nrcps.ariadne-t.gr>
 1.7  14-Aug-1993  mycroft Put back RCS identifier.
 1.6  14-Aug-1993  alm Was testing against rm_so instead of rm_eo. So now:
$ echo aabb | sed 's/\(.*\)\1/(\1)/g'
(a)(b)(c)
 1.5  13-Aug-1993  alm removed GNU_REGEX directive
catch infinite substitution for the following cases:
echo hi | sed 's/$/a/g' (prints hia)
echo hi | sed 's/h*/x/g' (terminates with error: infinite substitution)
 1.4  01-Aug-1993  mycroft Add RCS identifiers.
 1.3  02-Jul-1993  alm added missing parens in buffer allocation (caused seg violation)
 1.2  08-May-1993  alm fixed HS initialization bug; swapping HS (`x') before a hold (`h')
command set the pattern space to NULL
 1.1  13-Apr-1993  alm branches: 1.1.1;
added Berkeley sed with mods to use GNU regex
 1.1.1.2  06-Jun-2014  christos import today's FreeBSD sed.
 1.1.1.1  29-Apr-1995  mrg 4.4BSD-Lite2
 1.20.2.1  22-Oct-1997  thorpej Pull up from trunk:

Remove an extra semicolon that broke processing of the "r" directive.
 1.24.2.1  25-Jun-1999  perry pullup 1.24->1.25 (Kimmo Suominen)
 1.25.4.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.26.4.2  07-Apr-2004  jmc Pullup rev 1.34 (requested by itojun in ticket #108)

Prevent integer underflow.
 1.26.4.1  27-Oct-2001  he Pull up revisions 1.27-1.30 (requested by atatat):
Don't attempt memmove() if pattern space length is zero.
Fixes PR#14074.
 1.30.2.1  12-Mar-2004  jmc Pullup rev 1.34 (requested by itojun in ticket #1558)

Prevent integer underflow.
 1.36.2.1  19-Jun-2006  chap Sync with head.
 1.37.28.1  13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.38.12.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.38.12.1  23-Jun-2013  tls resync from head
 1.38.8.1  11-May-2013  riz Pull up following revision(s) (requested by uwe in ticket #888):
usr.bin/sed/process.c: revision 1.39
usr.bin/sed/sed.1: revision 1.30
usr.bin/sed/sed.1: revision 1.31
The change ("c") command should start a new cycle.
Apply one line patch I posted in PR #45981 and document this in the
manual page.
Bump date for previous (PR #45981): the change ("c") command starts a
new cycle.
 1.38.6.1  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.39.6.1  10-Aug-2014  tls Rebase.
 1.45.2.1  18-Aug-2014  martin Pull up following revision(s) (requested by christos in ticket #34):
usr.bin/sed/process.c: revision 1.46
PR/49109: Jeremie Le Hen: fix sed relative addressin (1,+N)
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=192108
http://svnweb.freebsd.org/base?view=revision&revision=269302
XXX: pullup 7.
 1.52.18.1  15-Oct-2024  martin Pull up following revision(s) (requested by kre in ticket #1914):

bin/date/date.c (apply patch)
usr.bin/sed/process.c: revision 1.54
sys/sys/signal.h: revision 1.77
sys/sys/signal.h: revision 1.78
external/gpl2/gmake/dist/main.c: revision 1.2

PR lib/58674

When building the tools version of sed, treat all wide characters
as if they occupy just one column for the purposes of sed's 'l'
command (which it is very unlikely to be used from the tools sed).
wdwidth() is another XSI function, not necessarily available everywhere.

PR lib/58674
bsd_signal should only be visible with _NETBSD_SOURCE - it isn't any kind of
standard function (despite also existing in other systems).

This change inspired by the PR, but doesn't fix it in any way, the tools
config script for gmake doesn't care if the function is visible in any
header, merely if present in libc.

PR lib/58674 (not really so much any more)
Correct previous.
bsd_signal should only be visible with _NETBSD_SOURCE - it isn't any kind of
standard function (despite also existing in other systems).

Turns out that it used to be an XSI function, back in the dark ages
('twas removed in POSIX issue 7, back in 2008, after being marked
obsolete in issue 6 (2001)).

So, make it visible to any applications that request a suitable
X/Open version (and of course, for _NETBSD_SOURCE).
Still no effect on the issue for the PR.

PR lib/58674
Hopefully allow the tools gmake to build (everywhere).

Don't use the system bsd_signal() function, even if one is
defined, use a locally defined one instead. Note that it
cannot be declared static (which the code would do) as it
is possible that system header files might define the function,
if it exists on the host system, and that prototype would not
(cannot) be static.

This is a horrible hack, feel free to do something better.

Note: this version of gmake is (currently anyway) used only
as part of the tools used for building NetBSD - apart from that
it is used for nothing.
 1.53.6.1  14-Oct-2024  martin Pull up following revision(s) (requested by kre in ticket #978):

bin/date/date.c (apply patch)
usr.bin/sed/process.c: revision 1.54
sys/sys/signal.h: revision 1.77
sys/sys/signal.h: revision 1.78
external/gpl2/gmake/dist/main.c: revision 1.2

PR lib/58674
When building the tools version of sed, treat all wide characters
as if they occupy just one column for the purposes of sed's 'l'
command (which it is very unlikely to be used from the tools sed).
wdwidth() is another XSI function, not necessarily available everywhere.

PR lib/58674
bsd_signal should only be visible with _NETBSD_SOURCE - it isn't any kind =
of
standard function (despite also existing in other systems).
This change inspired by the PR, but doesn't fix it in any way, the tools
config script for gmake doesn't care if the function is visible in any
header, merely if present in libc.

PR lib/58674 (not really so much any more)
Correct previous.
bsd_signal should only be visible with _NETBSD_SOURCE - it isn't any kind =
of
standard function (despite also existing in other systems).

Turns out that it used to be an XSI function, back in the dark ages
('twas removed in POSIX issue 7, back in 2008, after being marked
obsolete in issue 6 (2001)).
So, make it visible to any applications that request a suitable
X/Open version (and of course, for _NETBSD_SOURCE).
Still no effect on the issue for the PR.

PR lib/58674
Hopefully allow the tools gmake to build (everywhere).
Don't use the system bsd_signal() function, even if one is
defined, use a locally defined one instead. Note that it
cannot be declared static (which the code would do) as it
is possible that system header files might define the function,
if it exists on the host system, and that prototype would not
(cannot) be static.

This is a horrible hack, feel free to do something better.

Note: this version of gmake is (currently anyway) used only
as part of the tools used for building NetBSD - apart from that
it is used for nothing.

RSS XML Feed