OpenBSD CVS

CVS log for src/usr.bin/sed/compile.c


[BACK] Up to [local] / src / usr.bin / sed

Request diff between arbitrary revisions


Default branch: MAIN
Current tag: OPENBSD_6_4


Revision 1.49 / (download) - annotate - [select for diffs], Tue Aug 14 18:10:09 2018 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.48: +32 -20 lines
Diff to previous 1.48 (colored)

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@.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.