This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: SED is ugly stuff...



  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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]