This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: SED is ugly stuff...
- To: Bruce Korb <bkorb at sco dot COM>
- Subject: Re: SED is ugly stuff...
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Tue, 18 Jan 2000 14:14:12 -0700
- cc: gcc-patches at gcc dot gnu dot org
- Reply-To: law at cygnus dot com
In message <3884D03D.583A39AD@sco.com>you write:
> 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
You should test this using the hpux10.20 un-patched sed. That is what led to
the code you're asking about.
jeff