[Midnightbsd-cvs] src [11422] trunk/usr.bin/showmount/showmount.c: sync with freebsd
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Fri Jul 6 22:40:10 EDT 2018
Revision: 11422
http://svnweb.midnightbsd.org/src/?rev=11422
Author: laffer1
Date: 2018-07-06 22:40:09 -0400 (Fri, 06 Jul 2018)
Log Message:
-----------
sync with freebsd
Modified Paths:
--------------
trunk/usr.bin/showmount/Makefile
trunk/usr.bin/showmount/showmount.8
trunk/usr.bin/showmount/showmount.c
Property Changed:
----------------
trunk/usr.bin/showmount/showmount.8
Modified: trunk/usr.bin/showmount/Makefile
===================================================================
--- trunk/usr.bin/showmount/Makefile 2018-07-07 02:39:35 UTC (rev 11421)
+++ trunk/usr.bin/showmount/Makefile 2018-07-07 02:40:09 UTC (rev 11422)
@@ -1,5 +1,6 @@
+# $MidnightBSD$
# @(#)Makefile 8.1 (Berkeley) 6/6/93
-# $MidnightBSD$
+# $FreeBSD: stable/10/usr.bin/showmount/Makefile 74848 2001-03-27 10:52:19Z ru $
PROG= showmount
MAN= showmount.8
Modified: trunk/usr.bin/showmount/showmount.8
===================================================================
--- trunk/usr.bin/showmount/showmount.8 2018-07-07 02:39:35 UTC (rev 11421)
+++ trunk/usr.bin/showmount/showmount.8 2018-07-07 02:40:09 UTC (rev 11422)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
.\" Copyright (c) 1989, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
@@ -29,9 +30,9 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)showmount.8 8.3 (Berkeley) 3/29/95
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/usr.bin/showmount/showmount.8 308292 2016-11-04 14:06:21Z trasz $
.\"
-.Dd March 29, 1995
+.Dd March 20, 2016
.Dt SHOWMOUNT 8
.Os
.Sh NAME
@@ -40,7 +41,10 @@
.Sh SYNOPSIS
.Nm
.Op Fl a | d
-.Op Fl e3
+.Op Fl E
+.Op Fl e
+.Op Fl 1
+.Op Fl 3
.Op Ar host
.Sh DESCRIPTION
The
@@ -71,14 +75,20 @@
.Ed
.It Fl d
List directory paths of mount points instead of hosts.
+.It Fl E
+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
Show the
.Ar host Ns 's
exports list.
+.It Fl 1
+Use mount protocol Version 1, compatible with legacy servers.
.It Fl 3
-Use mount protocol Version 3, compatible with
-.Tn NFS
-Version 3.
+Ignored for backwards compatibility.
.El
.Sh SEE ALSO
.Xr mount 8 ,
Property changes on: trunk/usr.bin/showmount/showmount.8
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/usr.bin/showmount/showmount.c
===================================================================
--- trunk/usr.bin/showmount/showmount.c 2018-07-07 02:39:35 UTC (rev 11421)
+++ trunk/usr.bin/showmount/showmount.c 2018-07-07 02:40:09 UTC (rev 11422)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 1989, 1993, 1995
* The Regents of the University of California. All rights reserved.
@@ -41,7 +42,7 @@
static char sccsid[] = "@(#)showmount.c 8.3 (Berkeley) 3/29/95";
#endif
static const char rcsid[] =
- "$MidnightBSD$";
+ "$FreeBSD: stable/10/usr.bin/showmount/showmount.c 308292 2016-11-04 14:06:21Z trasz $";
#endif /* not lint */
#include <sys/types.h>
@@ -61,13 +62,15 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <vis.h>
/* Constant defs */
#define ALL 1
#define DIRS 2
-#define DODUMP 0x1
-#define DOEXPORTS 0x2
+#define DODUMP 0x1
+#define DOEXPORTS 0x2
+#define DOPARSABLEEXPORTS 0x4
struct mountlist {
struct mountlist *ml_left;
@@ -108,13 +111,14 @@
int
main(int argc, char **argv)
{
+ char strvised[MNTPATHLEN * 4 + 1];
register struct exportslist *exp;
register struct grouplist *grp;
- register int rpcs = 0, mntvers = 1;
+ register int rpcs = 0, mntvers = 3;
const char *host;
- int ch, estat;
+ int ch, estat, nbytes;
- while ((ch = getopt(argc, argv, "ade3")) != -1)
+ while ((ch = getopt(argc, argv, "adEe13")) != -1)
switch (ch) {
case 'a':
if (type == 0) {
@@ -130,9 +134,15 @@
} else
usage();
break;
+ case 'E':
+ rpcs |= DOPARSABLEEXPORTS;
+ break;
case 'e':
rpcs |= DOEXPORTS;
break;
+ case '1':
+ mntvers = 1;
+ break;
case '3':
mntvers = 3;
break;
@@ -143,6 +153,13 @@
argc -= optind;
argv += optind;
+ if ((rpcs & DOPARSABLEEXPORTS) != 0) {
+ if ((rpcs & DOEXPORTS) != 0)
+ errx(1, "-E cannot be used with -e");
+ if ((rpcs & DODUMP) != 0)
+ errx(1, "-E cannot be used with -a or -d");
+ }
+
if (argc > 0)
host = *argv;
else
@@ -158,7 +175,7 @@
clnt_perrno(estat);
errx(1, "can't do mountdump rpc");
}
- if (rpcs & DOEXPORTS)
+ if (rpcs & (DOEXPORTS | DOPARSABLEEXPORTS))
if ((estat = tcp_callrpc(host, MOUNTPROG, mntvers,
MOUNTPROC_EXPORT, (xdrproc_t)xdr_void, (char *)0,
(xdrproc_t)xdr_exportslist, (char *)&exportslist)) != 0) {
@@ -199,6 +216,17 @@
exp = exp->ex_next;
}
}
+ if (rpcs & DOPARSABLEEXPORTS) {
+ exp = exportslist;
+ while (exp) {
+ nbytes = strsnvis(strvised, sizeof(strvised),
+ exp->ex_dirp, VIS_GLOB | VIS_NL, "\"'$");
+ if (nbytes == -1)
+ err(1, "strsnvis");
+ printf("%s\n", strvised);
+ exp = exp->ex_next;
+ }
+ }
exit(0);
}
More information about the Midnightbsd-cvs
mailing list