Browse Source

Kill namespace pollution in getrpcent.c. Silence other rpc warnings
by fixing prototypes. Fix global stuff so it should behave itself
properly now,
-Erik

Eric Andersen 22 years ago
parent
commit
45f1824dc8
4 changed files with 17 additions and 24 deletions
  1. 4 6
      libc/inet/rpc/getrpcent.c
  2. 5 16
      libc/inet/rpc/rcmd.c
  3. 3 2
      libc/inet/rpc/rpc_commondata.c
  4. 5 0
      libc/inet/rpc/rpc_thread.c

+ 4 - 6
libc/inet/rpc/getrpcent.c

@@ -41,11 +41,12 @@
 #include <rpc/rpc.h>
 #include <netdb.h>
 #include <sys/socket.h>
+#include <arpa/inet.h>
 
 /*
  * Internet version.
  */
-struct rpcdata {
+static struct rpcdata {
 	FILE *rpcf;
 	char *current;
 	int currentlen;
@@ -58,12 +59,10 @@ struct rpcdata {
 } *rpcdata;
 
 static struct rpcent *interpret(const char *val, int len);
-struct hostent *gethostent();
-char *inet_ntoa();
 
 static char RPCDB[] = "/etc/rpc";
 
-static struct rpcdata *_rpcdata()
+static struct rpcdata *_rpcdata(void)
 {
 	register struct rpcdata *d = rpcdata;
 
@@ -169,8 +168,7 @@ struct rpcent *getrpcent()
 }
 
 #ifdef __linux__
-static char *firstwhite(s)
-char *s;
+static char *firstwhite(char *s)
 {
 	char *s1, *s2;
 

+ 5 - 16
libc/inet/rpc/rcmd.c

@@ -487,10 +487,7 @@ iruserok2 (raddr, superuser, ruser, luser, rhost)
 }
 
 /* This is the exported version.  */
-int iruserok (raddr, superuser, ruser, luser)
-     u_int32_t raddr;
-     int superuser;
-     const char *ruser, *luser;
+int iruserok (u_int32_t raddr, int superuser, const char * ruser, const char * luser)
 {
 	return iruserok2 (raddr, superuser, ruser, luser, "-");
 }
@@ -508,10 +505,7 @@ int iruserok (raddr, superuser, ruser, luser)
  * Returns 0 if ok, -1 if not ok.
  */
 int
-__ivaliduser(hostf, raddr, luser, ruser)
-	FILE *hostf;
-	u_int32_t raddr;
-	const char *luser, *ruser;
+__ivaliduser(FILE *hostf, u_int32_t raddr, const char *luser, const char *ruser)
 {
 	return __ivaliduser2(hostf, raddr, luser, ruser, "-");
 }
@@ -519,10 +513,7 @@ __ivaliduser(hostf, raddr, luser, ruser)
 
 /* Returns 1 on positive match, 0 on no match, -1 on negative match.  */
 static int
-__icheckhost (raddr, lhost, rhost)
-	u_int32_t raddr;
-	char *lhost;
-	const char *rhost;
+__icheckhost (u_int32_t raddr, char *lhost, const char *rhost)
 {
 	struct hostent *hp;
 	u_int32_t laddr;
@@ -589,8 +580,7 @@ __icheckhost (raddr, lhost, rhost)
 
 /* Returns 1 on positive match, 0 on no match, -1 on negative match.  */
 static int
-__icheckuser (luser, ruser)
-	const char *luser, *ruser;
+__icheckuser (const char *luser, const char *ruser)
 {
 
     /*
@@ -623,8 +613,7 @@ __icheckuser (luser, ruser)
  * Returns 1 for blank lines (or only comment lines) and 0 otherwise
  */
 static int
-__isempty(p)
-	char *p;
+__isempty(char *p)
 {
     while (*p && isspace (*p)) {
 	++p;

+ 3 - 2
libc/inet/rpc/rpc_commondata.c

@@ -27,13 +27,14 @@
  * Mountain View, California  94043
  */
 #include <rpc/rpc.h>
+#include <sys/poll.h>
+#include <sys/select.h>
 
-#ifdef _RPC_THREAD_SAFE_
 #undef svc_fdset
 #undef rpc_createerr
 #undef svc_pollfd
 #undef svc_max_pollfd
-#endif /* _RPC_THREAD_SAFE_ */
+
 
 /*
  * This file should only contain common data (global data) that is exported

+ 5 - 0
libc/inet/rpc/rpc_thread.c

@@ -125,6 +125,11 @@ __rpc_thread_svc_max_pollfd (void)
 }
 #else
 
+#undef svc_fdset
+#undef rpc_createerr
+#undef svc_pollfd
+#undef svc_max_pollfd
+
 fd_set * __rpc_thread_svc_fdset (void)
 {
     extern fd_set svc_fdset;