From owner-svn-src-all@freebsd.org Thu Dec 12 05:11:54 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B7691EC46A; Thu, 12 Dec 2019 05:11:54 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47YMNV1RdCz46nQ; Thu, 12 Dec 2019 05:11:54 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2CAA01ED8E; Thu, 12 Dec 2019 05:11:54 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBC5BsE2088564; Thu, 12 Dec 2019 05:11:54 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBC5Br4l088563; Thu, 12 Dec 2019 05:11:53 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201912120511.xBC5Br4l088563@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Thu, 12 Dec 2019 05:11:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355647 - head/usr.bin/showmount X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/usr.bin/showmount X-SVN-Commit-Revision: 355647 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2019 05:11:54 -0000 Author: eadler Date: Thu Dec 12 05:11:53 2019 New Revision: 355647 URL: https://svnweb.freebsd.org/changeset/base/355647 Log: [showmount] implement long options add long options support to showmount. Where mappings exist use the GNU names for said options. Differential Revision: https://reviews.freebsd.org/D22543 Reviewed by: kevans (earlier version) Modified: head/usr.bin/showmount/showmount.8 head/usr.bin/showmount/showmount.c Modified: head/usr.bin/showmount/showmount.8 ============================================================================== --- head/usr.bin/showmount/showmount.8 Thu Dec 12 04:47:02 2019 (r355646) +++ head/usr.bin/showmount/showmount.8 Thu Dec 12 05:11:53 2019 (r355647) @@ -67,20 +67,20 @@ for a detailed description of the protocol. .Pp The following options are available: .Bl -tag -width indent -.It Fl a +.It Fl a , Fl -all List all mount points in the form: .Bd -ragged -offset indent -compact .Ar host : Ns Ar dirpath . .Ed -.It Fl d +.It Fl d , Fl -directories List directory paths of mount points instead of hosts. -.It Fl E +.It Fl E , Fl -exports-script Show the .Ar host Ns 's exports list in a script-friendly format. Client addresses and the header are not shown, and special characters are escaped. -.It Fl e +.It Fl e , Fl -exports Show the .Ar host Ns 's exports list. Modified: head/usr.bin/showmount/showmount.c ============================================================================== --- head/usr.bin/showmount/showmount.c Thu Dec 12 04:47:02 2019 (r355646) +++ head/usr.bin/showmount/showmount.c Thu Dec 12 05:11:53 2019 (r355647) @@ -53,6 +53,7 @@ static const char rcsid[] = #include #include +#include #include #include #include @@ -102,6 +103,14 @@ int xdr_exportslist(XDR *, struct exportslist **); int tcp_callrpc(const char *host, int prognum, int versnum, int procnum, xdrproc_t inproc, char *in, xdrproc_t outproc, char *out); +static const struct option long_opts[] = { + { "all", no_argument, NULL, 'a' }, + { "directories", no_argument, NULL, 'd' }, + { "exports-script", no_argument, NULL, 'E' }, + { "exports", no_argument, NULL, 'e' }, + { NULL, 0, NULL, 0 }, +}; + /* * This command queries the NFS mount daemon for it's mount list and/or * it's exports list and prints them out. @@ -119,7 +128,7 @@ main(int argc, char **argv) const char *host; int ch, estat, nbytes; - while ((ch = getopt(argc, argv, "adEe13")) != -1) + while ((ch = getopt_long(argc, argv, "+adEe13", long_opts, NULL)) != -1) switch (ch) { case 'a': if (type == 0) {