This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
SED is ugly stuff...
- To: gcc-patches at gcc dot gnu dot org
- Subject: SED is ugly stuff...
- From: Bruce Korb <bkorb at sco dot COM>
- Date: Tue, 18 Jan 2000 12:42:37 -0800
- CC: Bruce Korb <bkorb at sco dot COM>
- Organization: Santa Cruz Operation
In the process of looking at the machine name fixing,
I took a closer look at how the '#if...' "pattern space"
gets constructed. Silly me :-(.
Here is the sed `loop':
:loop
/\\$/N
s/\\$/\\+++fixinc_eol+++/
/\\$/b loop
s/\\+++fixinc_eol+++/\\/g
It did not look to me like it would work, and it does not.
The "fixinc_eol" commands (almost) never apply because the '$'
addresses the end of the pattern space, not the end of line.
`sed(1)' refers you to `ed(1)' for understanding regular
expressions, but in this context you end up misinformed.
Furthermore, it is a no-op. Unless someone objects, I propose
the following replacement:
:loop
/\\$/ {
N
b loop
}
If there really is a sed out there that uses '$' to
mean end-of-line instead of end-of-pattern, then I
suggest:
:loop
/\\$/ {
s/\\$/\\+++fixinc_eol+++/g
N
b loop
}
s/+++fixinc_eol+++//g