From patchwork Wed Jun 8 13:23:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 9164601 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D6572604DB for ; Wed, 8 Jun 2016 13:23:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C908D2723E for ; Wed, 8 Jun 2016 13:23:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BDB1828303; Wed, 8 Jun 2016 13:23:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 641872723E for ; Wed, 8 Jun 2016 13:23:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756785AbcFHNXY (ORCPT ); Wed, 8 Jun 2016 09:23:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34550 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753982AbcFHNXW (ORCPT ); Wed, 8 Jun 2016 09:23:22 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2BE2A8553E for ; Wed, 8 Jun 2016 13:23:17 +0000 (UTC) Received: from steved.boston.devel.redhat.com (vpn-49-78.rdu2.redhat.com [10.10.49.78]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u58DNGxb020429 for ; Wed, 8 Jun 2016 09:23:16 -0400 From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH v2] nfsidmap: added the -h option Date: Wed, 8 Jun 2016 09:23:15 -0400 Message-Id: <1465392195-11875-1-git-send-email-steved@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 08 Jun 2016 13:23:17 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use the correct exit code when an invalid option use or the -h option. Signed-off-by: Steve Dickson --- utils/nfsidmap/nfsidmap.c | 7 ++++--- utils/nfsidmap/nfsidmap.man | 5 +++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/utils/nfsidmap/nfsidmap.c b/utils/nfsidmap/nfsidmap.c index 2abefe9..63545fc 100644 --- a/utils/nfsidmap/nfsidmap.c +++ b/utils/nfsidmap/nfsidmap.c @@ -17,7 +17,7 @@ #include "conffile.h" int verbose = 0; -char *usage = "Usage: %s [-v] [-c || [-u|-g|-r key] || -d || -l || [-t timeout] key desc]"; +char *usage = "Usage: %s [-vh] [-c || [-u|-g|-r key] || -d || -l || [-t timeout] key desc]"; #define MAX_ID_LEN 11 #define IDMAP_NAMESZ 128 @@ -369,7 +369,7 @@ int main(int argc, char **argv) xlog_open(progname); - while ((opt = getopt(argc, argv, "du:g:r:ct:vl")) != -1) { + while ((opt = getopt(argc, argv, "hdu:g:r:ct:vl")) != -1) { switch (opt) { case 'd': display++; @@ -398,9 +398,10 @@ int main(int argc, char **argv) case 't': timeout = atoi(optarg); break; + case 'h': default: xlog_warn(usage, progname); - break; + exit(opt == 'h' ? 0 : 1); } } diff --git a/utils/nfsidmap/nfsidmap.man b/utils/nfsidmap/nfsidmap.man index 0275bdf..2f17cf2 100644 --- a/utils/nfsidmap/nfsidmap.man +++ b/utils/nfsidmap/nfsidmap.man @@ -15,6 +15,8 @@ nfsidmap \- The NFS idmapper upcall program .B "nfsidmap -d" .br .B "nfsidmap -l" +.br +.B "nfsidmap -h" .SH DESCRIPTION The NFSv4 protocol represents the local system's UID and GID values on the wire as strings of the form @@ -71,6 +73,9 @@ Display the system's effective NFSv4 domain name on .B -g user Revoke the gid key of the given user. .TP +.B -h +Display usage message. +.TP .B -l Display on .I stdout