manual: Clarify that abbreviations of long options are allowed

Message ID 20220503045743.2887439-1-siddhesh@sourceware.org
State Superseded
Headers
Series manual: Clarify that abbreviations of long options are allowed |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit success Build for i686

Commit Message

Siddhesh Poyarekar May 3, 2022, 4:57 a.m. UTC
  The man page and code comments clearly state that abbreviations of long
option names are recognized correctly as long as they are unique.
Document this fact in the glibc manual as well.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
---
 manual/getopt.texi | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Florian Weimer May 3, 2022, 5:13 a.m. UTC | #1
* Siddhesh Poyarekar via Libc-alpha:

> The man page and code comments clearly state that abbreviations of long
> option names are recognized correctly as long as they are unique.
> Document this fact in the glibc manual as well.
>
> Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
> ---
>  manual/getopt.texi | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/manual/getopt.texi b/manual/getopt.texi
> index 5485fc4694..e58283ab88 100644
> --- a/manual/getopt.texi
> +++ b/manual/getopt.texi
> @@ -250,7 +250,8 @@ option, and stores the option's argument (if it has one) in @code{optarg}.
>  
>  When @code{getopt_long} encounters a long option, it takes actions based
>  on the @code{flag} and @code{val} fields of the definition of that
> -option.
> +option.  The option name may be abbreviated as long as the abbreviation is
> +unique or is an exact match for some defined option.
>  
>  If @code{flag} is a null pointer, then @code{getopt_long} returns the
>  contents of @code{val} to indicate which option it found.  You should

Looks okay.

Reviewed-by: Florian Weimer <fweimer@redhat.com>

Thanks,
Florian
  
Andreas Schwab May 3, 2022, 7:36 a.m. UTC | #2
On Mai 03 2022, Siddhesh Poyarekar via Libc-alpha wrote:

> diff --git a/manual/getopt.texi b/manual/getopt.texi
> index 5485fc4694..e58283ab88 100644
> --- a/manual/getopt.texi
> +++ b/manual/getopt.texi
> @@ -250,7 +250,8 @@ option, and stores the option's argument (if it has one) in @code{optarg}.
>  
>  When @code{getopt_long} encounters a long option, it takes actions based
>  on the @code{flag} and @code{val} fields of the definition of that
> -option.
> +option.  The option name may be abbreviated as long as the abbreviation is
> +unique or is an exact match for some defined option.

If it's an exact match, it isn't an abbreviation?
  
Siddhesh Poyarekar May 4, 2022, 2:56 a.m. UTC | #3
On 03/05/2022 13:06, Andreas Schwab wrote:
> On Mai 03 2022, Siddhesh Poyarekar via Libc-alpha wrote:
> 
>> diff --git a/manual/getopt.texi b/manual/getopt.texi
>> index 5485fc4694..e58283ab88 100644
>> --- a/manual/getopt.texi
>> +++ b/manual/getopt.texi
>> @@ -250,7 +250,8 @@ option, and stores the option's argument (if it has one) in @code{optarg}.
>>   
>>   When @code{getopt_long} encounters a long option, it takes actions based
>>   on the @code{flag} and @code{val} fields of the definition of that
>> -option.
>> +option.  The option name may be abbreviated as long as the abbreviation is
>> +unique or is an exact match for some defined option.
> 
> If it's an exact match, it isn't an abbreviation?
> 

So just the following?

The option name may be abbreviated as long as the abbreviation is unique.

Thanks,
Siddhesh
  
Andreas Schwab May 4, 2022, 7:38 a.m. UTC | #4
On Mai 04 2022, Siddhesh Poyarekar wrote:

> The option name may be abbreviated as long as the abbreviation is unique.

Ok.
  

Patch

diff --git a/manual/getopt.texi b/manual/getopt.texi
index 5485fc4694..e58283ab88 100644
--- a/manual/getopt.texi
+++ b/manual/getopt.texi
@@ -250,7 +250,8 @@  option, and stores the option's argument (if it has one) in @code{optarg}.
 
 When @code{getopt_long} encounters a long option, it takes actions based
 on the @code{flag} and @code{val} fields of the definition of that
-option.
+option.  The option name may be abbreviated as long as the abbreviation is
+unique or is an exact match for some defined option.
 
 If @code{flag} is a null pointer, then @code{getopt_long} returns the
 contents of @code{val} to indicate which option it found.  You should