1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-07-25 10:16:53 +02:00

doc: add seq inf and sleep inf examples to texinfo

* doc/coreutils.texi (seq invocation): Mention "inf" is supported,
and describe that it's handled specially to generate infinite
whole integer sequences.  Also mention that such infinite generation
is supported for integer steps up to 200.
(sleep invocation): Give `sleep inf` as an example to sleep forever.
* src/seq.c: Add a comment on SEQ_FAST_STEP_LIMIT, to say it's
reflected in the texinfo description.
This commit is contained in:
Pádraig Brady
2020-12-18 14:49:27 +00:00
parent 3e61d5dd31
commit e5cb4aaa0b
2 changed files with 13 additions and 4 deletions
+12 -3
View File
@@ -18337,6 +18337,12 @@ For instance, the following could be used to @command{sleep} for
sleep 1234e-3 567.89e-6
@end example
Also one could sleep indefinitely like:
@example
sleep inf
@end example
The only options are @option{--help} and @option{--version}. @xref{Common
options}.
@@ -18786,7 +18792,8 @@ The sequence of numbers ends when the sum of the current number and
so @code{seq 1 10 10} only produces @samp{1}.
@var{increment} must not be @samp{0}; use the tool @command{yes} to get
repeated output of a constant number.
@var{first}, @var{increment} and @var{last} must not be @code{NaN}.
@var{first}, @var{increment} and @var{last} must not be @code{NaN},
but @code{inf} is supported.
Floating-point numbers may be specified in either the current or
the C locale. @xref{Floating point}.
@@ -18882,8 +18889,10 @@ $ seq 50000000000000000000 2 50000000000000000004
@end example
However, note that when limited to non-negative whole numbers,
an increment of 1 and no format-specifying option, seq can print
arbitrarily large numbers.
an increment of less than 200, and no format-specifying option,
seq can print arbitrarily large numbers.
Therefore @command{seq inf} can be used to
generate an infinite sequence of numbers.
Be careful when using @command{seq} with outlandish values: otherwise
you may see surprising results, as @command{seq} uses floating point
+1 -1
View File
@@ -39,7 +39,7 @@
/* Limit below which seq_fast has more throughput.
Determined with: seq 0 200 inf | pv > /dev/null */
#define SEQ_FAST_STEP_LIMIT 200
#define SEQ_FAST_STEP_LIMIT 200 /* Keep in sync with texinfo description. */
#define SEQ_FAST_STEP_LIMIT_DIGITS 3
/* The official name of this program (e.g., no 'g' prefix). */