#
58b8553b |
| 17-Jul-2024 |
millert <millert@openbsd.org> |
sed: use warn()/err() where appropriate
Use warn()/err() instead of sed's homegrown warning()/error() for things other than parser problems. The warning()/error() functions display the file and lin
sed: use warn()/err() where appropriate
Use warn()/err() instead of sed's homegrown warning()/error() for things other than parser problems. The warning()/error() functions display the file and line number in addition to the error message. This also removes of the COMPILE/FATAL argument to error() since now all calls to error() are for compilation/parsing issues. OK op@ espie@
show more ...
|
#
f73b4cc0 |
| 18-Jun-2024 |
millert <millert@openbsd.org> |
Rename mf_fgets() and cu_fgets() to mf_getline() and cu_getline(). These functions now use getline(), not fgets(). From espie@
|
#
d9a51c35 |
| 26-Dec-2022 |
jmc <jmc@openbsd.org> |
spelling fixes; from paul tagliamonte amendments to his diff are noted on tech
|
#
53ac6a98 |
| 07-Dec-2018 |
schwarze <schwarze@openbsd.org> |
As an extension to POSIX, for consistency with our behaviour for the "b" and "t" commands with a label, and for compatibility with GNU sed, also accept ";" followed by another command after "b" and "
As an extension to POSIX, for consistency with our behaviour for the "b" and "t" commands with a label, and for compatibility with GNU sed, also accept ";" followed by another command after "b" and "t" commands without a label: branch to the end of the script instead of erroring out. Parsing is unchanged.
Missing feature reported by Lars dot Nooden at gmail dot com on bugs@. OK martijn@ millert@
show more ...
|
#
2f0eb885 |
| 14-Aug-2018 |
schwarze <schwarze@openbsd.org> |
Improve consistency of the substitution command further.
When the opening square bracket ('[') is abused as the delimiter, the regular expression contains a bracket expression, and the bracket expre
Improve consistency of the substitution command further.
When the opening square bracket ('[') is abused as the delimiter, the regular expression contains a bracket expression, and the bracket expression contains another opening square bracket (sick! - i mean, sic!), then do not require escaping that innermost bracket and treat a preceding backslash as a literal backslash character, in accordance with POSIX:
$ printf 'x[x\\x\n' | sed 's[\[[][R[g' xRx\x $ printf 'x[x\\x\n' | sed 's[\[\[][R[g' xRxRx
While here, also make the implementation more readable and insert some comments.
Joint work with martijn@ (started during g2k18) and OK martijn@.
show more ...
|
#
a778be04 |
| 09-Jul-2018 |
schwarze <schwarze@openbsd.org> |
When using '[' as the delimiter in sed(1) s/// (don't do that, of course) and then including '[' in the regular expression by prepending a backslash to it, remove the backslash before feeding the RE
When using '[' as the delimiter in sed(1) s/// (don't do that, of course) and then including '[' in the regular expression by prepending a backslash to it, remove the backslash before feeding the RE to the RE engine, just like we already do it for other special characters like .^$*+?{(|. This makes sed 's[\[xy][...[' treat the xy thingy as a char class. Joint work with martijn@, OK guenther@ martijn@
show more ...
|
#
89312d65 |
| 13-Dec-2017 |
millert <millert@openbsd.org> |
Fix array index by signed char; from martijn@
|
#
59d77f5c |
| 13-Dec-2017 |
millert <millert@openbsd.org> |
Fix sign compare warnings; OK martijn@
|
#
fb212228 |
| 12-Dec-2017 |
martijn <martijn@openbsd.org> |
Fix 2 bugs introduced by previous. Pointed out by kshe59 <at> zoho <dot> eu
OK millert@
|
#
0a3faa2e |
| 11-Dec-2017 |
martijn <martijn@openbsd.org> |
Fix and change y command in the following ways: - When 'n' is used as a delimiter escaping 'n' will remain a newline instead of becoming a 'n' character. This is how POSIX specifies how this shou
Fix and change y command in the following ways: - When 'n' is used as a delimiter escaping 'n' will remain a newline instead of becoming a 'n' character. This is how POSIX specifies how this should work. Other implementations tested also do this wrong. - '[' and maybe other characters are not special during the parsing of the y command and don't need to be matched or treated special in any way. - POSIX specifies that a backslash followed by anything other than the delimiter, 'n', and another backslash, as well as repeating characters in string1 are unspecified. Since the various implementations handle these situations in opposing ways choose to error out on them to prevent people falling into the pitfall of expecting identical behaviour on various implementations.
Inspired by the sed.1 patch by kshe59 <at> zoho <dot> eu Feedback and OK millert@ Manpage bits OK jmc@
show more ...
|
#
d077d0ac |
| 08-Dec-2017 |
martijn <martijn@openbsd.org> |
Make the r command filename obligatory, similar to what FreeBSD and NetBSD do for several years. While here make corresponding error message for missing read and write file consistent between command
Make the r command filename obligatory, similar to what FreeBSD and NetBSD do for several years. While here make corresponding error message for missing read and write file consistent between commands/flag, and shrink the the code of the w flag of the s command by making it use the same code as the w command.
Prompted by a larger diff by kshe59 <at> zoho <dot> eu OK millert@
show more ...
|
#
8ca80aa9 |
| 01-Aug-2017 |
martijn <martijn@openbsd.org> |
Apply stricter pledge rules if possible. These are based on the usage of the 'w' and 'r' functions and the 'w' flag to the 's' function.
If non of the above is used and input is being read from stdi
Apply stricter pledge rules if possible. These are based on the usage of the 'w' and 'r' functions and the 'w' flag to the 's' function.
If non of the above is used and input is being read from stdin, we drop all the way down to stdio!
Original inspiration by benno@.
OK millert@
show more ...
|
#
5c4e30b8 |
| 20-Jan-2017 |
krw <krw@openbsd.org> |
Split error() into error() and warning() so error() can be marked __dead to appease gcc.
ok procter@ deraadt@
|
#
1086528a |
| 26-Oct-2015 |
jca <jca@openbsd.org> |
Tidy up error() levels: merge COMPILE and COMPILE2, and kill ERROR (unused)
ok tobias@
|
#
3ec97946 |
| 26-Oct-2015 |
mmcc <mmcc@openbsd.org> |
Rename err() to error() to prevent confusion with the stdlib function.
Discussed with jca@.
|
#
3ad711f6 |
| 23-Jun-2015 |
millert <millert@openbsd.org> |
POSIX specifies that that multiple '!' characters preceding a function should be treated as a single negation. From FreeBSD via Liviu Daia.
|
#
53ac88bd |
| 12-Dec-2014 |
jsg <jsg@openbsd.org> |
Bounds check the file path used in the 'w' command. Modified version of a diff from Sebastien Marie to prevent a crash found by Sebastien with the afl fuzzer.
|
#
61867d60 |
| 08-Oct-2014 |
deraadt <deraadt@openbsd.org> |
add a xreallocarray() like the existing fatal xmalloc(), and use it to detect potential integer. ok doug
|
#
f69332c7 |
| 28-Nov-2013 |
deraadt <deraadt@openbsd.org> |
unsigned char for ctype ok krw okan
|
#
1d6c4158 |
| 15-Nov-2010 |
millert <millert@openbsd.org> |
NUL-terminate buffer in compiler_text() after realloc, not before. Now that we have dynamically sized buffers there may not be room for the NUL until after realloc.
|
#
555ffc66 |
| 01-Jul-2010 |
naddy <naddy@openbsd.org> |
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
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"
From FreeBSD; ok millert@ halex@
show more ...
|
#
fc40af3f |
| 01-Jul-2010 |
naddy <naddy@openbsd.org> |
Allow [ to be used as a delimiter.
From FreeBSD; ok millert@ halex@
|
#
043fbe51 |
| 27-Oct-2009 |
deraadt <deraadt@openbsd.org> |
rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and unmaintainable). these days, people use source. these id's do not provide any benefit, and do hurt the small install media (th
rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and unmaintainable). these days, people use source. these id's do not provide any benefit, and do hurt the small install media (the 33,000 line diff is essentially mechanical) ok with the idea millert, ok dms
show more ...
|
#
0ff19dce |
| 23-Oct-2009 |
reyk <reyk@openbsd.org> |
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".
From NetBSD, also matches the bahaviour of GNU se
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".
From NetBSD, also matches the bahaviour of GNU sed
ok millert@
show more ...
|
#
dfaac9d7 |
| 07-Aug-2009 |
djm <djm@openbsd.org> |
add -E flag to compile regular expressions using the extended POSIX syntax. The -E flag is compatible with the other BSDs and OSX. -r is also provided as an alias for compatibility with GNU sed.
fee
add -E flag to compile regular expressions using the extended POSIX syntax. The -E flag is compatible with the other BSDs and OSX. -r is also provided as an alias for compatibility with GNU sed.
feedback from jmc@ and millert@ ok millert@ pyr@ henning@ marco@
show more ...
|