summaryrefslogtreecommitdiffstats
path: root/usr.bin/sed
Commit message (Collapse)AuthorAgeFilesLines
* WARNS fixes:dwmalone2008-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
* Fix visibility of "inplace".dds2007-11-081-1/+1
| | | | Found by: CScout
* Before doing compile_re() which needs a parameter to identifydelphij2007-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)
* Add case-insensitive matching to sed, using the 'I' flag, similarly to GNU sed.ssouhlal2007-07-043-27/+52
| | | | | | | | | For example, sed /foo/Id sed s/foo/bar/Ig Reviewed by: dds Approved by: re (hrs)
* Drop the argument to the OUT macro because it can't emityar2007-06-121-7/+7
| | | | | | | anything but the pattern space anyway. Apply style(9) to the macro. Tested with: md5(1)
* Don't forget to clear out the hold space for each subsequent fileyar2007-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
* There is a symbolic antonym for REPLACE as a flag to cspace()yar2007-06-121-6/+6
| | | | | | | and mf_fgets(): APPEND. So use it instead of a 0 constant for clarity. Tested with: md5(1)
* Don't forget to bump document date after changing the content.yar2007-04-211-1/+1
|
* Change the semantics of -i (in-place editing) so that it treatsyar2007-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
* style(9):yar2007-04-061-1/+1
| | | | | | Use a single space before $FreeBSD$ to avoid terminal line overflow. Pointed out by: ru (The All-Seeing Eye)
* Add an important detail to paragraph 12: the range is reset only if itsyar2007-04-051-2/+3
| | | | second address is a line number.
* Reflect the change in rev. 1.44 of process.c.yar2007-04-051-4/+9
| | | | Add $FreeBSD$ to please commit_prep.pl.
* Don't forget to close the range if we branched over its endyar2007-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
* Prevent foot-shooting in advance: Put the MATCH() macro's valueyar2007-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)
* This trivial change should fix at least 3 similar bugs. All ofyar2007-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
* Make the comment for cspace() match reality.yar2007-03-311-3/+3
|
* Test files repo-copied into tools/regression/usr.bin/sed and integrateddds2007-03-143-1098/+0
| | | | into the regression testing framework.
* Fix using "P" command on empty pattern space. If the "P" command iskrion2006-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
* The function inplace_edit() doesn't exist anymore, remove the prototype.stefanf2005-09-241-1/+0
| | | | Submitted by: Leonardo Chiquitto Filho
* Bug fix: a numeric flag specification in the substitute command woulddds2005-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
* Markup and wording fixes.ru2005-06-141-1/+1
| | | | Approved by: re (blanket)
* Add option -l, to make output line buffered.glebius2005-05-102-5/+11
| | | | | | PR: bin/78692 Submitted by: Eugene Grosbein MFC after: 2 weeks
* Remove unused variables.stefanf2005-04-091-2/+1
|
* Fix dubious C code construct.stefanf2005-03-091-1/+1
|
* Expand *n't contractions.ru2005-02-131-1/+1
|
* Include missing headers.stefanf2005-02-091-0/+1
|
* Added the EXIT STATUS section where appropriate.ru2005-01-171-1/+1
|
* Scheduled mdoc(7) sweep.ru2005-01-111-5/+3
|
* Per letter dated July 22, 1999 remove 3rd clause of Berkeley deriveddds2004-08-098-32/+0
| | | | | | software (original contributor). Reviewed by: imp
* Document the limitation that multibyte characters cannot be used astjr2004-07-171-1/+6
| | | | delimiters with the 's' and 'y' commands.
* Document the -E and -a options as being extensions.tjr2004-07-141-2/+5
|
* Update BUGS section to reflect current state of multibyte character support.tjr2004-07-141-4/+11
|
* Make the 'y' (translate) command aware of multibyte characters.tjr2004-07-145-17/+145
|
* Overhaul lputs() to deal with multibyte characters, characters that taketjr2004-07-131-24/+53
| | | | up more than one column position, and null bytes.
* Document missing multibyte character support in utilities specifiedtjr2004-07-031-1/+5
| | | | by POSIX.
* Mechanically kill hard sentence breaks.ru2004-07-021-7/+14
|
* Removed trailing whitespace.ru2004-07-021-1/+1
|
* Plug a file descriptor leak.brian2004-06-031-7/+13
| | | | | | | When sed is asked to inline-edit files, it forgets to close the temporary file and runs out of descriptors for long command lines (assuming you reset kern.maxfilesperproc to something sane that's less than the number of files passed to sed).
* A new version that does exponents and lots of other neat things. Updatesmkelly2004-05-011-59/+335
| | | | | | from the original author of math.sed. Submitted by: K S Braunsdorf <sed@ksb.npcguild.org>
* Avoid using .Nm at the start of the sentence.charnier2004-01-041-3/+2
|
* Fix the case where the file is not in the current directory.des2003-11-041-1/+2
| | | | | Discovered by: Vladimir Kravchenko <jimson@mostcom.ru> Pointy hat to: des
* Reimplement in-place editing in a slightly less disgusting manner. Also,des2003-11-043-91/+84
| | | | | | | make an effort to preserve the ownership and mode of the file we are editing. Sponsored by: Registrar AS
* Whitespace cleanupdes2003-11-042-21/+21
|
* ANSIfydes2003-11-044-78/+33
|
* Correct style bugs in the in-place editing code.des2003-11-041-2/+2
|
* Change the buffer length test in NEEDSP() so that it does nottjr2003-11-021-1/+2
| | | | | | | | subtract one unsigned number from another potentially smaller one, leading to wraparound (and heap corruption, eventually). PR: 58813 MFC after: 2 weeks
* Fixed .Nm element, updated HISTORY section, added AUTHORS section.dds2003-07-221-2/+6
| | | | | Reviewed by: schweikh (mentor) MFC after: 2 weeks
* Test 8.16 in sed.test tests the ability of a sed to handle an emptydds2003-07-221-11/+19
| | | | | | | | | | | | | | | | | regular expression as the first argument to a substitute command. If used to test a sed which (erroneously) evaluates this at translation time rather than at execution time, the bugged sed is put into an infinite loop. This mode of failure seems excessive. Such a failing sed is the Free Software Foundation's sed 3.02. The specific test was also not being executed for the BSD sed. Both problems are now fixed. PR: misc/25585 Submitted by: Walter Briscoe <w.briscoe@ponl.com> Approved by: schweikh (mentor) MFC after: 2 weeks
* Do not dribble zero bytes into the output, by replacing an obfuscated iffanf2003-06-051-4/+1
| | | | | | | | whose true and false clauses were equivalent with a check that we are not about to stumble off the end of the line. Reported by: peter Pointy hat to: fanf
* Fix substitution when the regex matches the zero-length string.fanf2003-06-041-5/+6
| | | | | | | | | There are two bugs: in the s///g case, the substitution didn't occur at the end of the line; in the s///N case, the code didn't count forwards along the line properly. See the sg, s3, s4, and s5 tests in src/tools/regression/usr.bin/sed/. Reviewed by: tjr
OpenPOWER on IntegriCloud