[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] sleep: improve doc
From: |
Paul Eggert |
Subject: |
[PATCH] sleep: improve doc |
Date: |
Fri, 25 Jan 2019 11:17:33 -0800 |
Problem reported by Robert Elz.
* doc/coreutils.texi (sleep invocation):
Say that arguments must be non-negative, which means they cannot
be arbitrary floating-point numbers. Mention POSIX, not
“historical implementations” that are no longer of practical
interest. List the extensions to POSIX.
* src/sleep.c (usage): Omit needless words, removing dubious
commentary about “most implementations” and incorrect commentary
about “arbitrary”. Details about exactly which numbers are
allowed can be found in the documentation.
---
doc/coreutils.texi | 10 +++++-----
src/sleep.c | 5 ++---
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 419417efa..e9af80b7a 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -18121,7 +18121,7 @@ sleep @var{number}[smhd]@dots{}
@end example
@cindex time units
-Each argument is a number followed by an optional unit; the default
+Each argument is a non-negative number followed by an optional unit; the
default
is seconds. The units are:
@table @samp
@@ -18135,10 +18135,10 @@ hours
days
@end table
-Historical implementations of @command{sleep} have required that
-@var{number} be an integer, and only accepted a single argument
-without a suffix. However, GNU @command{sleep} accepts
-arbitrary floating point numbers. @xref{Floating point}.
+Although portable POSIX scripts must give @command{sleep} a single
+non-negative integer argument without a suffix, GNU @command{sleep}
+also accepts two or more arguments, unit suffixes, and floating-point
+numbers. @xref{Floating point}.
The only options are @option{--help} and @option{--version}. @xref{Common
options}.
diff --git a/src/sleep.c b/src/sleep.c
index 1fc398a51..23a941636 100644
--- a/src/sleep.c
+++ b/src/sleep.c
@@ -51,9 +51,8 @@ usage (int status)
Usage: %s NUMBER[SUFFIX]...\n\
or: %s OPTION\n\
Pause for NUMBER seconds. SUFFIX may be 's' for seconds (the default),\n\
-'m' for minutes, 'h' for hours or 'd' for days. Unlike most implementations\n\
-that require NUMBER be an integer, here NUMBER may be an arbitrary floating\n\
-point number. Given two or more arguments, pause for the amount of time\n\
+'m' for minutes, 'h' for hours or 'd' for days. NUMBER need not be an\n\
+integer. Given two or more arguments, pause for the amount of time\n\
specified by the sum of their values.\n\
\n\
"),
--
2.17.1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] sleep: improve doc,
Paul Eggert <=