summaryrefslogtreecommitdiff
path: root/usr.bin/sed
AgeCommit message (Collapse)Author
2015-11-04replace setbuf with setvbuf, from Frederic NowakTed Unangst
2015-10-26Tidy up error() levels: merge COMPILE and COMPILE2, and kill ERROR (unused)Jeremie Courreges-Anglas
ok tobias@
2015-10-26Use error(FATAL) instead of what was previously err(1,...)Jeremie Courreges-Anglas
ok tobias@
2015-10-26Rename err() to error() to prevent confusion with the stdlib function.mmcc
Discussed with jca@.
2015-10-25Write error message instead of duplicated file name on error.Tobias Stoeckmann
ok deraadt
2015-10-10normalize the ordering of tame requests (particularily, "rpath wpath cpath",Theo de Raadt
which i have put in that order). this is not important, but helps look for outliers which might be strange. it hints that "ioctl" should be reassessed in a few places, to see if "tty" is better; that "unix" may be used in some places where "route" could now work.
2015-10-09Change all tame callers to namechange to pledge(2).Theo de Raadt
2015-10-03sed only works on files, so the obvious goal is to remove it's networkTheo de Raadt
access in case it is exploited. tame with "stdio wpath rpath cpath" seesms to covers all usage cases, except -i performs a fchmod() on the in-place file, so conditionally also needs "fattr". ok sthen
2015-07-20fix eyesore whitespaceJasper Lievisse Adriaanse
2015-07-19figure out the linewidth at initialization, rather than lateTheo de Raadt
ok tedu miod
2015-07-19Print strerror, not just the filename, if opening the inplace file fails.Stuart Henderson
ok jasper@
2015-07-18various fixes; ok jasperJason McIntyre
2015-07-17add missing prototypeJasper Lievisse Adriaanse
2015-07-177 space indents??Theo de Raadt
2015-07-17add -i flag to sed to do in-place editing; mostly based on freebsdJasper Lievisse Adriaanse
feedback/ok deraadt@ millert@
2015-06-23POSIX specifies that that multiple '!' characters preceding aTodd C. Miller
function should be treated as a single negation. From FreeBSD via Liviu Daia.
2015-04-18Convert many atoi() calls to strtonum(), adding range checks and failureTheo de Raadt
handling along the way. Reviews by Brendan MacDonell, Jeremy Devenport, florian, doug, millert
2015-04-13correct multiplication idiom during xreallocarray, and expand appendnumTheo de Raadt
to size_t to avoid overflow after allocation success ok guenther doug
2015-01-19Make some $OpenBSD$ lines prettier/standardier by eliminatingKenneth R Westerback
superflous '*' after '/*' and adding blank after terminating '$'. Also eases parsing of the lines by simple awk scripts. Aesthetic approval from tedu@.
2014-12-12Bounds check the file path used in the 'w' command. Modified versionJonathan Gray
of a diff from Sebastien Marie to prevent a crash found by Sebastien with the afl fuzzer.
2014-12-12Rework the pointer swap in the 'P' command to make the intentJonathan Gray
clearer and avoid a crash on 'g;P' found by Sebastien Marie with the afl fuzzer.
2014-12-01sed has a xreallocarray(), but two n*s cases were not replacedTheo de Raadt
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@