summaryrefslogtreecommitdiffstats
path: root/usr.bin/sed/compile.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC r289677:bdrewery2016-01-071-1/+1
| | | | Fix a ton of speelling errors
* MFC r275838;pfg2014-12-231-1/+4
| | | | | | | | | sed: Bounds check the file path used in the 'w' command. Modified version of a diff from Sebastien Marie to prevent a crash found with the afl fuzzer. Obtained from: OpenBSD (CVS Rev. 1.37)
* MFC r259132,r259133,r259143:eadler2013-12-161-0/+1
| | | | | | | | | | | | Per the resolution of POSIX bug 0000779 (note 0002050) add support for using 'i' as a case insensitive flag. Add regression test for recently added 'i' flag in r259132. the i modifier was added in r259132 since POSIX recently agreed to add it. Switch uses of /I to /i. PR: standards/184641
* IEEE Std 1003.1, 2004 Edition states:dds2009-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
* Follow POSIX (IEEE Std 1003.1, 2004 Edition) in the implementationdds2009-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
* Allow [ to be used as a delimiter.dds2009-09-201-1/+1
| | | | | Pointed by: Marius Strobl Obtained from: Apple
* Implement "addr1,+N" ranges - not dissimilar to grep's -A switch.brian2009-05-251-2/+9
| | | | | PR: 134856 Submitted by: Jeremie Le Hen - jeremie at le-hen dot org
* Fix the code to conform to the "or more" part of the following POSIXdds2008-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
* Add workaround for a back reference when no correspondinghrs2008-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
* WARNS fixes:dwmalone2008-02-091-1/+1
| | | | | | | | | | 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
* 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-041-25/+41
| | | | | | | | | For example, sed /foo/Id sed s/foo/bar/Ig Reviewed by: dds Approved by: re (hrs)
* 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
* Fix dubious C code construct.stefanf2005-03-091-1/+1
|
* Per letter dated July 22, 1999 remove 3rd clause of Berkeley deriveddds2004-08-091-4/+0
| | | | | | software (original contributor). Reviewed by: imp
* Make the 'y' (translate) command aware of multibyte characters.tjr2004-07-141-13/+69
|
* Whitespace cleanupdes2003-11-041-10/+10
|
* ANSIfydes2003-11-041-34/+15
|
* Ignore leading semicolons on commands; required by SUSv3.tjr2002-07-301-2/+8
| | | | Obtained from: NetBSD (kleink, Aymeric Vincent)
* Fix a bug in sed(1)'s "s" command wherein if an escape ("\" character)green2002-06-011-4/+24
| | | | | | | was initiated at the last character of the line buffer, the Wrong Thing was done and sed barfed by interpreting the following NUL byte as a digit. Instead, pull up the next buffer and record that the "\" was last seen.
* Fix an ages-old bug in sed(1), which resulted in the absolutely validsobomax2002-04-121-1/+1
| | | | | | | | substitution expressions in the form `s,[fooexp],[barexp],;...' treated as invalid when the third `,' is (_POSIX2_LINE_MAX * N)-th character in the line. MFC after: 2 weeks
* remove __Pimp2002-03-221-14/+14
|
* WARNS=2 partial fix; use NO_WERROR to protect against some hard-to-fix warnings.markm2001-12-121-18/+18
| | | | Use __FBSDID(), kill register keyword.
* Don't allocate a zero byte segment.mikeh2001-11-081-1/+4
| | | | | PR: bin/11900 MFC after: 2 weeks
* Expand xmalloc in-place, along with xrealloc; which wasn't even ANSI in itsobrien2001-07-241-17/+36
| | | | implementation.
* Don't leak memory when compiling text following the `a', `c' or `i' command.ru2001-05-181-1/+1
| | | | | | | | | Testcase: echo FOO | sed "/FOO/c\\ `jot -b 'aaaa\' 500`" Submitted by: Max Khon <fjoe@newst.net>
* Add a new flag: -E enables "extended" regular expressions.green2000-03-191-1/+1
|
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Fix a new bug introduced by the previous bug fixarchie1998-12-081-6/+7
|
* Fix brokenness compiling "s/pat/subst/" when length of subst is >= 4090 chars.archie1998-12-071-3/+6
| | | | PR: bin/7939
* Terminate our output string correctly if we've gotbrian1998-09-221-1/+2
| | | | | | | an ``a'' command that has an escaped newline on the last line of the last script that we're processing. This fixes exmh2/scripts/build when /etc/malloc.conf -> AJ
* Remove local redefinition for err(). Add usage().charnier1997-08-111-61/+72
|
* Localize itache1996-08-111-2/+2
| | | | 8bit cleanup
* Yet^2 another fix for the line continuation bug.bde1996-07-171-5/+5
| | | | | | | | | | | | The fundamental problem with the original code is that it accesses p[-2] which is one before the beginning of the input buffer for empty lines. rev.1.6 just moved the problem from failures when p[-2] happens to be '\\' to failures when it happens to be '\0'. rev.1.5 was confused about the trailing newline and other things. I went back to rev.1.5 and fixed it. The result is the same as Keith Bostic's final version in PR 1356 except it loses more gracefully for excessively long input lines.
* Yet another fix for the line continuation bug in sed. Keith's patchdg1996-06-261-7/+5
| | | | | | introduced a new bug. This fix appears to work correctly. Fixes PR#1350. Submitted by: mark@linus.demon.co.uk (Mark Valentine)
* Fix from Keith Bostic <bostic@bsdi.com> for bug in sed dealing withdg1996-06-191-5/+7
| | | | | | continuation lines. Submitted by: Keith Bostic via Kirk McKusick
* Merge various fixes from NetBSD. This will allow the WordPerfect forjkh1995-08-161-31/+68
| | | | SCO installation to run all the way through (some POSIX fixes).
* Remove trailing whitespace.rgrimes1995-05-301-3/+3
|
* Sed dumps core when linked with some coalescing malloc because itjoerg1995-04-051-0/+2
| | | | | | doesn't initialize malloced structure. Submitted by: vode@hut.fi
* BSD 4.4 Lite Usr.bin Sourcesrgrimes1994-05-271-0/+771
OpenPOWER on IntegriCloud