History log of /freebsd-10.1-release/usr.bin/sed/compile.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 272461 02-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 259443 15-Dec-2013 eadler

MFC r259132,r259133,r259143:
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


# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 197362 20-Sep-2009 dds

IEEE Std 1003.1, 2004 Edition states:

"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


# 197361 20-Sep-2009 dds

Follow POSIX (IEEE Std 1003.1, 2004 Edition) in the implementation
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


# 197356 20-Sep-2009 dds

Allow [ to be used as a delimiter.

Pointed by: Marius Strobl
Obtained from: Apple


# 192732 25-May-2009 brian

Implement "addr1,+N" ranges - not dissimilar to grep's -A switch.

PR: 134856
Submitted by: Jeremie Le Hen - jeremie at le-hen dot org


# 184854 11-Nov-2008 dds

Fix the code to conform to the "or more" part of the following POSIX
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


# 184777 08-Nov-2008 hrs

Add workaround for a back reference when no corresponding
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


# 176126 09-Feb-2008 dwmalone

WARNS fixes:
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


# 171284 06-Jul-2007 delphij

Before doing compile_re() which needs a parameter to identify
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)


# 171206 04-Jul-2007 ssouhlal

Add case-insensitive matching to sed, using the 'I' flag, similarly to GNU sed.
For example,
sed /foo/Id
sed s/foo/bar/Ig

Reviewed by: dds
Approved by: re (hrs)


# 148692 04-Aug-2005 dds

Bug fix: a numeric flag specification in the substitute command would
cause the next substitute flag to be ignored.
While working at it, detect and report overflows.

Reported by: Jingsong Liu
MFC after: 1 week


# 143318 09-Mar-2005 stefanf

Fix dubious C code construct.


# 133385 09-Aug-2004 dds

Per letter dated July 22, 1999 remove 3rd clause of Berkeley derived
software (original contributor).

Reviewed by: imp


# 132145 14-Jul-2004 tjr

Make the 'y' (translate) command aware of multibyte characters.


# 122045 04-Nov-2003 des

Whitespace cleanup


# 122044 04-Nov-2003 des

ANSIfy


# 100944 30-Jul-2002 tjr

Ignore leading semicolons on commands; required by SUSv3.

Obtained from: NetBSD (kleink, Aymeric Vincent)


# 97703 01-Jun-2002 green

Fix a bug in sed(1)'s "s" command wherein if an escape ("\" character)
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.


# 94540 12-Apr-2002 sobomax

Fix an ages-old bug in sed(1), which resulted in the absolutely valid
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


# 92922 21-Mar-2002 imp

remove __P


# 87766 12-Dec-2001 markm

WARNS=2 partial fix; use NO_WERROR to protect against some hard-to-fix warnings.

Use __FBSDID(), kill register keyword.


# 86193 08-Nov-2001 mikeh

Don't allocate a zero byte segment.

PR: bin/11900
MFC after: 2 weeks


# 80286 24-Jul-2001 obrien

Expand xmalloc in-place, along with xrealloc; which wasn't even ANSI in its
implementation.


# 76804 18-May-2001 ru

Don't leak memory when compiling text following the `a', `c' or `i' command.

Testcase:

echo FOO | sed "/FOO/c\\
`jot -b 'aaaa\' 500`"

Submitted by: Max Khon <fjoe@newst.net>


# 58309 19-Mar-2000 green

Add a new flag: -E enables "extended" regular expressions.


# 50477 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 41602 08-Dec-1998 archie

Fix a new bug introduced by the previous bug fix


# 41573 07-Dec-1998 archie

Fix brokenness compiling "s/pat/subst/" when length of subst is >= 4090 chars.
PR: bin/7939


# 39571 22-Sep-1998 brian

Terminate our output string correctly if we've got
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


# 28066 11-Aug-1997 charnier

Remove local redefinition for err(). Add usage().


# 17522 11-Aug-1996 ache

Localize it
8bit cleanup


# 17195 17-Jul-1996 bde

Yet^2 another fix for the line continuation bug.

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.


# 16753 26-Jun-1996 dg

Yet another fix for the line continuation bug in sed. Keith's patch
introduced a new bug. This fix appears to work correctly. Fixes PR#1350.

Submitted by: mark@linus.demon.co.uk (Mark Valentine)


# 16510 19-Jun-1996 dg

Fix from Keith Bostic <bostic@bsdi.com> for bug in sed dealing with
continuation lines.

Submitted by: Keith Bostic via Kirk McKusick


# 10075 16-Aug-1995 jkh

Merge various fixes from NetBSD. This will allow the WordPerfect for
SCO installation to run all the way through (some POSIX fixes).


# 8874 30-May-1995 rgrimes

Remove trailing whitespace.


# 7637 05-Apr-1995 joerg

Sed dumps core when linked with some coalescing malloc because it
doesn't initialize malloced structure.

Submitted by: vode@hut.fi


# 1591 27-May-1994 rgrimes

This commit was generated by cvs2svn to compensate for changes in r1590,
which included commits to RCS files with non-trunk default branches.


# 1590 27-May-1994 rgrimes

BSD 4.4 Lite Usr.bin Sources