summaryrefslogtreecommitdiffstats
path: root/usr.bin/sed (follow)
Commit message (Collapse)AuthorAgeFilesLines
* normalize the ordering of tame requests (particularily, "rpath wpath cpath",deraadt2015-10-101-3/+3
| | | | | | | 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.
* Change all tame callers to namechange to pledge(2).deraadt2015-10-091-5/+5
|
* sed only works on files, so the obvious goal is to remove it's networkderaadt2015-10-031-1/+9
| | | | | | | 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
* fix eyesore whitespacejasper2015-07-201-6/+6
|
* figure out the linewidth at initialization, rather than latederaadt2015-07-192-20/+17
| | | | ok tedu miod
* Print strerror, not just the filename, if opening the inplace file fails.sthen2015-07-191-2/+3
| | | | ok jasper@
* various fixes; ok jasperjmc2015-07-182-16/+11
|
* add missing prototypejasper2015-07-171-1/+2
|
* 7 space indents??deraadt2015-07-171-24/+22
|
* add -i flag to sed to do in-place editing; mostly based on freebsdjasper2015-07-175-108/+276
| | | | feedback/ok deraadt@ millert@
* POSIX specifies that that multiple '!' characters preceding amillert2015-06-231-2/+2
| | | | | function should be treated as a single negation. From FreeBSD via Liviu Daia.
* Convert many atoi() calls to strtonum(), adding range checks and failurederaadt2015-04-181-4/+6
| | | | | handling along the way. Reviews by Brendan MacDonell, Jeremy Devenport, florian, doug, millert
* correct multiplication idiom during xreallocarray, and expand appendnumderaadt2015-04-132-9/+11
| | | | | to size_t to avoid overflow after allocation success ok guenther doug
* Make some $OpenBSD$ lines prettier/standardier by eliminatingkrw2015-01-192-2/+2
| | | | | | | superflous '*' after '/*' and adding blank after terminating '$'. Also eases parsing of the lines by simple awk scripts. Aesthetic approval from tedu@.
* Bounds check the file path used in the 'w' command. Modified versionjsg2014-12-121-2/+5
| | | | | of a diff from Sebastien Marie to prevent a crash found by Sebastien with the afl fuzzer.
* Rework the pointer swap in the 'P' command to make the intentjsg2014-12-121-4/+5
| | | | | clearer and avoid a crash on 'g;P' found by Sebastien Marie with the afl fuzzer.
* sed has a xreallocarray(), but two n*s cases were not replacedderaadt2014-12-011-7/+7
|
* Prefer setvbuf() to setlinebuf() for portability; ok deraadt@millert2014-11-261-2/+2
|
* make the description of the syntax of function lists agreeschwarze2014-10-221-10/+5
| | | | | | with our actual implementation, which also agrees with POSIX; triggered by guenther@'s answer to a question from chrisz@; ok chrisz@ guenther@
* add a xreallocarray() like the existing fatal xmalloc(), and use it toderaadt2014-10-083-5/+16
| | | | | detect potential integer. ok doug
* paste in an EXAMPLES section, from posix spec;jmc2014-05-271-1/+29
|
* there is no need to xref regex(3) and setbuf(3) in SEE ALSO - re_format(7)jmc2014-05-271-4/+2
| | | | is enough;
* tweak the text for -a and function lists;jmc2014-05-261-8/+8
|
* rework the SED FUNCTIONS text;jmc2014-05-261-19/+27
|
* the `P' function was crying out for a comma;jmc2014-05-261-3/+3
|
* posix does not count `!' as a separate function, and neither should we;jmc2014-05-261-5/+6
| | | | | instead, move the description of this mechanism into the general SED FUNCTIONS section;
* remove the ugly hack that saw two It macros used to render one item; replacejmc2014-05-261-102/+86
| | | | | | | | 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;
* unsigned char for ctypederaadt2013-11-282-7/+9
| | | | ok krw okan
* Rewrite the main loop of the "sed s/..." command, to fix multipleschwarze2011-09-171-49/+44
| | | | | | | | | | | | | 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.
* Backout previous, naddy@ found the following regression:schwarze2011-07-261-43/+49
| | | | | | | | 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.
* Rewrite the main loop of the "sed s/..." command, shortening it by tenschwarze2011-07-241-49/+43
| | | | | | | | | | | | | | | 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@.
* NUL-terminate buffer in compiler_text() after realloc, not before.millert2010-11-151-2/+3
| | | | | Now that we have dynamically sized buffers there may not be room for the NUL until after realloc.
* add an EXIT STATUS section for /usr/bin;jmc2010-09-031-3/+3
|
* Follow POSIX (IEEE Std 1003.1, 2004 Edition) in the implementationnaddy2010-07-011-7/+10
| | | | | | | | | | 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@
* Allow [ to be used as a delimiter.naddy2010-07-011-2/+2
| | | | From FreeBSD; ok millert@ halex@
* remove references to docs we no longer install;jmc2010-01-101-5/+2
|
* Stop installing many of the incredibly dated and un-authoritative share/docderaadt2010-01-041-6/+1
| | | | | | | 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
* rcsid[] and sccsid[] and copyright[] are essentially unmaintained (andderaadt2009-10-274-27/+4
| | | | | | | 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
* When adding text due to an a, c, or i command, don't eat the space(s) atreyk2009-10-231-3/+2
| | | | | | | | the beginning of the lines since the addition is supposed to be "verbatim". From NetBSD, also matches the bahaviour of GNU sed ok millert@
* tweak previous;jmc2009-08-071-11/+14
|
* add -E flag to compile regular expressions using the extended POSIXdjm2009-08-074-16/+29
| | | | | | | | 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@
* bump the posix reference in STANDARDS to IEEE Std 1003.1-2008, with a fewjmc2009-02-081-3/+3
| | | | updates to follow;
* Move memory allocation closer to where it is needed. Also makemillert2008-10-163-46/+46
| | | | a distinction between len and size. OK deraadt@
* Now that len is set later in compile_subst() we need to move themillert2008-10-091-5/+5
| | | | xmalloc call that goes with it.
* In compile_subst(), adjust for the fact that the initial buffermillert2008-10-091-3/+6
| | | | | that is passed in may now be larger than _POSIX2_LINE_MAX. Thanks to pedro@ for the test case. OK pedro@
* Don't strip newline when reading lines; matches the original behavior.millert2008-10-091-4/+2
| | | | From otto@
* Allow sed to handle arbitrarily long lines. Also plug a memorymillert2008-10-084-47/+84
| | | | leak noticed in the process. Closes PR 5303. OK otto@ deraadt@
* The 'l' command should not encode newlines. Also document thatmillert2008-10-072-9/+9
| | | | backspace is escaped as \b. OK phessler@ and jmc@
* There is no /usr/old/bin/sed so compare test results against /usr/bin/sedmillert2008-10-071-3/+3
|
* note that the opening delimiter of a context address should be precededjmc2008-09-011-3/+5
| | | | | | by a backslash, if the delimiter is not a slash; adapted from freebsd -r1.47 from yar;