From patchwork Wed Dec 9 16:01:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 7809991 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4356D9F39B for ; Wed, 9 Dec 2015 16:02:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 59106204D8 for ; Wed, 9 Dec 2015 16:02:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 45DF420524 for ; Wed, 9 Dec 2015 16:02:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751537AbbLIQBp (ORCPT ); Wed, 9 Dec 2015 11:01:45 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57733 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752776AbbLIQBo (ORCPT ); Wed, 9 Dec 2015 11:01:44 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 83FDCB5937 for ; Wed, 9 Dec 2015 16:01:44 +0000 (UTC) Received: from smallhat.boston.devel.redhat.com (vpn-236-249.phx2.redhat.com [10.3.236.249]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tB9G1haE016486 for ; Wed, 9 Dec 2015 11:01:44 -0500 From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH 1/2] rpc.idmapd: Added a usage routine Date: Wed, 9 Dec 2015 11:01:41 -0500 Message-Id: <1449676902-19575-1-git-send-email-steved@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Show the correct arguments when invalid arguments are used. Signed-off-by: Steve Dickson --- utils/idmapd/idmapd.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/utils/idmapd/idmapd.c b/utils/idmapd/idmapd.c index 689608a..910b02e 100644 --- a/utils/idmapd/idmapd.c +++ b/utils/idmapd/idmapd.c @@ -199,6 +199,12 @@ flush_nfsd_idmap_cache(void) return ret; } +void usage(char *progname) +{ + fprintf(stderr, "Usage: %s [-fvCS] [-p path] [-c path]\n", + basename(progname)); +} + int main(int argc, char **argv) { @@ -232,9 +238,11 @@ main(int argc, char **argv) conf_path = optarg; if (opt == '?') { if (strchr(GETOPTSTR, optopt)) - errx(1, "'-%c' option requires an argument.", optopt); + warnx("'-%c' option requires an argument.", optopt); else - errx(1, "'-%c' is an invalid argument.", optopt); + warnx("'-%c' is an invalid argument.", optopt); + usage(progname); + exit(1); } } optind = 1;