Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8372596ybi; Tue, 23 Jul 2019 07:27:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqyrPN/1B6UFzSeTf0QIm6Hu5XaouQjUloIwl1W+xKOJGyuU7x2E/ADYoDOHGoy3lcd87x/Y X-Received: by 2002:aa7:9481:: with SMTP id z1mr6119708pfk.92.1563892062274; Tue, 23 Jul 2019 07:27:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563892062; cv=none; d=google.com; s=arc-20160816; b=FAw9tMlXToc/PSInPj94OgjLSO0jsy4V0DYpyLJ5f923c6c5tP2kY1bCAIayZPwiqs 6P6DBXQ4gFfYJrtVm0McB8v6+MqRn4CuX3aB9RJt8aKLbkLexFevF1H3qGNwfl3VttpR pN2uYM4VrSFxNylh/7j0zmkiUANy1TeLtzw9bvnN8vf7hR9P1QqdHY6MpwIiMT9Dgy0I ZWEqq1b24VJOolw/pHRMxTgL7CrR74PRMVJPMB0t/dWXPZfc05SlbMsgtQo3Y1V+YMhH 4s+IUXXzaznJDqCG17T2xRtEBz/6zVkPk5ZhQONwFfKZMjs9UbhIGR9OlWGBqqe9yz8y X5bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=rY3ewsyZux8S0qK+8EZEbfysCCI2yrz0XFJMuZ8rW5U=; b=rpfpEZ016s1DQZY/dPymwrxPPqf3ls6kN6nstIbwVgmEtlKP/R6pPDZGMWBc0afUBt WBtVa+wpkhgCD1EMo5U1CSeshcS7i2HMKKkaX5X9xBtj1yfXigwhn29wqTbX3/nXL5LY RFmfhpwjQHbwBag6l32U2We4xceyOEWib6MHXeXWIcwc0d/yWpyLyM5sq8CYRA6zP8Cd 90pu0sKsPxmK2wdF26VNFdSkjOGRQr9V20hGUlXIVTkEkwsvOlxN2WerIP6jYZpIcwd7 1gY8O2RampvrkSMpSMSRUFYLCZ6qCM1OpGAciet3htCK+E626gCn+EszlAbTgJC57uV1 DBpA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e90si11445324plb.309.2019.07.23.07.27.16; Tue, 23 Jul 2019 07:27:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728683AbfGWG1T (ORCPT + 99 others); Tue, 23 Jul 2019 02:27:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53988 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728180AbfGWG1T (ORCPT ); Tue, 23 Jul 2019 02:27:19 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0027A308A9E2; Tue, 23 Jul 2019 06:27:19 +0000 (UTC) Received: from localhost (dhcp-12-152.nay.redhat.com [10.66.12.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6D2465D721; Tue, 23 Jul 2019 06:27:18 +0000 (UTC) From: Yongcheng Yang To: "J . Bruce Fields" Cc: linux-nfs@vger.kernel.org, Yongcheng Yang Subject: [PATCH 1/2] nfs4_getfacl: return 1 for unknown option and won't use '-?' anymore Date: Tue, 23 Jul 2019 14:27:12 +0800 Message-Id: <20190723062713.20570-1-yongcheng.yang@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Tue, 23 Jul 2019 06:27:19 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org 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. 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