Sync with 4.4lite2

This commit is contained in:
jtc 1995-08-31 22:26:07 +00:00
parent 2c7359091d
commit 3f2b3b5a18
4 changed files with 58 additions and 44 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: lastcomm.c,v 1.6 1994/12/22 01:07:03 jtc Exp $ */
/* $NetBSD: lastcomm.c,v 1.7 1995/08/31 22:31:06 jtc Exp $ */
/*
* Copyright (c) 1980, 1993
@ -41,9 +41,9 @@ static char copyright[] =
#ifndef lint
#if 0
static char sccsid[] = "@(#)lastcomm.c 8.1 (Berkeley) 6/6/93";
static char sccsid[] = "@(#)lastcomm.c 8.2 (Berkeley) 4/29/95";
#endif
static char rcsid[] = "$NetBSD: lastcomm.c,v 1.6 1994/12/22 01:07:03 jtc Exp $";
static char rcsid[] = "$NetBSD: lastcomm.c,v 1.7 1995/08/31 22:31:06 jtc Exp $";
#endif /* not lint */
#include <sys/param.h>
@ -188,13 +188,10 @@ requested(argv, acp)
register char *argv[];
register struct acct *acp;
{
register char *p;
do {
p = user_from_uid(acp->ac_uid, 0);
if (!strcmp(p, *argv))
if (!strcmp(user_from_uid(acp->ac_uid, 0), *argv))
return (1);
if ((p = getdev(acp->ac_tty)) && !strcmp(p, *argv))
if (!strcmp(getdev(acp->ac_tty), *argv))
return (1);
if (!strncmp(acp->ac_comm, *argv, fldsiz(acct, ac_comm)))
return (1);
@ -214,7 +211,8 @@ getdev(dev)
if (dev == lastdev) /* One-element cache. */
return (lastname);
lastdev = dev;
lastname = devname(dev, S_IFCHR);
if ((lastname = devname(dev, S_IFCHR)) == NULL)
lastname = "??";
return (lastname);
}

View File

@ -1,4 +1,4 @@
.\" $NetBSD: leave.1,v 1.4 1994/12/22 01:09:51 jtc Exp $
.\" $NetBSD: leave.1,v 1.5 1995/08/31 22:32:10 jtc Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@ -31,9 +31,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)leave.1 8.2 (Berkeley) 4/18/94
.\" @(#)leave.1 8.3 (Berkeley) 4/28/95
.\"
.Dd April 18, 1994
.Dd April 28, 1995
.Dt LEAVE 1
.Os
.Sh NAME

View File

@ -1,4 +1,4 @@
.\" $NetBSD: showmount.8,v 1.4 1994/12/21 08:48:08 jtc Exp $
.\" $NetBSD: showmount.8,v 1.5 1995/08/31 22:26:07 jtc Exp $
.\"
.\" Copyright (c) 1989, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -34,9 +34,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)showmount.8 8.2 (Berkeley) 12/11/93
.\" @(#)showmount.8 8.3 (Berkeley) 3/29/95
.\"
.Dd December 11, 1993
.Dd March 29, 1995
.Dt SHOWMOUNT 8
.Os BSD 4
.Sh NAME
@ -44,7 +44,7 @@
.Nd show remote nfs mounts on host
.Sh SYNOPSIS
.Nm showmount
.Op Fl ade
.Op Fl ade3
.Op Ar host
.Sh DESCRIPTION
.Nm Showmount
@ -58,7 +58,10 @@ file systems mounted
on the host. See
.%T "NFS: Network File System Protocol Specification" ,
RFC 1094,
Appendix A ,
Appendix A,
and
.%T "NFS: Network File System Version 3 Protocol Specification" ,
Appendix I,
for a detailed description of the protocol.
.Bl -tag -width Ds
.It Fl a
@ -72,6 +75,8 @@ List directory paths of mount points instead of hosts
Show the
.Ar host Ns 's
exports list
.It Fl 3
Use mount protocol Version 3, compatible with NFS Version 3.
.El
.Sh SEE ALSO
.Xr mount 1 ,

View File

@ -1,7 +1,7 @@
/* $NetBSD: showmount.c,v 1.4 1994/12/24 17:38:52 cgd Exp $ */
/* $NetBSD: showmount.c,v 1.5 1995/08/31 22:26:08 jtc Exp $ */
/*
* Copyright (c) 1989, 1993
* Copyright (c) 1989, 1993, 1995
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
@ -38,29 +38,32 @@
#ifndef lint
static char copyright[] =
"@(#) Copyright (c) 1989, 1993\n\
"@(#) Copyright (c) 1989, 1993, 1995\n\
The Regents of the University of California. All rights reserved.\n";
#endif not lint
#ifndef lint
#if 0
static char sccsid[] = "@(#)showmount.c 8.1 (Berkeley) 6/6/93";
static char sccsid[] = "@(#)showmount.c 8.3 (Berkeley) 3/29/95";
#endif
static char rcsid[] = "$NetBSD: showmount.c,v 1.4 1994/12/24 17:38:52 cgd Exp $";
static char rcsid[] = "$NetBSD: showmount.c,v 1.5 1995/08/31 22:26:08 jtc Exp $";
#endif not lint
#include <sys/types.h>
#include <sys/file.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <netdb.h>
#include <rpc/rpc.h>
#include <rpc/pmap_clnt.h>
#include <rpc/pmap_prot.h>
#include <nfs/rpcv2.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
/* Constant defs */
#define ALL 1
@ -90,29 +93,30 @@ struct exportslist {
static struct mountlist *mntdump;
static struct exportslist *exports;
static int type = 0;
int xdr_mntdump(), xdr_exports();
void print_dump __P((struct mountlist *));
void usage __P((void));
int xdr_mntdump __P((XDR *, struct mountlist **));
int xdr_exports __P((XDR *, struct exportslist **));
/*
* This command queries the NFS mount daemon for it's mount list and/or
* it's exports list and prints them out.
* See "NFS: Network File System Protocol Specification, RFC1094, Appendix A"
* and the "Network File System Protocol XXX.."
* for detailed information on the protocol.
*/
int
main(argc, argv)
int argc;
char **argv;
{
register struct mountlist *mntp;
register struct exportslist *exp;
register struct grouplist *grp;
extern char *optarg;
extern int optind;
register int rpcs = 0;
char ch;
char *host;
int estat;
struct exportslist *exp;
struct grouplist *grp;
int estat, rpcs = 0, mntvers = 1;
char ch, *host;
while ((ch = getopt(argc, argv, "ade")) != EOF)
while ((ch = getopt(argc, argv, "ade3")) != EOF)
switch((char)ch) {
case 'a':
if (type == 0) {
@ -131,6 +135,9 @@ main(argc, argv)
case 'e':
rpcs |= DOEXPORTS;
break;
case '3':
mntvers = 3;
break;
case '?':
default:
usage();
@ -147,19 +154,19 @@ main(argc, argv)
rpcs = DODUMP;
if (rpcs & DODUMP)
if ((estat = callrpc(host, RPCPROG_MNT, RPCMNT_VER1,
if ((estat = callrpc(host, RPCPROG_MNT, mntvers,
RPCMNT_DUMP, xdr_void, (char *)0,
xdr_mntdump, (char *)&mntdump)) != 0) {
clnt_perrno(estat);
fprintf(stderr, "Can't do Mountdump rpc\n");
fprintf(stderr, ": Can't do Mountdump rpc\n");
exit(1);
}
if (rpcs & DOEXPORTS)
if ((estat = callrpc(host, RPCPROG_MNT, RPCMNT_VER1,
if ((estat = callrpc(host, RPCPROG_MNT, mntvers,
RPCMNT_EXPORT, xdr_void, (char *)0,
xdr_exports, (char *)&exports)) != 0) {
clnt_perrno(estat);
fprintf(stderr, "Can't do Exports rpc\n");
fprintf(stderr, ": Can't do Exports rpc\n");
exit(1);
}
@ -196,20 +203,20 @@ main(argc, argv)
exp = exp->ex_next;
}
}
exit(0);
}
/*
* Xdr routine for retrieving the mount dump list
*/
int
xdr_mntdump(xdrsp, mlp)
XDR *xdrsp;
struct mountlist **mlp;
{
register struct mountlist *mp;
register struct mountlist *tp;
register struct mountlist **otp;
int val, val2;
int bool;
struct mountlist *mp, **otp, *tp;
int bool, val, val2;
char *strp;
*mlp = (struct mountlist *)0;
@ -282,12 +289,13 @@ next:
/*
* Xdr routine to retrieve exports list
*/
int
xdr_exports(xdrsp, exp)
XDR *xdrsp;
struct exportslist **exp;
{
register struct exportslist *ep;
register struct grouplist *gp;
struct exportslist *ep;
struct grouplist *gp;
int bool, grpbool;
char *strp;
@ -324,8 +332,10 @@ xdr_exports(xdrsp, exp)
return (1);
}
void
usage()
{
fprintf(stderr, "usage: showmount [-ade] host\n");
exit(1);
}
@ -333,6 +343,7 @@ usage()
/*
* Print the binary tree in inorder so that output is sorted.
*/
void
print_dump(mp)
struct mountlist *mp;
{