freebsd-dev/usr.bin/sed
Kyle Evans 6e816d8711 sed: process \r, \n, and \t
This is both reasonable and a common GNUism that a lot of ported software
expects.

Universally process \r, \n, and \t into carriage return, newline, and tab
respectively. Newline still doesn't function in contexts where it can't
(e.g. BRE), but we process it anyways rather than passing
UB \n (escaped ordinary) through to the underlying regex engine.

Adding a --posix flag to disable these was considered, but sed.1 already
declares this version of sed a super-set of POSIX specification and this
behavior is the most likely expected when one attempts to use one of these
escape sequences in pattern space.

This differs from pre-r197362 behavior in that we now honor the three
arguably most common escape sequences used with sed(1) and we do so outside
of character classes, too.

Other escape sequences, like \s and \S, will come later when GNU extensions
are added to libregex; sed will likely link against libregex by default,
since the GNU extensions tend to be fairly un-intrusive.

PR:		229925
Reviewed by:	bapt, emaste, pfg
Differential Revision:	https://reviews.freebsd.org/D22750
2019-12-10 19:16:00 +00:00
..
tests sed: process \r, \n, and \t 2019-12-10 19:16:00 +00:00
compile.c sed: process \r, \n, and \t 2019-12-10 19:16:00 +00:00
defs.h General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
extern.h sed: Fix -i option behavior with 'q' command. 2018-08-29 17:09:03 +00:00
main.c sed: Fix -i option behavior with 'q' command. 2018-08-29 17:09:03 +00:00
Makefile pkgbase: Put a lot of binaries and lib in FreeBSD-runtime 2019-09-05 14:13:08 +00:00
Makefile.depend DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
misc.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
POSIX
process.c sed: Fix -i option behavior with 'q' command. 2018-08-29 17:09:03 +00:00
sed.1 Fix the last example to really replace all occurrences of the search string 2017-04-24 16:52:26 +00:00