diff options
author | Pádraig Brady <P@draigBrady.com> | 2020-12-18 14:49:27 +0000 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2020-12-18 14:54:57 +0000 |
commit | e5cb4aaa0b007fc1b3b7f0a97a73eb6347992b78 (patch) | |
tree | 1740754316a06985415b8caf15442013468573e3 | |
parent | 3e61d5dd315be3aa1982b66b4e137564c61c849f (diff) |
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.
-rw-r--r-- | doc/coreutils.texi | 15 | ||||
-rw-r--r-- | src/seq.c | 2 |
2 files changed, 13 insertions, 4 deletions
diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 44ce7d2e0..7bf47d0f6 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -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 @@ -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). */ |