]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
doc: add `seq inf` and `sleep inf` examples to texinfo
authorPádraig Brady <P@draigBrady.com>
Fri, 18 Dec 2020 14:49:27 +0000 (14:49 +0000)
committerPádraig Brady <P@draigBrady.com>
Fri, 18 Dec 2020 14:54:57 +0000 (14:54 +0000)
* 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.

doc/coreutils.texi
src/seq.c

index 44ce7d2e0f08891cc6b6b2109094a6a22dc3bc41..7bf47d0f690f310b5f33f791ee020a618cf3f070 100644 (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
index 2ca1e4f7b7970ad6820af74a552d53000b35b85e..ee8d005cacb232afc680c52f69c67676c2f11a76 100644 (file)
--- a/src/seq.c
+++ b/src/seq.c
@@ -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).  */