summaryrefslogtreecommitdiff
path: root/usr.bin/sed
AgeCommit message (Collapse)Author
2013-11-28unsigned char for ctypeTheo de Raadt
ok krw okan
2011-09-17Rewrite the main loop of the "sed s/..." command, to fix multipleIngo Schwarze
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.
2011-07-26Backout previous, naddy@ found the following regression:Ingo Schwarze
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.
2011-07-24Rewrite the main loop of the "sed s/..." command, shortening it by tenIngo Schwarze
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@.
2010-11-15NUL-terminate buffer in compiler_text() after realloc, not before.Todd C. Miller
Now that we have dynamically sized buffers there may not be room for the NUL until after realloc.
2010-09-03add an EXIT STATUS section for /usr/bin;Jason McIntyre
2010-07-01Follow POSIX (IEEE Std 1003.1, 2004 Edition) in the implementationChristian Weisgerber
of the y (translate) command. "If a backslash character is immediately followed by a backslash character in string1 or string2, the two backslash characters shall be counted as a single literal backslash character" From FreeBSD; ok millert@ halex@
2010-07-01Allow [ to be used as a delimiter.Christian Weisgerber
From FreeBSD; ok millert@ halex@
2010-01-10remove references to docs we no longer install;Jason McIntyre
2010-01-04Stop installing many of the incredibly dated and un-authoritative share/docTheo de Raadt
files. If any information found in these documents is worthwhile and you miss it, please make the time to work it into the manual pages (which people actually do read). ok guenther
2009-10-28rcsid[] and sccsid[] and copyright[] are essentially unmaintained (andTheo de Raadt
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
2009-10-23When adding text due to an a, c, or i command, don't eat the space(s) atReyk Floeter
the beginning of the lines since the addition is supposed to be "verbatim". From NetBSD, also matches the bahaviour of GNU sed ok millert@
2009-08-07tweak previous;Jason McIntyre
2009-08-07add -E flag to compile regular expressions using the extended POSIXDamien Miller
syntax. The -E flag is compatible with the other BSDs and OSX. -r is also provided as an alias for compatibility with GNU sed. feedback from jmc@ and millert@ ok millert@ pyr@ henning@ marco@
2009-02-08bump the posix reference in STANDARDS to IEEE Std 1003.1-2008, with a fewJason McIntyre
updates to follow;
2008-10-16Move memory allocation closer to where it is needed. Also makeTodd C. Miller
a distinction between len and size. OK deraadt@
2008-10-09Now that len is set later in compile_subst() we need to move theTodd C. Miller
xmalloc call that goes with it.
2008-10-09In compile_subst(), adjust for the fact that the initial bufferTodd C. Miller
that is passed in may now be larger than _POSIX2_LINE_MAX. Thanks to pedro@ for the test case. OK pedro@
2008-10-09Don't strip newline when reading lines; matches the original behavior.Todd C. Miller
From otto@
2008-10-08Allow sed to handle arbitrarily long lines. Also plug a memoryTodd C. Miller
leak noticed in the process. Closes PR 5303. OK otto@ deraadt@
2008-10-07The 'l' command should not encode newlines. Also document thatTodd C. Miller
backspace is escaped as \b. OK phessler@ and jmc@
2008-10-07There is no /usr/old/bin/sed so compare test results against /usr/bin/sedTodd C. Miller
2008-09-01note that the opening delimiter of a context address should be precededJason McIntyre
by a backslash, if the delimiter is not a slash; adapted from freebsd -r1.47 from yar;
2007-10-16sync the synopsis and usage of commandsIgor Sobrado
ok jmc@
2007-05-31convert to new .Dd format;Jason McIntyre
2007-05-30- use a consistent text for STANDARDSJason McIntyre
- note which options are extensions to POSIX
2007-03-20Add line-buffering flag (-u).Ray Lai
OK deraadt@ and jmc@.
2007-03-20remove some bogus *p tests from charles longeauTed Unangst
ok deraadt millert
2007-01-09Accept empty command, from Matthew R. Dempsky; ok deraadt@ millert@Otto Moerbeek
2006-10-26- document that multiple commands may be newline or semicolon separatedJason McIntyre
- refer to latest posix revision - note that -a and newline-separated multiple commands are non-portable - note which commands do not permit being specified separated by semicolons based around pr 5269, from tilo stritzky much help/ok otto
2006-10-24+.Ex -std sedJason McIntyre
2006-10-09pretty. the comma operator should not be used to cram two statements intoTed Unangst
an if without braces, or worse, into a return.
2005-04-11spacingTheo de Raadt
2004-10-04remove some incorrect apostrophes, and make the text referring toJason McIntyre
re_format.7 slightly more consistent w/ other pages;
2004-07-20ansi; khalek@linuxgamers.netTheo de Raadt
2004-07-10xmalloc()->xrealloc() so that patterns larger than _POSIX2_LINE_MAX*2-1Otto Moerbeek
work. From mycroft@netbsd. ok millert@
2004-07-09From the other BSDs: fix a bug that made sed(1) fail if the lastOtto Moerbeek
character of the line buffer was a backslash. ok deraadt@
2004-06-131-byte overflow; ryo@nerv.org, otto okTheo de Raadt
2004-04-06- add margins when formatting w/ -TasciiJason McIntyre
- remove some macros that were causing formatting errors
2004-02-17Unbreak numeric flag parsing. Based on a fix from Jared Yanovich; thisOtto Moerbeek
version with millert@. Resolves PR 3677. ok millert@
2004-02-01add paper.txt target;Jason McIntyre
2004-01-31make USD reference a little clearer;Jason McIntyre
2004-01-29- replace old-style macrosJason McIntyre
- mmultiple args do not need to be quoted - uppercase .Sh args - reference 15.sed usd - some other tidy up
2004-01-23`Ns' implies `No', so `Ns No' -> `Ns'; (even simpler in adduser(8))Jason McIntyre
discussed with todd@
2004-01-02point people to re_format(7) for a description of basic regularJason McIntyre
expressions, rather than regex(3); from Greg A. Woods;
2003-11-07adress -> address, and a few more; all from Jonathon Gray;Jason McIntyre
(mvme68k/mvme88k) vs.c and (vax) if_le.c ok miod@ isakmpd ones ok ho@
2003-11-07prevent overflow, see freebsd r1.32. also, do nicer reallocs.Ted Unangst
ok millert@ otto@
2003-10-07handle ; terminators for strings like other sed programs do. this isTheo de Raadt
apparently an extension, but without it you cannot express longer labelled sed scripts as one-liners. noted by seb@todesplanet.de apr 2002. also noted by cerille lefevre a bit later. fixed by otto and myself, tested on tree builds to be careful
2003-09-02escape punctuation;Jason McIntyre
ok deraadt@
2003-08-27install sed USD;Jason McIntyre
ok mickey@