OpenBSD CVS

CVS log for src/usr.bin/sed/process.c


[BACK] Up to [local] / src / usr.bin / sed

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.35 / (download) - annotate - [select for diffs], Wed Jan 12 15:13:36 2022 UTC (2 years, 4 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, HEAD
Changes since 1.34: +6 -6 lines
Diff to previous 1.34 (colored)

Make lputs use psl instead of expecting it to be null-terminated.
This allows us to enable the commandl1 and commandl2 regress tests.

Original analysis from seL4 <at> disroot <dot> org
OK millert@

Revision 1.34 / (download) - annotate - [select for diffs], Wed Nov 14 10:59:33 2018 UTC (5 years, 6 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6, OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.33: +6 -2 lines
Diff to previous 1.33 (colored)

Make sed's -i flag more compatible with what gsed does.
- Reset the hold-space in between files
- quit the editor as soon as a 'q' command is found
- Make sure the temp-file is written back to the original file if we quit
  the editor

temp-file not written back issue found by Time Chase.
Lots of feedback from millert@ and schwarze@
OK millert@

Revision 1.33 / (download) - annotate - [select for diffs], Wed Dec 13 16:06:34 2017 UTC (6 years, 5 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.32: +10 -10 lines
Diff to previous 1.32 (colored)

Fix sign compare warnings; OK martijn@

Revision 1.32 / (download) - annotate - [select for diffs], Wed Feb 22 14:09:09 2017 UTC (7 years, 2 months ago) by tom
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.31: +1 -3 lines
Diff to previous 1.31 (colored)

Remove unused-with-dead-store variable oldpsanl.

From Daniel Cegielka - thanks

ok jca@

Revision 1.31 / (download) - annotate - [select for diffs], Sat Jan 21 10:05:23 2017 UTC (7 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.30: +6 -6 lines
Diff to previous 1.30 (colored)

Nuke more whitespace caught in the headlights of "warning:"
rectification.

Revision 1.30 / (download) - annotate - [select for diffs], Fri Jan 20 10:26:16 2017 UTC (7 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.29: +1 -2 lines
Diff to previous 1.29 (colored)

Split error() into error() and warning() so error() can be marked __dead to
appease gcc.

ok procter@ deraadt@

Revision 1.29 / (download) - annotate - [select for diffs], Tue Oct 11 19:27:39 2016 UTC (7 years, 7 months ago) by martijn
Branch: MAIN
Changes since 1.28: +2 -2 lines
Diff to previous 1.28 (colored)

Fix an off by one error when no matches were found in a substitute.
By pfg@ from FreeBSD

OK millert@ and otto@

Revision 1.28 / (download) - annotate - [select for diffs], Mon May 30 18:10:29 2016 UTC (7 years, 11 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.27: +24 -17 lines
Diff to previous 1.27 (colored)

Make sed use the new REG_STARTEND | REG_NOTBOL combination. This fixes a begin
of word mismatch as reported by jsg@.

Discussed with otto@ and others early on, earlier version tested in ports build
by aja@

OK millert@
Few readability tweaks and OK schwarze@

Revision 1.27 / (download) - annotate - [select for diffs], Mon Oct 26 14:08:47 2015 UTC (8 years, 6 months ago) by mmcc
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.26: +12 -12 lines
Diff to previous 1.26 (colored)

Rename err() to error() to prevent confusion with the stdlib function.

Discussed with jca@.

Revision 1.26 / (download) - annotate - [select for diffs], Mon Jul 20 18:24:15 2015 UTC (8 years, 10 months ago) by jasper
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.25: +6 -6 lines
Diff to previous 1.25 (colored)

fix eyesore whitespace

Revision 1.25 / (download) - annotate - [select for diffs], Sun Jul 19 17:21:21 2015 UTC (8 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.24: +2 -19 lines
Diff to previous 1.24 (colored)

figure out the linewidth at initialization, rather than late
ok tedu miod

Revision 1.24 / (download) - annotate - [select for diffs], Fri Jul 17 20:38:57 2015 UTC (8 years, 10 months ago) by jasper
Branch: MAIN
Changes since 1.23: +74 -47 lines
Diff to previous 1.23 (colored)

add -i flag to sed to do in-place editing; mostly based on freebsd

feedback/ok deraadt@ millert@

Revision 1.23 / (download) - annotate - [select for diffs], Sat Apr 18 18:28:37 2015 UTC (9 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.22: +6 -4 lines
Diff to previous 1.22 (colored)

Convert many atoi() calls to strtonum(), adding range checks and failure
handling along the way.
Reviews by Brendan MacDonell, Jeremy Devenport, florian, doug, millert

Revision 1.22 / (download) - annotate - [select for diffs], Mon Apr 13 05:11:23 2015 UTC (9 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.21: +9 -7 lines
Diff to previous 1.21 (colored)

correct multiplication idiom during xreallocarray, and expand appendnum
to size_t to avoid overflow after allocation success
ok guenther doug

Revision 1.21 / (download) - annotate - [select for diffs], Fri Dec 12 03:22:35 2014 UTC (9 years, 5 months ago) by jsg
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.20: +5 -4 lines
Diff to previous 1.20 (colored)

Rework the pointer swap in the 'P' command to make the intent
clearer and avoid a crash on 'g;P' found by Sebastien Marie with
the afl fuzzer.

Revision 1.20 / (download) - annotate - [select for diffs], Mon Dec 1 06:37:25 2014 UTC (9 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.19: +7 -7 lines
Diff to previous 1.19 (colored)

sed has a xreallocarray(), but two n*s cases were not replaced

Revision 1.19 / (download) - annotate - [select for diffs], Thu Nov 28 18:24:55 2013 UTC (10 years, 5 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6, OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.18: +4 -3 lines
Diff to previous 1.18 (colored)

unsigned char for ctype
ok krw okan

Revision 1.18 / (download) - annotate - [select for diffs], Sat Sep 17 15:29:19 2011 UTC (12 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.17: +44 -49 lines
Diff to previous 1.17 (colored)

Rewrite the main loop of the "sed s/..." command, to fix multiple
issues regarding the replacement of zero-length strings.

This commit brings back rev. 1.16, but without the regression that
forced the backout:  No NUL bytes will be output now, not even when
the input file lacks a trailing newline character and there is a
zero-length match at the end.

OK otto@ deraadt@;
and naddy@ (who originally found the regression) checked that
the regression is indeed fixed.

Revision 1.17 / (download) - annotate - [select for diffs], Tue Jul 26 08:47:07 2011 UTC (12 years, 9 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.16: +49 -43 lines
Diff to previous 1.16 (colored)

Backout previous, naddy@ found the following regression:
When the input does not end in a trailing newline character
and there is an empty match at the end, the new code adds
a spurious '\0' character.
I have a fix, but otto@ prefers backout and full re-evaluation
after release.

Revision 1.16 / (download) - annotate - [select for diffs], Sun Jul 24 13:59:15 2011 UTC (12 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.15: +43 -49 lines
Diff to previous 1.15 (colored)

Rewrite the main loop of the "sed s/..." command, shortening it by ten
lines and simplifying it by removing the switch statement implementing
/g, /1, and /2 separately and repetitively.
The idea to make the loop control variable slen, i.e. the length of the
string remaining to be processed, signed, and stay in the loop even when
slen == 0 (i.e. at the end of the string), lifted from FreeBSD by otto@.
On i386, process.o shrinks by 440 bytes, and the sed binary by 23 bytes.

This fixes multiple aspects of the replacement of multiple (/g) or
specific (e.g. /2) instances of zero-length matches, both with BREs and
EREs, both with and without a trailing newline character on the input.

Feedback and OK otto@.

Revision 1.15 / (download) - annotate - [select for diffs], Tue Oct 27 23:59:43 2009 UTC (14 years, 6 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8, OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.14: +1 -6 lines
Diff to previous 1.14 (colored)

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable).  these days, people use source.  these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms

Revision 1.14 / (download) - annotate - [select for diffs], Tue Oct 7 21:51:37 2008 UTC (15 years, 7 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.13: +5 -5 lines
Diff to previous 1.13 (colored)

The 'l' command should not encode newlines.  Also document that
backspace is escaped as \b.  OK phessler@ and jmc@

Revision 1.13 / (download) - annotate - [select for diffs], Mon Oct 9 00:23:57 2006 UTC (17 years, 7 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4, OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2, OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.12: +15 -14 lines
Diff to previous 1.12 (colored)

pretty.  the comma operator should not be used to cram two statements into
an if without braces, or worse, into a return.

Revision 1.12 / (download) - annotate - [select for diffs], Fri Nov 7 02:58:23 2003 UTC (20 years, 6 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0, OPENBSD_3_9_BASE, OPENBSD_3_9, OPENBSD_3_8_BASE, OPENBSD_3_8, OPENBSD_3_7_BASE, OPENBSD_3_7, OPENBSD_3_6_BASE, OPENBSD_3_6, OPENBSD_3_5_BASE, OPENBSD_3_5
Changes since 1.11: +13 -9 lines
Diff to previous 1.11 (colored)

prevent overflow, see freebsd r1.32.  also, do nicer reallocs.
ok millert@ otto@

Revision 1.11 / (download) - annotate - [select for diffs], Tue Jun 10 22:20:51 2003 UTC (20 years, 11 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.10: +12 -25 lines
Diff to previous 1.10 (colored)

mostly ansi cleanup; pval ok

Revision 1.10 / (download) - annotate - [select for diffs], Tue Jun 3 02:56:16 2003 UTC (20 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.9: +3 -7 lines
Diff to previous 1.9 (colored)

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999.  Proofed by myself and Theo.

Revision 1.9 / (download) - annotate - [select for diffs], Tue Jun 11 06:16:36 2002 UTC (21 years, 11 months ago) by jsyn
Branch: MAIN
CVS Tags: OPENBSD_3_3_BASE, OPENBSD_3_3, OPENBSD_3_2_BASE, OPENBSD_3_2
Changes since 1.8: +6 -6 lines
Diff to previous 1.8 (colored)

kill err(3) newlines; ok miod@, deraadt@

Revision 1.8 / (download) - annotate - [select for diffs], Mon Apr 15 21:47:45 2002 UTC (22 years, 1 month ago) by millert
Branch: MAIN
Changes since 1.7: +7 -5 lines
Diff to previous 1.7 (colored)

Fix sed(1) in the case where a last line is specified and hold space
is not specified, and then the first part of the pattern space is
deleted, when there are two or more input lines, as this results
in subtraction of one from an unsigned integral value of '0'.  That
bogus value is used in one case for a loop (that will run far too
many times in this case) and a function to search for a value within
a specified range of memory, however now the range of memory is
obscenely large and a segmentation (or memory) fault will occur.
This is fixed by checking for and appropriately handling a nil
pattern space as if the specified search in memory failed, as indeed
it obviously will with nil pattern space.

From Tim J. Robbins by way of FreeBSD

Revision 1.7 / (download) - annotate - [select for diffs], Sat Feb 16 21:27:52 2002 UTC (22 years, 3 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_1_BASE, OPENBSD_3_1
Changes since 1.6: +8 -8 lines
Diff to previous 1.6 (colored)

Part one of userland __P removal.  Done with a simple regexp with some minor hand editing to make comments line up correctly.  Another pass is forthcoming that handles the cases that could not be done automatically.

Revision 1.6 / (download) - annotate - [select for diffs], Mon Nov 19 19:02:16 2001 UTC (22 years, 6 months ago) by mpech
Branch: MAIN
Changes since 1.5: +8 -8 lines
Diff to previous 1.5 (colored)

kill more registers

millert@ ok

Revision 1.5 / (download) - annotate - [select for diffs], Sun Jun 6 15:42:24 1999 UTC (24 years, 11 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE, OPENBSD_3_0, OPENBSD_2_9_BASE, OPENBSD_2_9, OPENBSD_2_8_BASE, OPENBSD_2_8, OPENBSD_2_7_BASE, OPENBSD_2_7, OPENBSD_2_6_BASE, OPENBSD_2_6
Changes since 1.4: +4 -2 lines
Diff to previous 1.4 (colored)

make G newline if hold is empty

Revision 1.4 / (download) - annotate - [select for diffs], Thu Apr 30 06:21:16 1998 UTC (26 years ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_5_BASE, OPENBSD_2_5, OPENBSD_2_4_BASE, OPENBSD_2_4
Changes since 1.3: +3 -3 lines
Diff to previous 1.3 (colored)

make y command 8 bit clean; Elmar.Bartel@informatik.tu-muenchen.de

Revision 1.3 / (download) - annotate - [select for diffs], Thu Sep 11 11:21:07 1997 UTC (26 years, 8 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_3_BASE, OPENBSD_2_3, OPENBSD_2_2_BASE, OPENBSD_2_2
Changes since 1.2: +5 -5 lines
Diff to previous 1.2 (colored)

extra ()

Revision 1.2 / (download) - annotate - [select for diffs], Wed Jun 26 05:39:08 1996 UTC (27 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_1_BASE, OPENBSD_2_1, OPENBSD_2_0_BASE, OPENBSD_2_0
Changes since 1.1: +3 -1 lines
Diff to previous 1.1 (colored)

rcsid

Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Wed Oct 18 08:46:05 1995 UTC (28 years, 7 months ago) by deraadt
CVS Tags: netbsd_1_1
Changes since 1.1: +0 -0 lines
Diff to previous 1.1 (colored)

initial import of NetBSD tree

Revision 1.1 / (download) - annotate - [select for diffs], Wed Oct 18 08:46:05 1995 UTC (28 years, 7 months ago) by deraadt
Branch: MAIN

Initial revision

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.