Commit Graph

150 Commits

Author SHA1 Message Date
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
bdf26a6120 Recognize \oOOO \dDD \xXX plus the other regular 'C' backslash escapes like
gnu sed does, except when inside regex []. (Gnu sed translates those too,
unless --posix is specified).
2019-10-05 20:23:55 +00:00
christos
3379dd2438 add an abort for a case that can't happen 2019-10-05 20:22:36 +00:00
christos
7a955c4ce5 PR/49872:Yorick Hardy: sed functions 'i' and 'a' discard leading white space
FIxed as suggested, behavior now matches gnu-sed.
2016-04-05 00:13:03 +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
7004d56080 Hide more subroutines in processing phase. 2015-03-01 01:07:46 +00:00
asau
2390183275 Close files opened at processing time within processing phase. 2015-03-01 01:00:07 +00:00
asau
ee4b150430 Move run-time data structures into processing part. 2015-03-01 00:51:08 +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
eefaa0a08a PR/49109: Jeremie Le Hen: fix sed relative addressin (1,+N)
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=192108
http://svnweb.freebsd.org/base?view=revision&revision=269302
XXX: pullup 7.
2014-08-13 11:35:34 +00:00
christos
bf51dc6d97 restore sccsid[]'s per core@'s decision 2014-06-26 02:14:32 +00:00
uwe
7fbcdeb13a Command file argument to -f is not optional. 2014-06-25 02:05:58 +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
uwe
5a5964be39 Suppress space after -I and -i options in description too.
XXX: This should be documented explicitly.
2014-06-18 14:47:02 +00:00
uwe
8b8d85039c Suppress space after -I and -i options. 2014-06-18 14:26:15 +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
christos
71faadbf26 fix second line of synopsis. 2014-06-18 14:12:20 +00:00
wiz
55d6e53ccb Sync usage with manpage. 2014-06-18 09:41:29 +00:00
wiz
9825fbace6 Sort options. Use Ss for non-standard headers. New sentence, new line.
Add missing Op.
2014-06-18 09:35:31 +00:00
christos
a406f30e48 add -u (unbuffered output) after GNU sed. 2014-06-17 16:39:02 +00:00
christos
3a475c5557 PR/48883: Justin Cormack: Cope with systems that don't provide REG_STARTEND 2014-06-09 12:48:58 +00:00
christos
999f583a86 put back WARNS=6 2014-06-07 16:37:32 +00:00
christos
72feb6a6b9 PR/48880: Ryo ONODERA: Unapply one of our patches that broke 'G'. 2014-06-07 16:36:54 +00:00
ryoon
83acbdf28c Restore G command 2014-06-07 06:02:27 +00:00
wiz
15b8d8629f Renumber so that 3 follows 2. 2014-06-06 21:56:39 +00:00
christos
26bea92f67 After 2 comes... 2014-06-06 14:36:38 +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
186a5e22f3 add netbsd 2014-06-06 00:14:55 +00:00
christos
ef24ec4ecc Merge our changes. 2014-06-06 00:13:13 +00:00
christos
6a4e46c891 Handle a closing brace at the end of a command without a preceding semi-colon:
/foo/ {p;d}
2014-05-05 17:12:11 +00:00
joerg
9e69720425 Fix violations of the sequence point rule. 2013-06-28 15:04:35 +00:00
wiz
d1e02d4ffe - Reference tr(1) in `SEE ALSO' section;
- bump date.

From Bug Hunting.
2013-05-29 15:05:43 +00:00
uwe
92646e4a5d Bump date for previous (PR #45981): the change ("c") command starts a
new cycle.
2013-03-17 21:13:04 +00:00
uwe
136610e484 The change ("c") command should start a new cycle.
Apply one line patch I posted in PR #45981 and document this in the
manual page.
2013-03-17 21:02:54 +00:00
msaitoh
fd52732c92 Fix memory leak. 2012-12-14 08:15:44 +00:00
dholland
1ebcbda526 Improve previous change with better wording. 2012-10-04 19:28:36 +00:00
abs
070a35df41 "i.e." -> "i.e.," - from Snader_LB on IRC 2012-10-02 14:15:04 +00:00
christos
fa19104dd8 compare the sed we just build with the installed one instead of bogus
paths.
2011-11-12 03:15:05 +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
c1ceae17f0 Enable WARNS=4 by default for usr.bin, except for:
awk  bdes  checknr  compile_et  error  gss  hxtool  kgetcred  kinit
	klist  ldd  less  lex  locale  login  m4  man  menuc  mk_cmds
	mklocale  msgc  openssl  rpcgen  rpcinfo  sdiff  spell  ssh
	string2key  telnet  tn3270  verify_krb5_conf  xlint
2009-04-14 22:15:16 +00:00
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