Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 386F4C76186 for ; Tue, 23 Jul 2019 16:36:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0FF9C2239F for ; Tue, 23 Jul 2019 16:36:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732174AbfGWQgH (ORCPT ); Tue, 23 Jul 2019 12:36:07 -0400 Received: from fieldses.org ([173.255.197.46]:34234 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728505AbfGWQgH (ORCPT ); Tue, 23 Jul 2019 12:36:07 -0400 Received: by fieldses.org (Postfix, from userid 2815) id D88372011; Tue, 23 Jul 2019 12:36:06 -0400 (EDT) Date: Tue, 23 Jul 2019 12:36:06 -0400 To: Yongcheng Yang Cc: "J . Bruce Fields" , linux-nfs@vger.kernel.org Subject: Re: [PATCH 1/2] nfs4_getfacl: return 1 for unknown option and won't use '-?' anymore Message-ID: <20190723163606.GA16908@fieldses.org> References: <20190723062713.20570-1-yongcheng.yang@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190723062713.20570-1-yongcheng.yang@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) From: bfields@fieldses.org (J. Bruce Fields) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Tue, Jul 23, 2019 at 02:27:12PM +0800, Yongcheng Yang wrote: > The getopt_long() function will return '?' if encounters an option > character that was not in optstring. So it's impossible to tell the > option '-?' from an unrecognized option. Don't mention it in Usage. Thanks, both patches applied.--b. > > Signed-off-by: Yongcheng Yang > --- > nfs4_getfacl/nfs4_getfacl.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/nfs4_getfacl/nfs4_getfacl.c b/nfs4_getfacl/nfs4_getfacl.c > index 4df2b04..2f57866 100644 > --- a/nfs4_getfacl/nfs4_getfacl.c > +++ b/nfs4_getfacl/nfs4_getfacl.c > @@ -88,10 +88,14 @@ int main(int argc, char **argv) > case 'c': > ignore_comment = 1; > break; > - default: > + case 'h': > usage(1); > res = 0; > goto out; > + case '?': > + default: > + usage(0); > + goto out; > } > } > > @@ -131,7 +135,7 @@ static void usage(int label) > { > if (label) > fprintf(stderr, "%s %s -- get NFSv4 file or directory access control lists.\n", execname, VERSION); > - fprintf(stderr, "Usage: %s [-R] file ...\n -H, --more-help\tdisplay ACL format information\n -?, -h, --help\tdisplay this help text\n -R --recursive\trecurse into subdirectories\n -c, --omit-header\tDo not display the comment header (Do not print filename)\n", execname); > + fprintf(stderr, "Usage: %s [-R] file ...\n -H, --more-help\tdisplay ACL format information\n -h, --help\tdisplay this help text\n -R --recursive\trecurse into subdirectories\n -c, --omit-header\tDo not display the comment header (Do not print filename)\n", execname); > } > > static void more_help() > -- > 2.20.1