From: Stefan Agner Date: Thu, 08 Feb 2018 17:40:54 +0100 Subject: [U-Boot] [PATCH] Fix --noheader on fw_printenv In-Reply-To: References: <1518082525-5995-1-git-send-email-alex.kiernan@gmail.com> <87b4ba805292e22e7c23f918ebe6aa9c@agner.ch> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 08.02.2018 17:17, Alex Kiernan wrote: > On Thu, Feb 8, 2018 at 3:37 PM, 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