aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/sed
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | Use src.opts.mk in preference to bsd.own.mk except where we need stuffWarner Losh2014-05-061-1/+1
| |_|/ |/| | | | | | | | | | | | | | | | | from the latter. Notes: svn path=/head/; revision=265420
* | | Mark multi_test as requiring /usr/share/dict/words.Julio Merino2014-03-191-0/+1
| | | | | | | | | | | | | | | | | | | | | The file may not be present if MK_DICT=no. Pointed out by Casey Peel. Notes: svn path=/head/; revision=263388
* | | Migrate most of tools/regression/usr.bin/ to the new tests layout.Julio Merino2014-03-16160-0/+5743
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I'm starting with the easy cases. The leftovers need to be looked at a bit more closely. Note that this change _does_ modify the code of the old tests. This is required in order to allow the code to locate the data files in the source directory instead of the current directory, because Kyua automatically changes the latter to a temporary directory. Also note that at least one test is known to be broken here. Actually, the test is not really broken: it's marked as a TODO but unfortunately Kyua's TAP parser currently does not understand that. Will have to be fixed separately. Notes: svn path=/head/; revision=263227
* | | Per the resolution of POSIX bug 0000779 (note 0002050) add support for using 'i'Eitan Adler2013-12-092-3/+4
| |/ |/| | | | | | | | | | | | | | | | | | | as a case insensitive flag. PR: standards/184641 Requested by: David A. Wheeler <dwheeler@dwheeler.com> MFC After: 1 week Notes: svn path=/head/; revision=259132
* | sed: use getline() instead of fgetln().Pedro F. Giffuni2013-06-261-8/+11
|/ | | | | | | | | | | | | | | | | In BSD, fgetln() available in libc but in Illumos the Solaris port had to include it internally. It also seems to have caused problems [1]. Aid portability by using getline() instead. Reference: https://www.illumos.org/issues/3820 [1] Submitted by: Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.com> Reviewed by: dds MFC after: 2 weeks Notes: svn path=/head/; revision=252231
* Remove trailing whitespace per mdoc lint warningEitan Adler2012-03-291-2/+2
| | | | | | | | | | Disussed with: gavin No objection from: doc Approved by: joel MFC after: 3 days Notes: svn path=/head/; revision=233648
* Reword '}' description to sound more clear.Andrey A. Chernov2011-10-291-1/+1
| | | | | | | | Submitted by: dougb MFC after: 7 days Notes: svn path=/head/; revision=226895
* Update '}' description to reflect reality (and POSIX)Andrey A. Chernov2011-10-281-1/+1
| | | | | | | | | PR: 96236 Submitted by: "Andreas Kohn" <andreas@syndrom23.de> MFC after: 7 days Notes: svn path=/head/; revision=226889
* sed: Try hard links to make -i target available continually.Jilles Tjoelker2011-01-081-4/+21
| | | | | | | | | | | | | | | | | | | | | | | | When creating a backup file, sed renamed the original before renaming the changed copy into place, leading to a short time when no file with the original name was present (usually only visible on SMP systems). Try creating the backup file using a hard link instead, avoiding this problem. If creating the hard link fails for any reason, fall back to the old rename method. When not creating a backup file, sed already renamed the changed copy onto the original. This remains unchanged. I am not adding the suppression of redundant fchown/fchmod to this commit, because FreeBSD appears to check this in the kernel (for msdosfs at least). PR: bin/153261 Submitted by: Pedro F. Giffuni Reviewed by: dds (older version) Obtained from: Illumos MFC after: 2 weeks Notes: svn path=/head/; revision=217133
* Make -r mean exactly the same thing as -E for increased compatibilityWarner Losh2010-03-312-3/+8
| | | | | | | | | with GNU sed. MFC after: 7 days Notes: svn path=/head/; revision=205992
* Build usr.bin/ with WARNS=6 by default.Ed Schouten2010-01-021-0/+2
| | | | | | | Also add some missing $FreeBSD$ to keep svn happy. Notes: svn path=/head/; revision=201386
* Revert most part of 200420 as requested, as more review and polish isXin LI2009-12-132-0/+8
| | | | | | | needed. Notes: svn path=/head/; revision=200462
* Remove unneeded header includes from usr.bin/ except contributed code.Xin LI2009-12-112-8/+0
| | | | | | | Tested with: make universe Notes: svn path=/head/; revision=200420
* IEEE Std 1003.1, 2004 Edition states:Diomidis Spinellis2009-09-201-2/+1
| | | | | | | | | | | | | | | | "The escape sequence '\n' shall match a <newline> embedded in the pattern space." It is unclear whether this also applies to a \n embedded in a character class. Disable the existing handling of \n in a character class following Mac OS X, GNU sed version 4.1.5 with --posix, and SunOS 5.10 /usr/bin/sed. Pointed by: Marius Strobl Obtained from: Mac OS X Notes: svn path=/head/; revision=197362
* Follow POSIX (IEEE Std 1003.1, 2004 Edition) in the implementationDiomidis Spinellis2009-09-201-9/+12
| | | | | | | | | | | | | | 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" Pointed by: Marius Strobl Obtained from: Mac OS X Notes: svn path=/head/; revision=197361
* Allow [ to be used as a delimiter.Diomidis Spinellis2009-09-201-1/+1
| | | | | | | | Pointed by: Marius Strobl Obtained from: Apple Notes: svn path=/head/; revision=197356
* Bump the document date to reflect the recent address range enhancements.Brian Somers2009-05-251-1/+1
| | | | | | | Suggested by: throdes Notes: svn path=/head/; revision=192773
* Implement "addr1,+N" ranges - not dissimilar to grep's -A switch.Brian Somers2009-05-254-18/+39
| | | | | | | | PR: 134856 Submitted by: Jeremie Le Hen - jeremie at le-hen dot org Notes: svn path=/head/; revision=192732
* Fix the code to conform to the "or more" part of the following POSIXDiomidis Spinellis2008-11-111-1/+1
| | | | | | | | | | | | | specification and regression test regress:25. "A function can be preceded by one or more '!' characters, in which case the function shall be applied if the addresses do not select the pattern space." MFC after: 2 weeks Notes: svn path=/head/; revision=184854
* Add workaround for a back reference when no correspondingHiroki Sato2008-11-091-0/+8
| | | | | | | | | | | | | | parenthesized subexpression is defined. For example, the following command line caused unexpected behavior like segmentation fault: % echo test | sed -e 's/test/\1/' PR: bin/126682 MFC after: 1 week Notes: svn path=/head/; revision=184777
* Correct a silly typo I introduced: withing -> within.Yaroslav Tykhiy2008-09-011-1/+1
| | | | | | | Noticed by: das Notes: svn path=/head/; revision=182616
* Explicitly tell that one needs to start a context address with aYaroslav Tykhiy2008-08-241-4/+11
| | | | | | | | | | | | | | | | backslash if he/she wants to use a non-traditional delimiter, i.e., anything other than a slash. That is, /abc/ works as is, but xabcx needs to be spelled as \xabcx. Add appropriate markup. Bump Dd. Checked with: IEEE Std 1003.1, 2004 Edition MFC after: 3 days Notes: svn path=/head/; revision=182107
* WARNS fixes:David Malone2008-02-094-10/+12
| | | | | | | | | | | | | 1) Add missing parens around assignment that is compared to zero. 2) Make some variables that only take non-negative values unsigned. 3) Some casts/type changes to fix other constness warnings. 4) Make one variable a const char *. 5) Make sure termwidth is positive, it doesn't make sense for it to be negative. Approved by: dds Notes: svn path=/head/; revision=176126
* Fix visibility of "inplace".Diomidis Spinellis2007-11-081-1/+1
| | | | | | | Found by: CScout Notes: svn path=/head/; revision=173437
* Before doing compile_re() which needs a parameter to identifyXin LI2007-07-061-4/+4
| | | | | | | | | | | | | | whether we should ignore case, determine the flag by calling compile_flags() first. Also, make sure that we obtain an initialized cmd->u.s buffer before processing further. We may want to refine this solution later, but for now, make the changes in order to unbreak world build after a sed(1) with rev. 1.29 of compile.c is installed. Approved by: re (hrs) Notes: svn path=/head/; revision=171284
* Add case-insensitive matching to sed, using the 'I' flag, similarly to GNU sed.Suleiman Souhlal2007-07-043-27/+52
| | | | | | | | | | | | For example, sed /foo/Id sed s/foo/bar/Ig Reviewed by: dds Approved by: re (hrs) Notes: svn path=/head/; revision=171206
* Drop the argument to the OUT macro because it can't emitYaroslav Tykhiy2007-06-121-7/+7
| | | | | | | | | | anything but the pattern space anyway. Apply style(9) to the macro. Tested with: md5(1) Notes: svn path=/head/; revision=170609
* Don't forget to clear out the hold space for each subsequent fileYaroslav Tykhiy2007-06-123-4/+18
| | | | | | | | | | | when in -i mode so that each file gets a clean context of its own. Add a regression test for the bug. Tested with: regression tests Notes: svn path=/head/; revision=170608
* There is a symbolic antonym for REPLACE as a flag to cspace()Yaroslav Tykhiy2007-06-121-6/+6
| | | | | | | | | | and mf_fgets(): APPEND. So use it instead of a 0 constant for clarity. Tested with: md5(1) Notes: svn path=/head/; revision=170605
* Don't forget to bump document date after changing the content.Yaroslav Tykhiy2007-04-211-1/+1
| | | | Notes: svn path=/head/; revision=168922
* Change the semantics of -i (in-place editing) so that it treatsYaroslav Tykhiy2007-04-214-11/+83
| | | | | | | | | | | | | | | | | | | | each file independently from other files. The new semantics are desired in the most of practical cases, e.g.: delete lines 5-9 from each file. Keep the previous semantics of -i under a new option, -I, which uses a single continuous address space covering all files to edit in-place -- they are too cool to just drop them. Add regression tests for -i and -I. Approved by: dds Compared with: GNU sed Discussed on: -hackers MFC after: 2 weeks Notes: svn path=/head/; revision=168921
* style(9):Yaroslav Tykhiy2007-04-061-1/+1
| | | | | | | | | Use a single space before $FreeBSD$ to avoid terminal line overflow. Pointed out by: ru (The All-Seeing Eye) Notes: svn path=/head/; revision=168417
* Add an important detail to paragraph 12: the range is reset only if itsYaroslav Tykhiy2007-04-051-2/+3
| | | | | | | second address is a line number. Notes: svn path=/head/; revision=168389
* Reflect the change in rev. 1.44 of process.c.Yaroslav Tykhiy2007-04-051-4/+9
| | | | | | | Add $FreeBSD$ to please commit_prep.pl. Notes: svn path=/head/; revision=168386
* Don't forget to close the range if we branched over its endYaroslav Tykhiy2007-04-021-2/+11
| | | | | | | | | | | | | | | | and had no chance to match it by the 2nd address precisely. Otherwise the unclosed range would bogusly extend to the end of stream. Add a basic regression test for the bug fixed. (This change also fixes the more complex case 5.3 from `multitest.t'.) Compared with: SUN and GNU seds Tested by: regression tests MFC after: 1 week Notes: svn path=/head/; revision=168258
* Prevent foot-shooting in advance: Put the MATCH() macro's valueYaroslav Tykhiy2007-04-021-3/+3
| | | | | | | | | | | in parentheses. The ?: operator has a remarkably low precedence, so expressions like (MATCH(foo) && bar) would have an unexpected meaning w/o the parentheses around MATCH(). Tested with: md5(1) Notes: svn path=/head/; revision=168255
* This trivial change should fix at least 3 similar bugs. All ofYaroslav Tykhiy2007-04-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | them are related to the `c' function's need to know if we are at the actual end of the address range. (It must print the text not earlier than the whole pattern space was deleted.) It appears the only sed function with this requirement. There is `lastaddr' set by applies(), which is to notify the `c' function, but it can't always help because it's false when we are hitting the end of file early. There is also a bug in applies() due to which `lastaddr' isn't set to true on degenerate ranges such as `$,$' or `N,$' if N appears the last line number. Handling early EOF condition in applies() could look more logical, but it would effectively revert sed to the unreasonable behaviour rev. 1.26 of main.c fought against, as it would require lastline() be called for each line within each address range. So it's better to call lastline() only if needed by the `c' function. Together with this change to sed go regression tests for the bugs fixed (c1-c3). A basic test of `c' (c0) is also added as it helped me to spot my own error. Discussed with: dds Tested by: the regression tests MFC after: 1 week Notes: svn path=/head/; revision=168211
* Make the comment for cspace() match reality.Yaroslav Tykhiy2007-03-311-3/+3
| | | | Notes: svn path=/head/; revision=168120
* Test files repo-copied into tools/regression/usr.bin/sed and integratedDiomidis Spinellis2007-03-143-1098/+0
| | | | | | | into the regression testing framework. Notes: svn path=/head/; revision=167556
* Fix using "P" command on empty pattern space. If the "P" command isKirill Ponomarev2006-05-271-2/+1
| | | | | | | | | | | | | used once on a non-empty pattern space and then again on an empty pattern space, the second usage restores the pattern space length to the length that it had when the first "P" was used. PR: bin/96052 Submitted by: Andrey Zholos <aaz@althenia.net> MFC after: 7 days Notes: svn path=/head/; revision=158989
* The function inplace_edit() doesn't exist anymore, remove the prototype.Stefan Farfeleder2005-09-241-1/+0
| | | | | | | Submitted by: Leonardo Chiquitto Filho Notes: svn path=/head/; revision=150513
* Bug fix: a numeric flag specification in the substitute command wouldDiomidis Spinellis2005-08-041-2/+8
| | | | | | | | | | | cause the next substitute flag to be ignored. While working at it, detect and report overflows. Reported by: Jingsong Liu MFC after: 1 week Notes: svn path=/head/; revision=148692
* Markup and wording fixes.Ruslan Ermilov2005-06-141-1/+1
| | | | | | | Approved by: re (blanket) Notes: svn path=/head/; revision=147370
* Add option -l, to make output line buffered.Gleb Smirnoff2005-05-102-5/+11
| | | | | | | | | PR: bin/78692 Submitted by: Eugene Grosbein MFC after: 2 weeks Notes: svn path=/head/; revision=146055
* Remove unused variables.Stefan Farfeleder2005-04-091-2/+1
| | | | Notes: svn path=/head/; revision=144840
* Fix dubious C code construct.Stefan Farfeleder2005-03-091-1/+1
| | | | Notes: svn path=/head/; revision=143318
* Expand *n't contractions.Ruslan Ermilov2005-02-131-1/+1
| | | | Notes: svn path=/head/; revision=141846
* Include missing headers.Stefan Farfeleder2005-02-091-0/+1
| | | | Notes: svn path=/head/; revision=141563
* Added the EXIT STATUS section where appropriate.Ruslan Ermilov2005-01-171-1/+1
| | | | Notes: svn path=/head/; revision=140368
* Scheduled mdoc(7) sweep.Ruslan Ermilov2005-01-111-5/+3
| | | | Notes: svn path=/head/; revision=140055