[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)
This commit is contained in:
parent
5fa85bcd67
commit
a88611b67b
@ -67,20 +67,20 @@ for a detailed description of the protocol.
|
|||||||
.Pp
|
.Pp
|
||||||
The following options are available:
|
The following options are available:
|
||||||
.Bl -tag -width indent
|
.Bl -tag -width indent
|
||||||
.It Fl a
|
.It Fl a , Fl -all
|
||||||
List all mount points in the form:
|
List all mount points in the form:
|
||||||
.Bd -ragged -offset indent -compact
|
.Bd -ragged -offset indent -compact
|
||||||
.Ar host : Ns Ar dirpath .
|
.Ar host : Ns Ar dirpath .
|
||||||
.Ed
|
.Ed
|
||||||
.It Fl d
|
.It Fl d , Fl -directories
|
||||||
List directory paths of mount points instead of hosts.
|
List directory paths of mount points instead of hosts.
|
||||||
.It Fl E
|
.It Fl E , Fl -exports-script
|
||||||
Show the
|
Show the
|
||||||
.Ar host Ns 's
|
.Ar host Ns 's
|
||||||
exports list in a script-friendly format.
|
exports list in a script-friendly format.
|
||||||
Client addresses and the header are not shown, and special
|
Client addresses and the header are not shown, and special
|
||||||
characters are escaped.
|
characters are escaped.
|
||||||
.It Fl e
|
.It Fl e , Fl -exports
|
||||||
Show the
|
Show the
|
||||||
.Ar host Ns 's
|
.Ar host Ns 's
|
||||||
exports list.
|
exports list.
|
||||||
|
@ -53,6 +53,7 @@ static const char rcsid[] =
|
|||||||
#include <sys/socketvar.h>
|
#include <sys/socketvar.h>
|
||||||
|
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
|
#include <getopt.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <rpc/rpc.h>
|
#include <rpc/rpc.h>
|
||||||
#include <rpc/pmap_clnt.h>
|
#include <rpc/pmap_clnt.h>
|
||||||
@ -102,6 +103,14 @@ int xdr_exportslist(XDR *, struct exportslist **);
|
|||||||
int tcp_callrpc(const char *host, int prognum, int versnum, int procnum,
|
int tcp_callrpc(const char *host, int prognum, int versnum, int procnum,
|
||||||
xdrproc_t inproc, char *in, xdrproc_t outproc, char *out);
|
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
|
* This command queries the NFS mount daemon for it's mount list and/or
|
||||||
* it's exports list and prints them out.
|
* it's exports list and prints them out.
|
||||||
@ -119,7 +128,7 @@ main(int argc, char **argv)
|
|||||||
const char *host;
|
const char *host;
|
||||||
int ch, estat, nbytes;
|
int ch, estat, nbytes;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "adEe13")) != -1)
|
while ((ch = getopt_long(argc, argv, "+adEe13", long_opts, NULL)) != -1)
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'a':
|
case 'a':
|
||||||
if (type == 0) {
|
if (type == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user