Commit Graph

157 Commits

Author SHA1 Message Date
lukem d27a41bf3e Fix WARNS=4 issues (-Wcast-qual -Wsign-compare) 2009-04-13 07:29:55 +00:00
wiz ccc14bc16a Sort options. Uppercase GNU. 2008-09-21 16:46:01 +00:00
perry 5a047c798a Add a -r flag that is an alias for -E, for compatibility with gnu sed. 2008-09-16 13:32:04 +00:00
lukem 98e5374ccb Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.
2008-07-21 14:19:20 +00:00
christos 80cd289830 provide _POSIX2_LINE_MAX if not there. 2007-04-17 20:30:29 +00:00
gdamore d9ac053afa Make TOOL_SED, to allow using our own sed in cases where the host's version
is busted in some way.

The TOOL_SED doesn't use TIOCGWINSIZE, and has some changes to include
nbtool_config.h in a cross build environment.

Combined with some other changes (not yet committed), this allows cross
compiling m68k code on Solaris 10/amd64.
2006-06-18 05:16:41 +00:00
mrg 95c96a60f2 remove sh3/GCC2 hack. 2006-06-02 19:44:48 +00:00
wiz cc9f77ff20 Clarify location of `}'. Requested by joerg. Bump date. 2006-05-14 14:34:49 +00:00
mrg 117693dfce when calling compile_tr() add (void *) to the 2nd argument's cast chain. 2006-05-11 17:18:19 +00:00
mrg 0db1500b43 retire HAVE_GCC3/HAVE_GCC4 and introduce HAVE_GCC that is set to 2, 3 or 4. 2006-04-07 19:38:58 +00:00
christos 472d6fbe72 Coverity CID 878: Remove impossible tests against NULL pointers. 2006-04-02 03:47:26 +00:00
christos 999d9f8f32 Coverity CID 1181: Protect access against NULL. 2006-04-02 03:40:06 +00:00
grant 0bfb4106b0 no trailing comma at end of enum. 2004-11-20 06:40:01 +00:00
matt d0560e80c6 When adding text due to an a, c, or i command, don't eat the space(s) at
the beginning of the lines since the addition is supposed to be "verbatim".
Fix a comment for compile_text indicating it's also used for the 'c' command.
2004-11-17 22:17:54 +00:00
wiz b8c5588d79 Usage: Options before arguments; add -E. From Kouichirou Hiratsuka in PR 26255. 2004-07-13 12:11:06 +00:00
wiz 5df46dc9cc Sort options. From Kouichirou Hiratsuka in PR 26255 (slightly changed). 2004-07-13 12:09:29 +00:00
enami 15f238472a Yet another s/xmalloc/xrealloc/ so that large multi line text
can be added.
2004-07-09 23:43:07 +00:00
mycroft 282d260910 xmalloc()->xrealloc() so that patterns larger than _POSIX2_LINE_MAX*2-1 work. 2004-07-09 16:34:29 +00:00
grant 55ed2aadb5 apply patch in PR to avoid writing to unallocated memory.
fixes PR bin/25911 from SHIMIZU Ryo.
2004-06-13 08:34:31 +00:00
grant 1e6747bd53 apply patch in PR to fix argument parsing bug.
fixes PR bin/24234 from Keisuke YOSHIDA.
2004-06-13 08:31:30 +00:00
minskim 5b777c8343 Fix a bug that made sed(1) fail if the last character of the line
buffer was a backslash.  This closes PR bin/25899.

Patch was borrowed from FreeBSD.  Their log says:

    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.

OK'ed by jmc@.
2004-06-12 04:29:22 +00:00
wiz 5b677ebe3a Bump Dd for previous. 2004-01-04 02:24:32 +00:00
wiz 86a0205ded Point people to re_format(7) instead of regex(3) for
RE description; from Greg A. Woods.
2004-01-04 02:24:07 +00:00
itojun 434c034061 safer realloc, from openbsd 2003-11-07 04:44:57 +00:00
itojun bad71a3818 prevent integer underflow. freebsd rev 1.32. via openbsd 2003-11-07 03:58:06 +00:00
uwe faa73a6d7e In test_error() use <& to duplicate input descriptors,
correct the order of descriptors in redirection that saves stdin.
2003-10-27 20:09:49 +00:00
uwe 03e0a01658 Deoptimize (gcc-sh3-sed hack) only if ${HAVE_GCC3} != "yes". 2003-10-27 13:27:41 +00:00
grant ba2a3df7f5 call setprogname(), replace a 'sed' with getprogname(). 2003-10-16 12:11:12 +00:00
agc 89aaa1bb64 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22365, verified by myself.
2003-08-07 11:13:06 +00:00
wiz 2acfaaf7f5 Quote bang. 2003-06-27 09:06:23 +00:00
wiz 990562bfef .Nm does not need a dummy argument ("") before punctuation or
for correct formatting of the SYNOPSIS any longer.
2003-02-25 10:34:36 +00:00
wiz 3c4c9d2b57 Remove #if __STDC__. De-__P() and ANSIfy. 2002-06-14 00:41:42 +00:00
wiz 50bdb90860 WARNS=2 2002-06-14 00:37:29 +00:00
itojun f51456c273 err/errx/warn/warnx do not need \n at the end 2002-06-11 06:06:18 +00:00
wiz 12102d9f6d Fix format string in usage. bin/16869 by Julio Merino. 2002-05-17 17:27:12 +00:00
thorpej abcb4fee4e Use -O0 on SuperH, for now. 2002-04-23 20:21:03 +00:00
wiz c640510df0 Correct spelling of "delimiter", and remove from ignored-errors lists. 2002-02-26 02:37:28 +00:00
ross 2a76afae02 Generate <>& symbolically. I'm avoiding .../dist/... directories for now. 2002-02-08 01:36:18 +00:00
ross ba8a357387 tweak the description of the n function 2002-02-08 01:20:15 +00:00
ross 8ed9321304 Note that the `n' function does not restart the script. 2002-02-07 04:28:14 +00:00
atatat c25d406046 Add a -E flag to ed(1) and sed(1) so that they can use extended
regular expressions instead of just basic regular expressions.
2002-01-23 19:07:33 +00:00
kleink 3ff80f3170 Accept empty commands separated by semicolons; from Aymeric Vincent in
PR standards/15231.
2002-01-14 19:37:30 +00:00
wiz f86d47668c Uppercase and unquote section headers, punctuation nit. 2001-12-08 19:14:18 +00:00
atatat 3cbffc40e1 Back out last patch (again). This patch seems to satisfy test suites
that I've found, while the previous one did not.
2001-10-02 03:03:02 +00:00
atatat cfad8d9136 New fix for PR bin/14074. This one doesn't make sed hang. 2001-09-28 21:12:04 +00:00
atatat 2e515657d7 Back out the pr fix. It doesn't work. 2001-09-28 21:10:34 +00:00
atatat 7fb1c88366 Don't attempt to memmove() if psl (pattern space length) is zero.
Fixes PR bin/14074: Simple expression core dumps sed.
2001-09-27 05:35:44 +00:00
is 135600f947 More format string cleanup by sommerfeld. 2000-10-11 14:46:00 +00:00
drochner 85cbf55d16 Since our gcc doesn't warn about NULL format strings anymore, we can
fix the incorrect err(1, "%s", "") et al.
Closes PR bin/7592 by cgd.
1999-11-09 15:06:30 +00:00
kim fd771a9c66 Fix bug pointed out by Jerry Peek <jpeek@jpeek.com> in PR bin/7674.
If hold space null when doing an 'G', make sure it contains a newline.
Fix copied from revision 1.17 where cgd applied a fix for 'x'.
1999-05-31 04:46:33 +00:00
ross c7790fec57 Punctuation character are magic to -mdoc and can't be used directly
as macro arguments unless combined with \&.
1998-12-24 02:07:36 +00:00
christos ea2df27a8f char -> unsigned char
compensate for not having REG_STARTEND
1998-12-19 22:12:32 +00:00
christos 431b0659ba char -> unsigned char 1998-12-19 22:12:11 +00:00
drochner 20b876f326 avoid malloc(0) 1998-12-08 14:08:50 +00:00
ross f670fa10c5 Add { and } to shut up egcs. Reformat the more questionable code. 1998-08-25 20:59:36 +00:00
mrg 505c7f6151 use int as array index. 1998-03-30 02:29:28 +00:00
enami d9fba75667 .Nm in SYNOPSIS except first one should be followed by "". 1998-01-10 08:29:55 +00:00
thorpej 229db4813c Remove an extra semicolon that broke processing of the "r" directive. 1997-10-22 19:51:58 +00:00
lukem 2237cf10d6 WARNSify, fix .Nm usage, deprecate register, getopt returns -1 not EOF 1997-10-19 23:05:11 +00:00
mrg 59a949ac9c merge lite-2 -- was mostly already done. grr. 1997-10-19 05:23:48 +00:00
jtc 5b466bef97 Changed order of STANDARDS and HISTORY subheads to conform with
specification in mdoc(7).
1997-09-09 07:26:02 +00:00
cgd c917dfb5b2 Fix broken uses of Dd. Both the mdoc and mdoc.samples pages agree:
.Dd is supposed to be invoked like:
	.Dd month day, year
e.g. ".Dd January 25, 1989", rather than:
	.Dd "month day, year"
which is what these pages did.
1997-05-29 01:48:05 +00:00
mikel cea63f2488 add missing backslash; from David Brownlee in PR bin/3321.
also cleanup RCSids a bit.
1997-03-13 04:57:46 +00:00
tls 9d225a1783 RCS ID police 1997-01-09 20:18:21 +00:00
cjs f271ac2363 Make it clearer how to use alternate delimiters in context patterns. 1996-12-15 08:28:46 +00:00
mark 2754bf6ea9 Use an integer instead of a char with getc() and ungetc() in mf_fgets()
so that it works with compilers that default to unsigned chars
Note: getc() and ungetc() are prototyped to use ints rather than
chars.
1996-05-08 21:36:05 +00:00
cgd 637e8bb002 fix bug pointed out by Dennis Ferguson <dennis@mci.net>. if hold space null
when doing an 'x', make sure it contains a newline.
1995-07-11 04:09:50 +00:00
mycroft 23f31f5bcd The `D' command should only input a new line if the pattern space becomes empty. 1995-03-15 12:12:16 +00:00
mycroft c92e174d74 Fix the P command, and optimize D slightly. 1995-03-15 11:25:10 +00:00
mycroft 9a90db1e8e Remove an old #ifndef of little value. 1995-03-15 11:13:30 +00:00
mycroft 35e8bf367a Compile group commands differently, using a stack rather than calling the
parser recursively.  Don't throw away commands after an end group.
1995-03-09 11:19:24 +00:00
mycroft 4c34be6b52 Clean up deleted files. 1995-03-01 00:00:00 +00:00
jtc 94f49c37a9 Fixed typo in usage string. 1995-02-23 17:25:23 +00:00
mycroft 8b96645c69 Fix typo. 1994-12-04 06:06:19 +00:00
mycroft b01b8d8a74 Fix thinko in previous commit. 1994-11-15 19:03:25 +00:00
mycroft 49ebbb080e Fix core dump on end of group reported by John Kohl, in a different way. 1994-11-09 19:30:32 +00:00
alm b1dcef2867 echo hello | ./sed 'sl[l]lxl'
historically outputs:
hexlo
1994-04-17 04:19:27 +00:00
mycroft f8e2732fe8 Fix bug with D leaving junk at end of pattern space. 1994-03-24 15:55:01 +00:00
cgd 6cc95e4fee DTRT with empty RE matches. or at least, do something better. fix off
to bostic and dspin.
1994-03-01 06:32:54 +00:00
andrew 14f1242b37 Restore the traditional behaviour of the "n" command. 1994-02-28 07:00:00 +00:00
cgd 054d17fafb patch from Diomidis Spinellis to fix 'infinite' loop 1994-02-09 00:06:07 +00:00
cgd 8a8b69552f RCS id's 1994-02-03 23:44:40 +00:00
cgd c9f13cff75 update from Diomidis Spinellis <dspin@leon.nrcps.ariadne-t.gr> 1994-02-03 23:32:35 +00:00
mycroft 9be21c6baa Clean up deleted files. 1994-02-03 23:32:29 +00:00
cgd 5beaa48900 update from Diomidis Spinellis <dspin@leon.nrcps.ariadne-t.gr> 1994-02-03 23:32:10 +00:00
cgd 02254e0c37 rename fgetline() and sharpen axe for bostic... 1994-01-04 05:16:44 +00:00
cgd 76553b5de8 update for fgetline 1993-12-22 07:38:51 +00:00
mycroft 09dc5c690d Further patch by Havard Eidnes <Havard.Eidnes@runit.sintef.no> to avoid access
to uninitialized memory.
1993-12-05 21:43:57 +00:00
mycroft 824c494570 From: Thomas Eberhardt <thomas@mathematik.uni-Bremen.de>
Patch to prevent core dumping when linked dynamically.
1993-11-20 22:24:17 +00:00
jtc 5ce3d664fb Use new POSIX.2 compatible regex routines in C library instead of -lgnuregex. 1993-11-11 01:29:52 +00:00
andrew 1b0bd76d80 make with -DHISTORIC_PRACTICE to obtain the common EOF behavior of the "n"
command.  Don't be fussy about requiring spaces after the "w" command
though.
1993-11-04 01:36:21 +00:00
mycroft 3c52920854 Put back RCS identifier. 1993-08-14 20:00:00 +00:00
alm 5ef7fe2b6a Was testing against rm_so instead of rm_eo. So now:
$ echo aabb | sed 's/\(.*\)\1/(\1)/g'
(a)(b)(c)
1993-08-14 03:06:53 +00:00
alm b6b50355eb removed GNU_REGEX directive
catch infinite substitution for the following cases:
echo hi | sed 's/$/a/g' (prints hia)
echo hi | sed 's/h*/x/g' (terminates with error: infinite substitution)
1993-08-13 02:26:38 +00:00
mycroft e9d867ef50 Add RCS identifiers. 1993-08-01 17:54:45 +00:00
mycroft c3e42d1c64 Add RCS indentifiers. 1993-08-01 07:22:47 +00:00
mycroft 75ff3a90bd Add RCS identifiers. 1993-07-30 23:49:23 +00:00
alm fe8b331915 added missing parens in buffer allocation (caused seg violation) 1993-07-02 09:50:36 +00:00
alm bd8e434d6d fixed regex initialization 1993-06-16 07:41:14 +00:00
mrg 152053b06a 4.4BSD-Lite2 1993-06-06 23:13:45 +00:00