Re: git: 81cea61f3b3a - main - bin/sleep: document more non-standard features

From: Stefan Esser <se_at_FreeBSD.org>
Date: Tue, 24 May 2022 18:10:07 UTC
Am 24.05.22 um 14:24 schrieb Mike Karels:
> On 24 May 2022, at 4:33, Stefan Eßer wrote:
> 
>> diff --git a/bin/sleep/sleep.1 b/bin/sleep/sleep.1
>> index 85086acec5ad..f7da87152f99 100644
>> --- a/bin/sleep/sleep.1
>> +++ b/bin/sleep/sleep.1
>> @@ -70,9 +70,10 @@ signal is not handled specially by this implementation.
>>  .Pp
>>  The
>>  .Nm
>> -command allows and honors a non-integer number of seconds to sleep
>> -in any form acceptable by
>> -.Xr strtod 3 and it accepts more than one delay value.
>> +command supports other time units than seconds,
>> +honors a non-integer number of time units to sleep in any form acceptable by
>> +.Xr strtod 3 ,
>> +and accepts more than one delay value.
>>  These are non-portable extensions, but they have also been implemented
>>  in GNU sh-utils since version 2.0a (released in 2002).
>>  .Sh EXIT STATUS
> 
> Is there a reason you didn’t list the time units that are supported?
> It would also be good to say how they are specified.

Commit 34978f7edd has already added the following text to the
man page:

--- a/bin/sleep/sleep.1
+++ b/bin/sleep/sleep.1
@@ -40,13 +40,21 @@
 .Nd suspend execution for an interval of time
 .Sh SYNOPSIS
 .Nm
-.Ar seconds
+.Ar number[unit]
 .Sh DESCRIPTION
 The
 .Nm
 command
 suspends execution for a minimum of
-.Ar seconds .
+.Ar number
+seconds (the default, or unit
+.Ar s ) ,
+or minutes (unit
+.Ar m ) ,
+hours (unit
+.Ar h ) ,
+or days (unit
+.Ar d ) .
 .Pp
 If the
 .Nm

The rendered man page section reads:

SYNOPSIS
     sleep number[unit] ...

DESCRIPTION
     The sleep command suspends execution for a minimum of number seconds (the
     default, or unit s), minutes (unit m), hours (unit h), or days (unit d).
     If multiple arguments are passed, the delay will be the sum of all
     values.


The first line of the description has been proposed in PR 264162 with the
patch that added support of units other than seconds.

Support of multiple arguments has been added by me after noticing that this
would make the FreeBSD sleep(1) support the same functionality as offered by
the coreutils version.

The commit you replied to has just added the two new features to the
IMPLEMENTATIION NOTES section in order to complete the list of non-standard
features offered after the two functional extensions.

Regards, STefan