summaryrefslogtreecommitdiff
path: root/usr.bin/sed
AgeCommit message (Collapse)Author
2014-11-26Prefer setvbuf() to setlinebuf() for portability; ok deraadt@Todd C. Miller
2014-10-22make the description of the syntax of function lists agreeIngo Schwarze
with our actual implementation, which also agrees with POSIX; triggered by guenther@'s answer to a question from chrisz@; ok chrisz@ guenther@
2014-10-08add a xreallocarray() like the existing fatal xmalloc(), and use it toTheo de Raadt
detect potential integer. ok doug
2014-05-27paste in an EXAMPLES section, from posix spec;Jason McIntyre
2014-05-27there is no need to xref regex(3) and setbuf(3) in SEE ALSO - re_format(7)Jason McIntyre
is enough;
2014-05-26tweak the text for -a and function lists;Jason McIntyre
2014-05-26rework the SED FUNCTIONS text;Jason McIntyre
2014-05-26the `P' function was crying out for a comma;Jason McIntyre
2014-05-26posix does not count `!' as a separate function, and neither should we;Jason McIntyre
instead, move the description of this mechanism into the general SED FUNCTIONS section;
2014-05-26remove the ugly hack that saw two It macros used to render one item; replaceJason McIntyre
with other ugly hack (.br): at least this way we can whack a ton of Pp, and it feels not quite as wrong; while here, fix Em abuse by using Ic for functions and Ar for argument names; i also fixed up the text of "s" a little to make it read better;
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@