Re: Shouldn't getopt_long() return ':' for options requiring an argument?
From: Eric Lilja (mindcooler_thisshouldberemoved_at_gmail.com)
Date: 04/24/05
- Next message: Mack: "Re: a question each about random() function and LCG"
- Previous message: webzila: "Re: Unix Shell Scripts and Boolean Expressions"
- In reply to: Måns Rullgård: "Re: Shouldn't getopt_long() return ':' for options requiring an argument?"
- Next in thread: Måns Rullgård: "Re: Shouldn't getopt_long() return ':' for options requiring an argument?"
- Reply: Måns Rullgård: "Re: Shouldn't getopt_long() return ':' for options requiring an argument?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 24 Apr 2005 22:06:06 +0200
"Måns Rullgård" <mru@inprovide.com> wrote:
> "Eric Lilja" <mindcooler_thisshouldberemoved@gmail.com> writes:
>
>> Hello, consider this C program and its accompanying test script:
>
> [...]
>
>> As you can see, getopt_long() returns '?' for the case where the option
>> requires arguments and none was supplied, I was under the impression that
>> it
>> should return ':' for that case and '?' for unknown options (it prints
>> the
>> correct diagnostic, though). Is this a bug in the implementation of
>> getopt_long() on my system or are there simply different valid variants
>> of
>> the implementation?
>
> man 3 getopt:
>
> If the first character (following any optional '+'or '-'
> described
> above) of optstring is a colon (':'), then getopt() returns ':'
> instead
> of '?' to indicate a missing option argument.
>
Hmm, I must be daft or something, but does that mean that getopt_long() only
returns ':' if the user had supplied --:option_with_argument on the command
line?
> --
> Måns Rullgård
> mru@inprovide.com
/ E
- Next message: Mack: "Re: a question each about random() function and LCG"
- Previous message: webzila: "Re: Unix Shell Scripts and Boolean Expressions"
- In reply to: Måns Rullgård: "Re: Shouldn't getopt_long() return ':' for options requiring an argument?"
- Next in thread: Måns Rullgård: "Re: Shouldn't getopt_long() return ':' for options requiring an argument?"
- Reply: Måns Rullgård: "Re: Shouldn't getopt_long() return ':' for options requiring an argument?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|