[U-Boot] [PATCH] Fix --noheader on fw_printenv
Stefan Agner
stefan at agner.ch
Thu Feb 8 16:40:54 UTC 2018
On 08.02.2018 17:17, Alex Kiernan wrote:
> On Thu, Feb 8, 2018 at 3:37 PM, <stefan at agner.ch> wrote:
>> On 08.02.2018 10:35, Alex Kiernan wrote:
>>> Using fw_printenv with --noheader fails:
>>>
>>> root at nrr-922:~# fw_printenv --noheader arch
>>> ## Error: `-n' option requires exactly one argument
>>
>> I think it would work with --noheader=arch
>>
>
> It doesn't:
>
> root at nrr-922:~# fw_printenv --noheader=arch
> ## Error: `-n' option requires exactly one argument
>
> Probably I should fix the error too as it's misleading.
>
This comes from getopt_long, so I don't think you can fix it. The getopt
string in parse_printenv_args actually says argument "n" has no argument
(no colon), so it actually is surprising that it prints that...
Maybe this is from the getopt_long call in parse_common_args?
>>>
>>> Whereas -n works:
>>>
>>> root at nrr-922:~# fw_printenv -n arch
>>> arm
>>>
>>> The single argument it's expecting isn't taken from getopt parsing,
>>> but instead from the remaining argv arguments.
>>
>> That makes sense. But the commit log text above is kind of unrelated/not
>> relevant, I would just use this two lines as git message.
>>
>
> Happy to chop it down to the last two lines though as it does include
> the relevant details.
IMHO the error is that struct option long_options ask for an argument
whereas the optstring passed to getopt_long doesn't. The rather erratic
is not really relevant and should not be mentioned.
--
Stefan
More information about the U-Boot
mailing list