a...@100acres.us writes:

> The seq command behaves a little differently than I expect.  I needed a comma
> separated list of integers, but seq gave me this:
>
>  $seq -s , 1 3
>  1,2,3,$
>
> Notice the extra comma and no trailing return.  The comma is troublesome for 
> my

>From reading the man page, the extra comma is a bug, and the lack of a
trailing return is correct.

> particular purpose.  It seems that the item separator (-s) is really an item
> terminator.  I was expecting this:
>
>  $seq -s , 1 3
>  1,2,3
>  $
>
> I'm sure there is some not-obvious-to-me reason for the current behavior.

It could just be a bug.  But the man page is inconsistent.

I suspect there is almost no use of -s.  But I wonder.

If this change makes seq with -s behave like GNU seq, and more closely
aligns with seq's own man page, that seems like a reasonable thing.

> However, I implemented what I expected and build a distribution without issue.
> The attached diff implements the proposed behavior.
>
> Aran

> Index: seq.1
> ===================================================================
> RCS file: /cvsroot/src/usr.bin/seq/seq.1,v
> retrieving revision 1.9
> diff -u -r1.9 seq.1
> --- seq.1     18 Aug 2016 22:55:28 -0000      1.9
> +++ seq.1     13 Dec 2018 17:35:48 -0000
> @@ -117,8 +117,7 @@
>  can contain character escape sequences in backslash notation as
>  defined in
>  .St -ansiC .
> -This option is useful when the default separator
> -does not contain a
> +The default is
>  .Cm \en .
>  .It Fl w
>  Equalize the widths of all numbers by padding with zeros as necessary.
> Index: seq.c
> ===================================================================
> RCS file: /cvsroot/src/usr.bin/seq/seq.c,v
> retrieving revision 1.10
> diff -u -r1.10 seq.c
> --- seq.c     29 Oct 2017 01:28:46 -0000      1.10
> +++ seq.c     13 Dec 2018 17:35:48 -0000
> @@ -132,7 +132,7 @@
>               fprintf(stderr,
>                   "usage: %s [-w] [-f format] [-s string] [-t string] [first 
> [incr]] last\n",
>                   getprogname());
> -             exit(1);
> +exit(1);

Why the whitespace change?

The rest seems ok, except I'm not sure what happens if the for loop
would not run the first time, but perhaps that can't happen.



Reply via email to