I added a way to specify the string printed after the last number in the seq command, as suggested by a comment. I am not sure how helpful this option is, because I personally don't use the seq command much. I also added documentation to both usage (and, in effect, the man page) and coreutils.texi. It was so small that I didn't see any need for a test. It went over the ten line limit, but is pretty trivial and the large majority is documentation, so I am unsure if I need to sign anything. I also forgot to add a NEWS entry, but I am not even sure this will get accepted, yet. :-)
Thanks, William
From 22a82960eb69f6a781a1d320381b48bb5c80ffd8 Mon Sep 17 00:00:00 2001 From: Patrick W. Plusnick II <address@hidden> Date: Wed, 27 Oct 2010 12:08:37 -0500
Subject: [PATCH] seq: added an option to specify the terminator *src/seq.c: I added a new option called terminator (t) that prints a user specified string after the last number; the terminator string still defaults to a newline. I also added documentation in the usage function.
*doc/coreutils.texi: added documentation for the change.
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 0b5a3d3..c9b5345 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -15612,7 +15612,11 @@ the default format is @samp{%g}. @itemx --separator=@var{string} @cindex separator for numbers in @command{seq}
Separate numbers with @var{string}; default is a newline. -The output always terminates with a newline. + +@item -t @var{string} +@itemx --terminator=@var{string} +@cindex terminator for the last number in @command{seq}
+Ouput @var{string} after the last number; default is a newline.
/* The string output after all numbers have been output. Usually "\n" or "\0". */ -/* FIXME: make this an option. */ -static char const terminator[] = "\n"; +static char const *terminator;
static struct option const long_options[] = { { "equal-width", no_argument, NULL, 'w'}, { "format", required_argument, NULL, 'f'}, { "separator", required_argument, NULL, 's'},
+ { "terminator", required_argument, NULL, 't'}, {GETOPT_HELP_OPTION_DECL}, {GETOPT_VERSION_OPTION_DECL}, { NULL, 0, NULL, 0} @@ -77,6 +77,7 @@ Print numbers from FIRST to LAST, in steps of INCREMENT.\n\
\n\ -f, --format=FORMAT use printf style floating-point FORMAT\n\ -s, --separator=STRING use STRING to separate numbers (default: \\n)\n\ + -t, --terminator=STRING output STRING after the last number (default: \\n)\n\
-w, --equal-width equalize width by padding with leading zeroes\n\ "), stdout); fputs (HELP_OPTION_DESCRIPTION, stdout); @@ -359,6 +360,7 @@ main (int argc, char **argv)
/* We have to handle negative numbers in the command line but this conflicts with the command line arguments. So explicitly check first
@@ -372,7 +374,7 @@ main (int argc, char **argv) break; }