Commit Graph

38 Commits

Author SHA1 Message Date
christos 95cea0cc25 Use the same options like m4 (-g turns on GNU, -G turns off GNU) Suggested
by uwe@
2021-03-11 15:45:55 +00:00
christos d502916eaa Add -G to support GNU extensions 2021-03-11 15:15:05 +00:00
christos 3e95193d67 sed(1): Don't force a newline on last line, if input stream doesn't have one
While here, change how we check if the current line is the last one.
Before, we just checked if there were more files after the current one.
Now, we check the actual content of those files: they files may not have
a line at all. This matches the definition of the "last line" by the
Open Group.

The new behavior is closer to GNU sed.

From FreeBSD (9dd857db3dc558dc61dc8674d204ebc83cac0739), requested by mrg@
2020-05-15 22:39:54 +00:00
christos 3379dd2438 add an abort for a case that can't happen 2019-10-05 20:22:36 +00:00
christos cefb10afe1 The latest refactoring changes broke sed -i:
cd /tmp; echo foo > test; sed -i.orig s,fo,ba, test
Back them out until they are fixed.
2015-03-12 12:40:41 +00:00
asau 2390183275 Close files opened at processing time within processing phase. 2015-03-01 01:00:07 +00:00
asau 82be1f5db2 Move data I/O file pointers into processing part. 2015-03-01 00:38:01 +00:00
asau 1f228785da Improve modularity of "sed" source:
- move program source input subroutines into compiler part;
- move data I/O subroutines into processor part.
2015-02-28 21:56:53 +00:00
christos bf51dc6d97 restore sccsid[]'s per core@'s decision 2014-06-26 02:14:32 +00:00
christos ff4ba887a6 typo 2014-06-21 21:05:54 +00:00
christos 239f3a758e CID 10006930: Prevent outfile overwrite resource leak. 2014-06-21 17:43:04 +00:00
christos c095d1ec95 Fix usage. The man page is incorrect with respect to -I and -i and need
fixing, but my troff foo is not there.
2014-06-18 14:15:50 +00:00
wiz 55d6e53ccb Sync usage with manpage. 2014-06-18 09:41:29 +00:00
christos a406f30e48 add -u (unbuffered output) after GNU sed. 2014-06-17 16:39:02 +00:00
joerg 6457787c51 usage is __dead. Kill useless sccsid. 2014-06-06 12:46:54 +00:00
christos 81af4b3486 Prefer setvbuf for those who have it. 2014-06-06 01:45:11 +00:00
christos ef24ec4ecc Merge our changes. 2014-06-06 00:13:13 +00:00
tnn 0846a7629f Merge the following revisions from OpenBSD to let sed(1) handle
arbitrarily long lines (closes our PR bin/42261).
openbsd/usr.bin/sed/extern.h 1.5
openbsd/usr.bin/sed/main.c 1.13-1.15
openbsd/usr.bin/sed/misc.c 1.8
openbsd/usr.bin/sed/compile.c 1.25-1.28
openbsd/usr.bin/sed/defs.h 1.4
2010-02-19 16:35:27 +00:00
lukem d27a41bf3e Fix WARNS=4 issues (-Wcast-qual -Wsign-compare) 2009-04-13 07:29:55 +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
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
wiz b8c5588d79 Usage: Options before arguments; add -E. From Kouichirou Hiratsuka in PR 26255. 2004-07-13 12:11:06 +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 3c4c9d2b57 Remove #if __STDC__. De-__P() and ANSIfy. 2002-06-14 00:41:42 +00:00
wiz 12102d9f6d Fix format string in usage. bin/16869 by Julio Merino. 2002-05-17 17:27:12 +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
lukem 2237cf10d6 WARNSify, fix .Nm usage, deprecate register, getopt returns -1 not EOF 1997-10-19 23:05:11 +00:00
tls 9d225a1783 RCS ID police 1997-01-09 20:18:21 +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
jtc 94f49c37a9 Fixed typo in usage string. 1995-02-23 17:25:23 +00:00
cgd 8a8b69552f RCS id's 1994-02-03 23:44:40 +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 e9d867ef50 Add RCS identifiers. 1993-08-01 17:54:45 +00:00
alm bb106b2b49 added Berkeley sed with mods to use GNU regex 1993-04-13 23:49:12 +00:00