On Sun, Nov 26, 2017 at 07:47:01PM +0000, kshe wrote:
> Hi,
> 
> I noticed a certain number of inaccuracies within the manual page for
> sed.  The diff below corrects to most obvious ones, although further
> improvements are certainly possible.
> 
> Additionally, the script given in the EXAMPLES section being already
> quite unnecessarily contrived (as it does in twelve commands what could
> be done in merely two), I took the opportunity to make it slightly
> simpler and easier to read.
> 

morning.

this diff is too much for review (at least for me anyway). could you
parcel it up into some logical parts and resend?

i'll make some comments inline:

> Index: sed.1
> ===================================================================
> RCS file: /cvs/src/usr.bin/sed/sed.1,v
> retrieving revision 1.50
> diff -u -p -r1.50 sed.1
> --- sed.1     19 Jul 2017 21:28:19 -0000      1.50
> +++ sed.1     17 Nov 2017 02:50:36 -0000
> @@ -57,10 +57,9 @@ utility reads the specified files, or th
>  are specified, modifying the input as specified by a list of commands.
>  The input is then written to the standard output.
>  .Pp
> -A single command may be specified as the first argument to
> -.Nm sed .
> -Multiple commands may be specified
> -separated by newlines or semicolons,
> +Commands are separated by newlines or semicolons and may be specified
> +either as the first argument to
> +.Nm

ok, all the what can and what cannot go on newline stuff would make one
diff.

>  or by using the
>  .Fl e
>  or
> @@ -95,7 +94,6 @@ to the list of commands.
>  Append the editing commands found in the file
>  .Ar command_file
>  to the list of commands.
> -The editing commands should each be listed on a separate line.
>  .It Fl i Ns Op Ar extension
>  Edit files in place, saving backups with the specified
>  .Ar extension .
> @@ -199,7 +197,7 @@ has the following two additions to BREs:
>  In a context address, any character other than a backslash
>  .Pq Ql \e
>  or newline character may be used to delimit the regular expression.
> -The opening delimiter should be preceded by a backslash
> +The opening delimiter must be preceded by a backslash

what's there is fine, honestly. modal verbs are suble; text which
continually instructs "thou must" is not.

>  unless it is a slash.
>  Putting a backslash character before the delimiting character
>  causes the character to be treated literally.
> @@ -255,7 +253,7 @@ as well as the
>  flag to the
>  .Ic s
>  function,
> -take an optional
> +take a

fluff could be another diff. this seems correct.

>  .Ar file
>  parameter,
>  which should be separated from the function or flag by whitespace.
> @@ -264,23 +262,22 @@ Files are created
>  before any input processing begins.
>  .Pp
>  The
> -.Ic b ,
> -.Ic r ,
> -.Ic s ,
> -.Ic t ,
> -.Ic w ,
> -.Ic y ,
> +.Ar label
> +argument to the
> +.Ic \&: ,
> +.Ic b
>  and
> -.Ic \&:
> -functions all accept additional arguments.
> -The synopses below indicate which arguments have to be separated from
> +.Ic t
> +commands may be terminated by either a newline or a semicolon,
> +although the former should be prefered if portability is desired.
> +.Pp
> +For functions that accept additional arguments,
> +the synopses below indicate which have to be separated from
>  the function letters by whitespace characters.
>  .Pp
>  Functions can be combined to form a
> -.Em function list ,
> -a list of
> -.Nm
> -functions each followed by a newline, as follows:
> +.Em function list
> +as follows:
>  .Bd -literal -offset indent
>  { function
>    function
> @@ -297,11 +294,11 @@ in which case they are applied only to l
>  .Em not
>  selected by the addresses.
>  .Bl -tag -width Ds
> -.It [2addr] Ar function-list
> +.It [2addr] Ns Ar function-list

it's not possible without a space?

>  Execute
>  .Ar function-list
>  only when the pattern space is selected.
> -.It Xo [1 addr] Ic a Ns \e
> +.It Xo [1addr] Ns Ic a Ns \e
>  .br
>  .Ar text
>  .Xc
> @@ -317,7 +314,7 @@ Branch to the
>  function with the specified
>  .Ar label .
>  If the label is not specified, branch to the end of the script.
> -.It Xo [2addr] Ic c Ns \e
> +.It Xo [2addr] Ns Ic c Ns \e
>  .br
>  .Ar text
>  .Xc
> @@ -342,7 +339,7 @@ pattern space.
>  .It [2addr] Ns Ic H
>  Append a newline character followed by the contents of the pattern space
>  to the hold space.
> -.It Xo [1addr] Ic i Ns \e
> +.It Xo [1addr] Ns Ic i Ns \e
>  .br
>  .Ar text
>  .Xc
> @@ -413,8 +410,8 @@ in the pattern space.
>  Any character other than backslash or newline can be used instead of
>  a slash to delimit the regular expression and the replacement.
>  Within the regular expression and the replacement,
> -the regular expression delimiter itself can be used as
> -a literal character if it is preceded by a backslash.
> +the delimiter itself can be used as a literal character
> +if it is preceded by a backslash.
>  .Pp
>  An ampersand
>  .Pq Ql &
> @@ -486,10 +483,14 @@ Within
>  .Ar string1
>  and
>  .Ar string2 ,
> -a backslash followed by any character other than a newline is that literal
> -character, and a backslash followed by an
> +a backslash followed by another backslash
> +is replaced by a single backslash,
> +a backslash followed by an
>  .Sq n
> -is replaced by a newline character.
> +is replaced by a newline character,
> +and a backslash followed by the delimiting character
> +is replaced by a that character,
> +causing it to be treated literally.
>  .It [0addr] Ns Ic \&: Ns Ar label
>  This function does nothing; it bears a
>  .Ar label
> @@ -522,7 +523,7 @@ output from the
>  function is formatted to the given width in columns.
>  Otherwise,
>  .Nm
> -defaults to the terminal with, or 80 columns if the output is not a terminal.
> +defaults to the terminal width, or 80 columns if the output is not a 
> terminal.

heh. mark as "fluff"

>  .El
>  .Sh EXIT STATUS
>  .Ex -std sed
> @@ -538,20 +539,15 @@ $ sed -n '
>  /./ {
>      p
>      d
> -    }
> +}
>  # Write a single empty line, then look for more empty lines.
> -/^$/    p
> -# Get the next line, discard the held <newline> (empty line),
> -# and look for more empty lines.
> +p
>  :Empty
> -/^$/    {
> -    N
> -    s/.//
> -    b Empty
> -    }
> +n
> +/^$/b Empty
>  # Write the non-empty line before going back to search
>  # for the first in a set of empty lines.
> -    p
> +p
>  \&'
>  .Ed

maybe the example was trying to show a clear, step by step, example.
sure you can squeeze it, but i don;t think that's the point.

having said this, i'm no sed expert. if anyone else wants to comment on
this diff, please do.

>  .Sh SEE ALSO
> @@ -569,12 +565,6 @@ specification.
>  The flags
>  .Op Fl aEiru
>  are extensions to that specification.
> -.Pp
> -The use of newlines to separate multiple commands on the command line
> -is non-portable;
> -the use of newlines to separate multiple commands within a command file
> -.Pq Fl f Ar command_file
> -is portable.
>  .Sh HISTORY
>  A
>  .Nm
> @@ -583,8 +573,6 @@ command appeared in
>  .Sh CAVEATS
>  The use of semicolons to separate multiple commands
>  is not permitted for the following commands:
> -.Ic a , b , c ,
> -.Ic i , r , t ,
> -.Ic w , \&: ,
> +.Ic a , c , i , r , w
>  and
>  .Ic # .
> 
> Regards,
> 
> kshe
> 

jmc

Reply via email to