Does this fix the recent problems people were having with sed?
The examples I could dig up on the web that use the `N' command work
properly with this change (same as they do on -DP1).

Here are a few of the examples that are fixed:
(from http://www.faqs.org/faqs/editor-faq/sed/)

   # 10. Delete all CONSECUTIVE blank lines from file except the first.
   # This method also deletes all blank lines from top and end of file.
   # (emulates "cat -s")
   sed '/./,/^$/!d' file       # this allows 0 blanks at top, 1 at EOF
   sed '/^$/N;/\n$/D' file     # this allows 1 blank at top, 0 at EOF

   # 12. Delete all trailing blank lines at end of file (only).
   sed -e :a -e '/^\n*$/{$d;N;};/\n$/ba' file

   # 13. If a line ends with a backslash, join the next line to it.
   sed -e :a -e '/\\$/N; s/\\\n//; ta' file

If this change doesn't fix the problems, please give me small and simple
sed scripts that demonstrate the incorrect behaviour.


Tim


----- Forwarded message from "Tim J. Robbins" <[EMAIL PROTECTED]> -----

Delivered-To: [EMAIL PROTECTED]
Delivered-To: [EMAIL PROTECTED]
From: "Tim J. Robbins" <[EMAIL PROTECTED]>
Date: Sun, 16 Jun 2002 01:44:39 -0700 (PDT)
To: [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: cvs commit: src/usr.bin/sed main.c
X-FreeBSD-CVS-Branch: HEAD
Precedence: bulk
X-Loop: FreeBSD.ORG

tjr         2002/06/16 01:44:39 PDT

  Modified files:
    usr.bin/sed          main.c 
  Log:
  Correct the handling of (for example) the N command by only zeroing the
  input space in mf_fgets() if we reach the end of all input files.
  
  Revision  Changes    Path
  1.24      +2 -1      src/usr.bin/sed/main.c

----- End forwarded message -----

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to