CVS commit: src/usr.bin/rpcinfo

2013-08-21 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Wed Aug 21 21:05:29 UTC 2013

Modified Files:
src/usr.bin/rpcinfo: Makefile

Log Message:
passes WARNS=5, don't set it to 4.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/rpcinfo/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/rpcinfo/Makefile
diff -u src/usr.bin/rpcinfo/Makefile:1.14 src/usr.bin/rpcinfo/Makefile:1.15
--- src/usr.bin/rpcinfo/Makefile:1.14	Tue Feb  8 22:16:58 2011
+++ src/usr.bin/rpcinfo/Makefile	Wed Aug 21 21:05:29 2013
@@ -1,8 +1,6 @@
-#	$NetBSD: Makefile,v 1.14 2011/02/08 22:16:58 christos Exp $
+#	$NetBSD: Makefile,v 1.15 2013/08/21 21:05:29 dholland Exp $
 #	from: @(#)Makefile	5.2 (Berkeley) 5/11/90
 
-WARNS ?= 4
-
 .include bsd.own.mk
 
 USE_FORT?= yes	# network client



CVS commit: src/usr.bin/rpcinfo

2013-05-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May 24 23:09:45 UTC 2013

Modified Files:
src/usr.bin/rpcinfo: rpcinfo.c

Log Message:
0 == local


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/usr.bin/rpcinfo/rpcinfo.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/rpcinfo/rpcinfo.c
diff -u src/usr.bin/rpcinfo/rpcinfo.c:1.36 src/usr.bin/rpcinfo/rpcinfo.c:1.37
--- src/usr.bin/rpcinfo/rpcinfo.c:1.36	Tue May  7 20:34:50 2013
+++ src/usr.bin/rpcinfo/rpcinfo.c	Fri May 24 19:09:45 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpcinfo.c,v 1.36 2013/05/08 00:34:50 christos Exp $	*/
+/*	$NetBSD: rpcinfo.c,v 1.37 2013/05/24 23:09:45 christos Exp $	*/
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -538,6 +538,8 @@ pmapdump(int argc, char **argv)
 (void)printf(%6s, udp);
 			else if (head-pml_map.pm_prot == IPPROTO_TCP)
 (void)printf(%6s, tcp);
+			else if (head-pml_map.pm_prot == 0)
+(void)printf(%6s, local);
 			else
 (void)printf(%6ld, head-pml_map.pm_prot);
 			(void)printf(%7ld, head-pml_map.pm_port);



CVS commit: src/usr.bin/rpcinfo

2013-05-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue May  7 21:41:52 UTC 2013

Modified Files:
src/usr.bin/rpcinfo: rpcinfo.c

Log Message:
print the port where the server is listening when displaying status.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/usr.bin/rpcinfo/rpcinfo.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/rpcinfo/rpcinfo.c
diff -u src/usr.bin/rpcinfo/rpcinfo.c:1.34 src/usr.bin/rpcinfo/rpcinfo.c:1.35
--- src/usr.bin/rpcinfo/rpcinfo.c:1.34	Fri Sep 16 11:39:28 2011
+++ src/usr.bin/rpcinfo/rpcinfo.c	Tue May  7 17:41:51 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpcinfo.c,v 1.34 2011/09/16 15:39:28 joerg Exp $	*/
+/*	$NetBSD: rpcinfo.c,v 1.35 2013/05/07 21:41:51 christos Exp $	*/
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -141,12 +141,12 @@ __dead static void	brdcst(int, char **);
 static void	addrping(const char *, const char *, int, char **);
 static void	progping(const char *, int, char **);
 static CLIENT	*clnt_addr_create(const char *, const struct netconfig *,
-rpcprog_t, rpcvers_t);
+rpcprog_t, rpcvers_t, in_port_t *);
 static CLIENT   *clnt_rpcbind_create(const char *, rpcvers_t, struct netbuf **);
 static CLIENT   *getclnthandle(const char *, const struct netconfig *,
 rpcvers_t, struct netbuf **);
 static CLIENT	*local_rpcb(rpcprog_t, rpcvers_t);
-static int	pstatus(CLIENT *, rpcprog_t, rpcvers_t);
+static int	pstatus(CLIENT *, rpcprog_t, rpcvers_t, in_port_t);
 static void	rpcbdump(int, const char *, int, char **);
 static void	rpcbgetstat(int, char **);
 static void	rpcbaddrlist(const char *, int, char **);
@@ -156,6 +156,7 @@ static void	print_getaddrstat(int, const
 static void	usage(void) __dead;
 static rpcprog_t	getprognum(const char *);
 static rpcvers_t	getvers(const char *);
+static in_port_t	getport(const struct netbuf *);
 static const char *spaces(size_t);
 static bool_t	add_version(struct rpcbdump_short *, rpcvers_t);
 static bool_t	add_netid(struct rpcbdump_short *, char *);
@@ -401,7 +402,7 @@ ip_ping(u_short portnum, const char *tra
 	NULL, (xdrproc_t)xdr_void, NULL, to);
 	if (argc != 2) {
 		/* Version number was known */
-		if (pstatus(client, prognum, vers)  0)
+		if (pstatus(client, prognum, vers, portnum)  0)
 			exit(1);
 		(void)CLNT_DESTROY(client);
 		return;
@@ -437,11 +438,11 @@ ip_ping(u_short portnum, const char *tra
 			minvers = 0;
 			maxvers = MAX_VERS;
 		} else {
-			(void)pstatus(client, prognum, MAX_VERS);
+			(void)pstatus(client, prognum, MAX_VERS, portnum);
 			exit(1);
 		}
 	} else {
-		(void)pstatus(client, prognum, MIN_VERS);
+		(void)pstatus(client, prognum, MIN_VERS, portnum);
 		exit(1);
 	}
 	(void)CLNT_DESTROY(client);
@@ -450,7 +451,7 @@ ip_ping(u_short portnum, const char *tra
 		client = clnt_com_create(addr, prognum, vers, fd, trans);
 		rpc_stat = CLNT_CALL(client, NULLPROC, (xdrproc_t)xdr_void,
 		NULL, (xdrproc_t)xdr_void, NULL, to);
-		if (pstatus(client, prognum, vers)  0)
+		if (pstatus(client, prognum, vers, portnum)  0)
 		failure = 1;
 		(void)CLNT_DESTROY(client);
 	}
@@ -1249,7 +1250,7 @@ deletereg(const char *netid, int argc, c
  */
 static CLIENT *
 clnt_addr_create(const char *address, const struct netconfig *nconf,
-rpcprog_t prog, rpcvers_t vers)
+rpcprog_t prog, rpcvers_t vers, in_port_t *port)
 {
 	CLIENT *client;
 	static struct netbuf *nbuf;
@@ -1265,6 +1266,7 @@ clnt_addr_create(const char *address, co
 		nbuf = uaddr2taddr(nconf, address);
 		if (nbuf == NULL)
 			errx(1, No address for client handle);
+		*port = getport(nbuf);
 	}
 	client = clnt_tli_create(fd, nconf, nbuf, prog, vers, 0, 0);
 	if (client == NULL) {
@@ -1290,6 +1292,7 @@ addrping(const char *address, const char
 	struct rpc_err rpcerr;
 	int failure = 0;
 	struct netconfig *nconf;
+	in_port_t portnum;
 	int fd;
 
 	if (argc  1 || argc  2 || (netid == NULL))
@@ -1309,12 +1312,12 @@ addrping(const char *address, const char
 	} else {
 		versnum = getvers(argv[1]);
 	}
-	client = clnt_addr_create(address, nconf, prognum, versnum);
+	client = clnt_addr_create(address, nconf, prognum, versnum, portnum);
 	rpc_stat = CLNT_CALL(client, NULLPROC, (xdrproc_t)xdr_void,
 	NULL, (xdrproc_t)xdr_void, NULL, to);
 	if (argc == 2) {
 		/* Version number was known */
-		if (pstatus(client, prognum, versnum)  0)
+		if (pstatus(client, prognum, versnum, portnum)  0)
 			failure = 1;
 		(void)CLNT_DESTROY(client);
 		if (failure)
@@ -1334,7 +1337,8 @@ addrping(const char *address, const char
 		 * Let's try version MAX_VERS.
 		 */
 		(void)CLNT_DESTROY(client);
-		client = clnt_addr_create(address, nconf, prognum, MAX_VERS);
+		client = clnt_addr_create(address, nconf, prognum, MAX_VERS,
+		portnum);
 		rpc_stat = CLNT_CALL(client, NULLPROC, (xdrproc_t)xdr_void,
 		NULL, (xdrproc_t)xdr_void, NULL, to);
 		if (rpc_stat == RPC_PROGVERSMISMATCH) 

CVS commit: src/usr.bin/rpcinfo

2013-05-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May  8 00:34:50 UTC 2013

Modified Files:
src/usr.bin/rpcinfo: rpcinfo.c

Log Message:
Simplify previous: instead of polluting the whole code with extra arguments
and dealing with byteorder, do the whole thing in where we need it.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/usr.bin/rpcinfo/rpcinfo.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/rpcinfo/rpcinfo.c
diff -u src/usr.bin/rpcinfo/rpcinfo.c:1.35 src/usr.bin/rpcinfo/rpcinfo.c:1.36
--- src/usr.bin/rpcinfo/rpcinfo.c:1.35	Tue May  7 17:41:51 2013
+++ src/usr.bin/rpcinfo/rpcinfo.c	Tue May  7 20:34:50 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpcinfo.c,v 1.35 2013/05/07 21:41:51 christos Exp $	*/
+/*	$NetBSD: rpcinfo.c,v 1.36 2013/05/08 00:34:50 christos Exp $	*/
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -141,12 +141,12 @@ __dead static void	brdcst(int, char **);
 static void	addrping(const char *, const char *, int, char **);
 static void	progping(const char *, int, char **);
 static CLIENT	*clnt_addr_create(const char *, const struct netconfig *,
-rpcprog_t, rpcvers_t, in_port_t *);
+rpcprog_t, rpcvers_t);
 static CLIENT   *clnt_rpcbind_create(const char *, rpcvers_t, struct netbuf **);
 static CLIENT   *getclnthandle(const char *, const struct netconfig *,
 rpcvers_t, struct netbuf **);
 static CLIENT	*local_rpcb(rpcprog_t, rpcvers_t);
-static int	pstatus(CLIENT *, rpcprog_t, rpcvers_t, in_port_t);
+static int	pstatus(CLIENT *, rpcprog_t, rpcvers_t);
 static void	rpcbdump(int, const char *, int, char **);
 static void	rpcbgetstat(int, char **);
 static void	rpcbaddrlist(const char *, int, char **);
@@ -156,7 +156,6 @@ static void	print_getaddrstat(int, const
 static void	usage(void) __dead;
 static rpcprog_t	getprognum(const char *);
 static rpcvers_t	getvers(const char *);
-static in_port_t	getport(const struct netbuf *);
 static const char *spaces(size_t);
 static bool_t	add_version(struct rpcbdump_short *, rpcvers_t);
 static bool_t	add_netid(struct rpcbdump_short *, char *);
@@ -402,7 +401,7 @@ ip_ping(u_short portnum, const char *tra
 	NULL, (xdrproc_t)xdr_void, NULL, to);
 	if (argc != 2) {
 		/* Version number was known */
-		if (pstatus(client, prognum, vers, portnum)  0)
+		if (pstatus(client, prognum, vers)  0)
 			exit(1);
 		(void)CLNT_DESTROY(client);
 		return;
@@ -438,11 +437,11 @@ ip_ping(u_short portnum, const char *tra
 			minvers = 0;
 			maxvers = MAX_VERS;
 		} else {
-			(void)pstatus(client, prognum, MAX_VERS, portnum);
+			(void)pstatus(client, prognum, MAX_VERS);
 			exit(1);
 		}
 	} else {
-		(void)pstatus(client, prognum, MIN_VERS, portnum);
+		(void)pstatus(client, prognum, MIN_VERS);
 		exit(1);
 	}
 	(void)CLNT_DESTROY(client);
@@ -451,7 +450,7 @@ ip_ping(u_short portnum, const char *tra
 		client = clnt_com_create(addr, prognum, vers, fd, trans);
 		rpc_stat = CLNT_CALL(client, NULLPROC, (xdrproc_t)xdr_void,
 		NULL, (xdrproc_t)xdr_void, NULL, to);
-		if (pstatus(client, prognum, vers, portnum)  0)
+		if (pstatus(client, prognum, vers)  0)
 		failure = 1;
 		(void)CLNT_DESTROY(client);
 	}
@@ -1250,7 +1249,7 @@ deletereg(const char *netid, int argc, c
  */
 static CLIENT *
 clnt_addr_create(const char *address, const struct netconfig *nconf,
-rpcprog_t prog, rpcvers_t vers, in_port_t *port)
+rpcprog_t prog, rpcvers_t vers)
 {
 	CLIENT *client;
 	static struct netbuf *nbuf;
@@ -1266,7 +1265,6 @@ clnt_addr_create(const char *address, co
 		nbuf = uaddr2taddr(nconf, address);
 		if (nbuf == NULL)
 			errx(1, No address for client handle);
-		*port = getport(nbuf);
 	}
 	client = clnt_tli_create(fd, nconf, nbuf, prog, vers, 0, 0);
 	if (client == NULL) {
@@ -1292,7 +1290,6 @@ addrping(const char *address, const char
 	struct rpc_err rpcerr;
 	int failure = 0;
 	struct netconfig *nconf;
-	in_port_t portnum;
 	int fd;
 
 	if (argc  1 || argc  2 || (netid == NULL))
@@ -1312,12 +1309,12 @@ addrping(const char *address, const char
 	} else {
 		versnum = getvers(argv[1]);
 	}
-	client = clnt_addr_create(address, nconf, prognum, versnum, portnum);
+	client = clnt_addr_create(address, nconf, prognum, versnum);
 	rpc_stat = CLNT_CALL(client, NULLPROC, (xdrproc_t)xdr_void,
 	NULL, (xdrproc_t)xdr_void, NULL, to);
 	if (argc == 2) {
 		/* Version number was known */
-		if (pstatus(client, prognum, versnum, portnum)  0)
+		if (pstatus(client, prognum, versnum)  0)
 			failure = 1;
 		(void)CLNT_DESTROY(client);
 		if (failure)
@@ -1337,8 +1334,7 @@ addrping(const char *address, const char
 		 * Let's try version MAX_VERS.
 		 */
 		(void)CLNT_DESTROY(client);
-		client = clnt_addr_create(address, nconf, prognum, MAX_VERS,
-		portnum);
+		client = clnt_addr_create(address, nconf, prognum, MAX_VERS);
 		rpc_stat = CLNT_CALL(client, NULLPROC, (xdrproc_t)xdr_void,
 		

CVS commit: src/usr.bin/rpcinfo

2012-05-13 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun May 13 15:50:41 UTC 2012

Modified Files:
src/usr.bin/rpcinfo: rpcinfo.8

Log Message:
Full list of changes:
- remove spurious white space;
- punctuation;
- new sentence, new line;
- decapitalization;
- for the non-superuser example command lines, use a consistent
  shell prompt character.

From Bug Hunting.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/rpcinfo/rpcinfo.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/rpcinfo/rpcinfo.8
diff -u src/usr.bin/rpcinfo/rpcinfo.8:1.14 src/usr.bin/rpcinfo/rpcinfo.8:1.15
--- src/usr.bin/rpcinfo/rpcinfo.8:1.14	Wed Apr  8 13:28:16 2009
+++ src/usr.bin/rpcinfo/rpcinfo.8	Sun May 13 15:50:41 2012
@@ -1,7 +1,7 @@
 .\ @(#)rpcinfo.1m 1.23 93/03/29 SMI; from SVr4
 .\ Copyright 1989 ATT
 .\ Copyright 1991 Sun Microsystems, Inc.
-.\ $NetBSD: rpcinfo.8,v 1.14 2009/04/08 13:28:16 joerg Exp $
+.\ $NetBSD: rpcinfo.8,v 1.15 2012/05/13 15:50:41 wiz Exp $
 .Dd August 18, 1992
 .Dt RPCINFO 8
 .Os
@@ -112,8 +112,7 @@ if it does exist,
 attempts to obtain this information by calling
 an extremely high version number instead,
 and attempts to call each registered version.
-Note:
-the version number is required for
+Note: the version number is required for the
 .Fl b
 and
 .Fl d
@@ -211,10 +210,11 @@ operations on the given
 .Ar host .
 The table shows statistics for each version of
 .Nm rpcbind
-(versions 2, 3 and 4), giving the number of times each procedure was
+(versions 2, 3, and 4), giving the number of times each procedure was
 requested and successfully serviced, the number and type of remote call
 requests that were made, and information about RPC address lookups that were
-handled. This is useful for monitoring RPC activities on
+handled.
+This is useful for monitoring RPC activities on
 .Ar host .
 .Pp
 .It Fl n Ar portnum
@@ -228,8 +228,8 @@ options instead of the port number given
 .Nm rpcbind .
 Use of this option avoids a call to the remote
 .Nm rpcbind
-to find out the address of the service. This option is made
-obsolete by the
+to find out the address of the service.
+This option is made obsolete by the
 .Fl a
 option.
 .Pp
@@ -245,7 +245,7 @@ and display a list of all registered RPC
 If
 .Ar host
 is not specified, it defaults to the local host.
-Note: Version 2 of the
+Note: version 2 of the
 .Nm rpcbind
 protocol was previously known as the portmapper protocol.
 .Pp
@@ -262,8 +262,8 @@ Make an RPC call to procedure 0 of
 on the specified
 .Ar host
 using TCP,
-and report whether a response was received. This option is made
-obsolete by the
+and report whether a response was received.
+This option is made obsolete by the
 .Fl T
 option as shown in the third synopsis.
 .Pp
@@ -273,8 +273,8 @@ Make an RPC call to procedure 0 of
 on the specified
 .Ar host
 using UDP,
-and report whether a response was received. This option is made
-obsolete by the
+and report whether a response was received.
+This option is made obsolete by the
 .Fl T
 option as shown in the third synopsis.
 .El
@@ -302,7 +302,7 @@ Use the
 option to display a more concise list:
 .Pp
 .Bd -literal
-	example$ rpcinfo -s klaxon
+	example% rpcinfo -s klaxon
 .Ed
 .Bl -column program version(s) local,tcp,udp,tcp6,udp6 nlockmgr super-user
 .It program Ta version(s) Ta netid(s) Ta service Ta owner
@@ -339,7 +339,7 @@ protocol on the local machine use:
 To delete the registration for version
 1 of the
 .Nm walld
-(program number 18 )
+(program number 18)
 service for all transports use:
 .Bd -literal
 	example# rpcinfo -d 18 1



CVS commit: src/usr.bin/rpcinfo

2011-05-24 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue May 24 12:42:25 UTC 2011

Modified Files:
src/usr.bin/rpcinfo: rpcinfo.c

Log Message:
Fix usage() to actually not return


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/rpcinfo/rpcinfo.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/rpcinfo/rpcinfo.c
diff -u src/usr.bin/rpcinfo/rpcinfo.c:1.32 src/usr.bin/rpcinfo/rpcinfo.c:1.33
--- src/usr.bin/rpcinfo/rpcinfo.c:1.32	Thu Feb 10 00:05:52 2011
+++ src/usr.bin/rpcinfo/rpcinfo.c	Tue May 24 12:42:25 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpcinfo.c,v 1.32 2011/02/10 00:05:52 christos Exp $	*/
+/*	$NetBSD: rpcinfo.c,v 1.33 2011/05/24 12:42:25 joerg Exp $	*/
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -153,7 +153,7 @@
 static void	deletereg(const char *, int, char **);
 static void	print_rmtcallstat(int, const rpcb_stat *);
 static void	print_getaddrstat(int, const rpcb_stat *);
-static void	usage(void)__attribute__((__noreturn__));
+static void	usage(void) __dead;
 static rpcprog_t	getprognum(const char *);
 static rpcvers_t	getvers(const char *);
 static const char *spaces(size_t);
@@ -1499,6 +1499,7 @@
 	(void)fprintf(stderr, \t%s -b prognum versnum\n, getprogname());
 	(void)fprintf(stderr, \t%s -d [-T netid] prognum versnum\n,
 	getprogname());
+	exit(0);
 }
 
 static rpcprog_t



CVS commit: src/usr.bin/rpcinfo

2011-02-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 10 00:05:52 UTC 2011

Modified Files:
src/usr.bin/rpcinfo: rpcinfo.c

Log Message:
simplify


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/usr.bin/rpcinfo/rpcinfo.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/rpcinfo/rpcinfo.c
diff -u src/usr.bin/rpcinfo/rpcinfo.c:1.31 src/usr.bin/rpcinfo/rpcinfo.c:1.32
--- src/usr.bin/rpcinfo/rpcinfo.c:1.31	Wed Feb  9 01:26:48 2011
+++ src/usr.bin/rpcinfo/rpcinfo.c	Wed Feb  9 19:05:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpcinfo.c,v 1.31 2011/02/09 06:26:48 dholland Exp $	*/
+/*	$NetBSD: rpcinfo.c,v 1.32 2011/02/10 00:05:52 christos Exp $	*/
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -1530,15 +1530,13 @@
 getvers(const char *arg)
 {
 	char *strptr;
-	rpcvers_t vers;
-	unsigned long ulvers;
+	u_long vers;
 
-	ulvers = strtoul(arg, strptr, 0);
+	vers = strtoul(arg, strptr, 0);
 	if (strptr == arg || *strptr != '\0' ||
-	(ulvers == ULONG_MAX  errno == ERANGE))
+	(vers == ULONG_MAX  errno == ERANGE))
 		errx(1, Illegal version number `%s', arg);
-	vers = (rpcvers_t)ulvers;
-	return vers;
+	return (rpcvers_t)vers;
 }
 
 /*



CVS commit: src/usr.bin/rpcinfo

2011-02-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Feb  8 22:16:59 UTC 2011

Modified Files:
src/usr.bin/rpcinfo: Makefile rpcinfo.c

Log Message:
- WARNS ?= 4
- fix memory leaks
- fix error printing
- pass lint
- KNF
- constify
- ansify


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/rpcinfo/Makefile
cvs rdiff -u -r1.29 -r1.30 src/usr.bin/rpcinfo/rpcinfo.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/rpcinfo/Makefile
diff -u src/usr.bin/rpcinfo/Makefile:1.13 src/usr.bin/rpcinfo/Makefile:1.14
--- src/usr.bin/rpcinfo/Makefile:1.13	Tue Apr 14 18:15:25 2009
+++ src/usr.bin/rpcinfo/Makefile	Tue Feb  8 17:16:58 2011
@@ -1,7 +1,7 @@
-#	$NetBSD: Makefile,v 1.13 2009/04/14 22:15:25 lukem Exp $
+#	$NetBSD: Makefile,v 1.14 2011/02/08 22:16:58 christos Exp $
 #	from: @(#)Makefile	5.2 (Berkeley) 5/11/90
 
-WARNS?=	2	# XXX -Wcast-qual issues
+WARNS ?= 4
 
 .include bsd.own.mk
 

Index: src/usr.bin/rpcinfo/rpcinfo.c
diff -u src/usr.bin/rpcinfo/rpcinfo.c:1.29 src/usr.bin/rpcinfo/rpcinfo.c:1.30
--- src/usr.bin/rpcinfo/rpcinfo.c:1.29	Tue Nov 17 13:31:13 2009
+++ src/usr.bin/rpcinfo/rpcinfo.c	Tue Feb  8 17:16:58 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpcinfo.c,v 1.29 2009/11/17 18:31:13 drochner Exp $	*/
+/*	$NetBSD: rpcinfo.c,v 1.30 2011/02/08 22:16:58 christos Exp $	*/
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -73,6 +73,7 @@
 #include unistd.h
 #include err.h
 #include ctype.h
+#include errno.h
 
 #ifdef PORTMAP		/* Support for version 2 portmapper */
 #include netinet/in.h
@@ -82,9 +83,14 @@
 #include rpc/pmap_clnt.h
 #endif
 
-#define	MIN_VERS	((u_long)0)
-#define	MAX_VERS	((u_long)4294967295UL)
-#define	UNKNOWN		unknown
+#define	MIN_VERS	((rpcvers_t)0)
+#define	MAX_VERS	((rpcvers_t)4294967295UL)
+#define PMAP_PROG	((rpcprog_t)PMAPPROG)
+#define PMAP_VERS	((rpcvers_t)PMAPVERS)
+#define RPCB_VERS	((rpcvers_t)RPCBVERS)
+#define RPCB_VERS4	((rpcvers_t)RPCB_VERS)
+#define UL(a)		((unsigned long)a)
+static char unknown[] = unknown;
 
 /*
  * Functions to be performed.
@@ -113,7 +119,7 @@
 };
 
 struct rpcbdump_short {
-	u_long prog;
+	rpcprog_t prog;
 	struct verslist *vlist;
 	struct netidlist *nlist;
 	struct rpcbdump_short *next;
@@ -124,41 +130,40 @@
 
 #ifdef PORTMAP
 static void	ip_ping(u_short, const char *, int, char **);
-static CLIENT	*clnt_com_create(struct sockaddr_in *, u_long, u_long, int *,
- const char *);
+static CLIENT	*clnt_com_create(struct sockaddr_in *, rpcprog_t, rpcvers_t,
+int *, const char *);
 static void	pmapdump(int, char **);
 static void	get_inet_address(struct sockaddr_in *, const char *);
 #endif
 
 static bool_t	reply_proc(void *, struct netbuf *, struct netconfig *);
 static void	brdcst(int, char **);
-static void	addrping(char *, char *, int, char **);
-static void	progping(char *, int, char **);
-static CLIENT	*clnt_addr_create(char *, struct netconfig *, u_long, u_long);
-static CLIENT   *clnt_rpcbind_create(char *, int, struct netbuf **);
-static CLIENT   *getclnthandle(char *, struct netconfig *, u_long,
-			   struct netbuf **);
-static CLIENT	*local_rpcb(u_long, u_long);
-static int	pstatus(CLIENT *, u_long, u_long);
-static void	rpcbdump(int, char *, int, char **);
+static void	addrping(const char *, const char *, int, char **);
+static void	progping(const char *, int, char **);
+static CLIENT	*clnt_addr_create(const char *, const struct netconfig *,
+rpcprog_t, rpcvers_t);
+static CLIENT   *clnt_rpcbind_create(const char *, rpcvers_t, struct netbuf **);
+static CLIENT   *getclnthandle(const char *, const struct netconfig *,
+rpcvers_t, struct netbuf **);
+static CLIENT	*local_rpcb(rpcprog_t, rpcvers_t);
+static int	pstatus(CLIENT *, rpcprog_t, rpcvers_t);
+static void	rpcbdump(int, const char *, int, char **);
 static void	rpcbgetstat(int, char **);
-static void	rpcbaddrlist(char *, int, char **);
-static void	deletereg(char *, int, char **);
-static void	print_rmtcallstat(int, rpcb_stat *);
-static void	print_getaddrstat(int, rpcb_stat *);
-static void	usage(void);
-static u_long	getprognum(char *);
-static u_long	getvers(char *);
-static char	*spaces(int);
-static bool_t	add_version(struct rpcbdump_short *, u_long);
+static void	rpcbaddrlist(const char *, int, char **);
+static void	deletereg(const char *, int, char **);
+static void	print_rmtcallstat(int, const rpcb_stat *);
+static void	print_getaddrstat(int, const rpcb_stat *);
+static void	usage(void)__attribute__((__noreturn__));
+static rpcprog_t	getprognum(const char *);
+static rpcvers_t	getvers(const char *);
+static const char *spaces(size_t);
+static bool_t	add_version(struct rpcbdump_short *, rpcvers_t);
 static bool_t	add_netid(struct rpcbdump_short *, char *);
 
-int		main(int argc, char **argv);
-
 int
 main(int argc, char **argv)
 {
-	register int c;
+	int c;
 	int errflg;
 	int function;
 	char *netid = NULL;

CVS commit: src/usr.bin/rpcinfo

2011-02-08 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Wed Feb  9 06:26:48 UTC 2011

Modified Files:
src/usr.bin/rpcinfo: rpcinfo.c

Log Message:
Fix broken build (hi Christos!)


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/usr.bin/rpcinfo/rpcinfo.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/rpcinfo/rpcinfo.c
diff -u src/usr.bin/rpcinfo/rpcinfo.c:1.30 src/usr.bin/rpcinfo/rpcinfo.c:1.31
--- src/usr.bin/rpcinfo/rpcinfo.c:1.30	Tue Feb  8 22:16:58 2011
+++ src/usr.bin/rpcinfo/rpcinfo.c	Wed Feb  9 06:26:48 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpcinfo.c,v 1.30 2011/02/08 22:16:58 christos Exp $	*/
+/*	$NetBSD: rpcinfo.c,v 1.31 2011/02/09 06:26:48 dholland Exp $	*/
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -114,7 +114,7 @@
 };
 
 struct verslist {
-	int vers;
+	rpcvers_t vers;
 	struct verslist *next;
 };
 
@@ -843,7 +843,7 @@
 			(void)printf(%10lu  , (unsigned long)rs-prog);
 			for (vl = rs-vlist; vl; vl = vl-next) {
 (void)snprintf(q, sizeof(buf) - (q - buf),
-%d, vl-vers);
+%lu, (unsigned long)vl-vers);
 q = q + strlen(q);
 if (vl-next) {
 	(void)snprintf(q,
@@ -1531,12 +1531,14 @@
 {
 	char *strptr;
 	rpcvers_t vers;
+	unsigned long ulvers;
 
-	vers = strtoul(arg, strptr, 0);
+	ulvers = strtoul(arg, strptr, 0);
 	if (strptr == arg || *strptr != '\0' ||
-	(vers == ULONG_MAX  errno == ERANGE))
+	(ulvers == ULONG_MAX  errno == ERANGE))
 		errx(1, Illegal version number `%s', arg);
-	return (rpcvers_t)vers;
+	vers = (rpcvers_t)ulvers;
+	return vers;
 }
 
 /*