BSD 4_4 release
[unix-history] / usr / src / usr.bin / sed / POSIX
index c44a9fd..41955af 100644 (file)
@@ -1,4 +1,4 @@
-#      @(#)POSIX       5.6 (Berkeley) %G%
+#      @(#)POSIX       8.1 (Berkeley) 6/6/93
 
 Comments on the IEEE P1003.2 Draft 12
      Part 2: Shell and Utilities
 
 Comments on the IEEE P1003.2 Draft 12
      Part 2: Shell and Utilities
@@ -15,20 +15,29 @@ implementing a POSIX-compatible version of sed, and should not be
 interpreted as official opinions or criticism towards the POSIX committee.
 All uses of "POSIX" refer to section 4.55, Draft 12 of POSIX 1003.2.
 
 interpreted as official opinions or criticism towards the POSIX committee.
 All uses of "POSIX" refer to section 4.55, Draft 12 of POSIX 1003.2.
 
- 1.    Historic implementations of sed strip the text arguments of the
-       a, c and i commands of their initial blanks, i.e.
+ 1.    32V and BSD derived implementations of sed strip the text
+       arguments of the a, c and i commands of their initial blanks,
+       i.e.
 
        #!/bin/sed -f
        a\
                foo\
 
        #!/bin/sed -f
        a\
                foo\
+               \  indent\
                bar
 
        produces:
 
        foo
                bar
 
        produces:
 
        foo
+         indent
        bar
 
        bar
 
-       POSIX does not specify this behavior.  This implementation follows
+       POSIX does not specify this behavior as the System V versions of
+       sed do not do this stripping.  The argument against stripping is
+       that it is difficult to write sed scripts that have leading blanks
+       if they are stripped.  The argument for stripping is that it is
+       difficult to write readable sed scripts unless indentation is allowed
+       and ignored, and leading whitespace is obtainable by entering a
+       backslash in front of it.  This implementation follows the BSD
        historic practice.
 
  2.    Historical versions of sed required that the w flag be the last
        historic practice.
 
  2.    Historical versions of sed required that the w flag be the last
@@ -88,10 +97,7 @@ All uses of "POSIX" refer to section 4.55, Draft 12 of POSIX 1003.2.
        did not produce any output.  POSIX does not specify this behavior.
        This implementation follows historic practice.
 
        did not produce any output.  POSIX does not specify this behavior.
        This implementation follows historic practice.
 
-10.    POSIX does not specify that the q command causes all lines that
-       have been appended to be output and that the pattern space is
-       printed before exiting.  This implementation follows historic
-       practice.
+10.    Deleted.
 
 11.    Historical implementations do not output the change text of a c
        command in the case of an address range whose first line number
 
 11.    Historical implementations do not output the change text of a c
        command in the case of an address range whose first line number
@@ -102,21 +108,19 @@ All uses of "POSIX" refer to section 4.55, Draft 12 of POSIX 1003.2.
 
 12.    POSIX does not specify whether address ranges are checked and
        reset if a command is not executed due to a jump.  The following
 
 12.    POSIX does not specify whether address ranges are checked and
        reset if a command is not executed due to a jump.  The following
-       program, with the input "one\ntwo\nthree\nfour\nfive" can behave
-       in different ways depending on whether the the /one/,/three/c
-       command is triggered at the third line.
+       program will behave in different ways depending on whether the
+       'c' command is triggered at the third line, i.e. will the text
+       be output even though line 3 of the input will never logically
+       encounter that command.
 
        2,4b
 
        2,4b
-       /one,/three/c\
-               append some text
+       1,3c\
+               text
 
 
-       Historic implementations of sed, for the above example, would
-       output the text after the "branch" no longer applied, but would
-       then quit without further processing.  This implementation has
-       the more intuitive behavior of never outputting the text at all.
-       This is based on the belief that it would be reasonable to want
-       to output some text if the pattern /one/,/three/ occurs but only
-       if it occurs outside of the range of lines 2 to 4.
+       Historic implementations, and this implementation, do not output
+       the text in the above example.  The general rule, therefore,
+       is that a range whose second address is never matched extends to
+       the end of the input.
 
 13.    Historical implementations allow an output suppressing #n at the
        beginning of -e arguments as well as in a script file.  POSIX
 
 13.    Historical implementations allow an output suppressing #n at the
        beginning of -e arguments as well as in a script file.  POSIX
@@ -131,7 +135,7 @@ All uses of "POSIX" refer to section 4.55, Draft 12 of POSIX 1003.2.
        sed", where they produce no output, and "ls | sed -e#", where they
        behave like cat.  This implementation behaves like cat in both cases.
 
        sed", where they produce no output, and "ls | sed -e#", where they
        behave like cat.  This implementation behaves like cat in both cases.
 
-15.    The POSIX requirement to open all wfiles from the beginning makes
+15.    The POSIX requirement to open all w files at the beginning makes
        sed behave nonintuitively when the w commands are preceded by
        addresses or are within conditional blocks.  This implementation
        follows historic practice and POSIX, by default, and provides the
        sed behave nonintuitively when the w commands are preceded by
        addresses or are within conditional blocks.  This implementation
        follows historic practice and POSIX, by default, and provides the
@@ -168,11 +172,7 @@ All uses of "POSIX" refer to section 4.55, Draft 12 of POSIX 1003.2.
        string1 or string2 of the y command.  This is not specified by
        POSIX.  This implementation follows historic practice.
 
        string1 or string2 of the y command.  This is not specified by
        POSIX.  This implementation follows historic practice.
 
-21.    POSIX does not specify if the "Nth occurrence" of an RE in a
-       substitute command is an overlapping or a non-overlapping one,
-       i.e. what is the result of s/a*/A/2 on the pattern "aaaaa aaaaa".
-       Historical practice is to drop core or only do non-overlapping
-       RE's.  This implementation only does non-overlapping RE's.
+21.    Deleted.
 
 22.    Historic implementations of sed ignore the RE delimiter characters
        within character classes.  This is not specified in POSIX.  This
 
 22.    Historic implementations of sed ignore the RE delimiter characters
        within character classes.  This is not specified in POSIX.  This
@@ -193,6 +193,6 @@ All uses of "POSIX" refer to section 4.55, Draft 12 of POSIX 1003.2.
 
        While many historical implementations fail on programs depending
        on scope differences, the SunOS version exhibited dynamic scope
 
        While many historical implementations fail on programs depending
        on scope differences, the SunOS version exhibited dynamic scope
-       behaviour.  This implementation also uses does dynamic scoping, as
-       this seems the most useful and in order to remain consistent with
-       historical practice.
+       behaviour.  This implementation does dynamic scoping, as this seems
+       the most useful and in order to remain consistent with historical
+       practice.