From 0f2cb9b020b907000a28323fc57a82fdb7d6626d Mon Sep 17 00:00:00 2001 From: des Date: Wed, 6 Feb 2002 13:30:31 +0000 Subject: Apply the following mechanical transformations in preparation for ansification and constification: s{\s+__P\((\(.*?\))\)}{$1}g; s{\(\s+}{\(}g; s{\s+\)}{\)}g; s{\s+,}{,}g; s{(\s+)(for|if|switch|while)\(}{$1$2 \(}g; s{return ([^\(].*?);}{return ($1);}g; s{([\w\)])([!=+/\*-]?=)([\w\(+-])}{$1 $2 $3}g; s{\s+$}{\n};g Also add $FreeBSD$ where needed. MFC after: 1 week --- usr.sbin/ypserv/yp_access.c | 10 ++++---- usr.sbin/ypserv/yp_dblookup.c | 12 +++++----- usr.sbin/ypserv/yp_dnslookup.c | 10 ++++---- usr.sbin/ypserv/yp_extern.h | 54 +++++++++++++++++++++--------------------- usr.sbin/ypserv/yp_main.c | 8 +++---- usr.sbin/ypserv/yp_server.c | 12 +++++----- 6 files changed, 53 insertions(+), 53 deletions(-) (limited to 'usr.sbin/ypserv') diff --git a/usr.sbin/ypserv/yp_access.c b/usr.sbin/ypserv/yp_access.c index cdf3e50..610f209 100644 --- a/usr.sbin/ypserv/yp_access.c +++ b/usr.sbin/ypserv/yp_access.c @@ -74,7 +74,7 @@ char *yp_procs[] = { "ypoldproc_null", "badproc3", /* placeholder */ /* NIS v2 */ - "ypproc_null" , + "ypproc_null", "ypproc_domain", "ypproc_domain_nonack", "ypproc_match", @@ -121,7 +121,7 @@ void load_securenets() * the list; free the existing list before re-reading the * securenets file. */ - while(securenets) { + while (securenets) { tmp = securenets->next; free(securenets); securenets = tmp; @@ -144,7 +144,7 @@ void load_securenets() securenets = NULL; - while(fgets(linebuf, LINEBUFSZ, fp)) { + while (fgets(linebuf, LINEBUFSZ, fp)) { char addr1[20], addr2[20]; if ((linebuf[0] == '#') @@ -175,7 +175,7 @@ void load_securenets() } fclose(fp); - + } #endif @@ -280,7 +280,7 @@ not privileged", map, inet_ntoa(rqhost->sin_addr), ntohs(rqhost->sin_port)); inet_ntoa(rqhost->sin_addr), ""); #else tmp = securenets; - while(tmp) { + while (tmp) { if (((rqhost->sin_addr.s_addr & ~tmp->mask.s_addr) | tmp->net.s_addr) == rqhost->sin_addr.s_addr) { status = 1; diff --git a/usr.sbin/ypserv/yp_dblookup.c b/usr.sbin/ypserv/yp_dblookup.c index b3215f9..984736b 100644 --- a/usr.sbin/ypserv/yp_dblookup.c +++ b/usr.sbin/ypserv/yp_dblookup.c @@ -181,10 +181,10 @@ void yp_flush_all() { register struct circleq_entry *qptr; - while(!TAILQ_EMPTY(&qhead)) { + while (!TAILQ_EMPTY(&qhead)) { qptr = TAILQ_FIRST(&qhead); /* save this */ TAILQ_REMOVE(&qhead, qptr, links); - yp_free_qent(qptr); + yp_free_qent(qptr); } numdbs = 0; @@ -415,7 +415,7 @@ again: dbp = dbopen(buf,O_RDONLY, PERM_SECURE, DB_HASH, NULL); if (dbp == NULL) { - switch(errno) { + switch (errno) { #ifdef DB_CACHE case ENFILE: /* @@ -449,7 +449,7 @@ again: * to match against. * * - yp_first_record(): retrieve first key/data base in a database. - * + * * - yp_next_record(): retrieve key/data pair that sequentially follows * the supplied key value in the database. */ @@ -542,7 +542,7 @@ int yp_first_record(dbp,key,data,allow) #endif if (rval == 1) return(YP_NOKEY); - else + else return(YP_BADDB); } @@ -623,7 +623,7 @@ int yp_next_record(dbp,key,data,all,allow) return(YP_NOKEY); } -#ifdef DB_CACHE +#ifdef DB_CACHE } #endif } diff --git a/usr.sbin/ypserv/yp_dnslookup.c b/usr.sbin/ypserv/yp_dnslookup.c index fdbac25..0abffcd 100644 --- a/usr.sbin/ypserv/yp_dnslookup.c +++ b/usr.sbin/ypserv/yp_dnslookup.c @@ -103,7 +103,7 @@ static char *parse(hp) #define BY_DNS_ID 1 #define BY_RPC_XID 2 -extern struct hostent *__dns_getanswer __P((char *, int, char *, int)); +extern struct hostent *__dns_getanswer(char *, int, char *, int); static TAILQ_HEAD(dns_qhead, circleq_dnsentry) qhead; @@ -202,7 +202,7 @@ static struct circleq_dnsentry *yp_find_dnsqent(id, type) register struct circleq_dnsentry *q; TAILQ_FOREACH(q, &qhead, links) { - switch(type) { + switch (type) { case BY_RPC_XID: if (id == q->xid) return(q); @@ -232,7 +232,7 @@ static void yp_send_dns_reply(q, buf) * Set up correct reply struct and * XDR filter depending on ypvers. */ - switch(q->ypvers) { + switch (q->ypvers) { case YPVERS: bzero((char *)&result_v2, sizeof(result_v2)); @@ -319,7 +319,7 @@ void yp_prune_dnsq() register struct circleq_dnsentry *q, *n; q = TAILQ_FIRST(&qhead); - while(q != NULL) { + while (q != NULL) { q->ttl--; n = TAILQ_NEXT(q, links); if (!q->ttl) { @@ -497,7 +497,7 @@ ypstat yp_async_lookup_addr(rqstp, addr) } /* Avoid transmitting dupe requests. */ - if (type == SOCK_DGRAM && + if (type == SOCK_DGRAM && yp_find_dnsqent(svcudp_get_xid(rqstp->rq_xprt),BY_RPC_XID) != NULL) return(YP_TRUE); diff --git a/usr.sbin/ypserv/yp_extern.h b/usr.sbin/ypserv/yp_extern.h index 75d2dd3..553e296 100644 --- a/usr.sbin/ypserv/yp_extern.h +++ b/usr.sbin/ypserv/yp_extern.h @@ -71,45 +71,45 @@ extern char *yp_dir; extern pid_t yp_pid; extern enum ypstat yp_errno; -extern void yp_error __P((const char *, ...)) __printflike(1, 2); +extern void yp_error(const char *, ...) __printflike(1, 2); #ifdef DB_CACHE -extern int yp_get_record __P(( DB *, const DBT *, DBT *, int)); +extern int yp_get_record(DB *, const DBT *, DBT *, int); #else -extern int yp_get_record __P(( const char *, const char *, const DBT *, DBT *, int)); +extern int yp_get_record(const char *, const char *, const DBT *, DBT *, int); #endif -extern int yp_first_record __P((const DB *, DBT *, DBT *, int)); -extern int yp_next_record __P((const DB *, DBT *, DBT *, int, int)); -extern char *yp_dnsname __P(( char * )); -extern char *yp_dnsaddr __P(( const char * )); +extern int yp_first_record(const DB *, DBT *, DBT *, int); +extern int yp_next_record(const DB *, DBT *, DBT *, int, int); +extern char *yp_dnsname(char *); +extern char *yp_dnsaddr(const char *); #ifdef DB_CACHE -extern int yp_access __P((const char *, const char *, const struct svc_req * )); +extern int yp_access(const char *, const char *, const struct svc_req *); #else -extern int yp_access __P((const char *, const struct svc_req * )); +extern int yp_access(const char *, const struct svc_req *); #endif -extern int yp_validdomain __P((const char * )); -extern DB *yp_open_db __P(( const char *, const char *)); -extern DB *yp_open_db_cache __P(( const char *, const char *, const char *, int )); -extern void yp_flush_all __P(( void )); -extern void yp_init_dbs __P(( void )); -extern int yp_testflag __P(( char *, char *, int )); -extern void load_securenets __P(( void )); +extern int yp_validdomain(const char *); +extern DB *yp_open_db(const char *, const char *); +extern DB *yp_open_db_cache(const char *, const char *, const char *, int); +extern void yp_flush_all(void); +extern void yp_init_dbs(void); +extern int yp_testflag(char *, char *, int); +extern void load_securenets(void); #ifdef DB_CACHE -extern ypstat yp_select_map __P(( char *, char *, keydat *, int )); -extern ypstat yp_getbykey __P(( keydat *, valdat * )); -extern ypstat yp_firstbykey __P(( keydat *, valdat * )); -extern ypstat yp_nextbykey __P(( keydat *, valdat * )); +extern ypstat yp_select_map(char *, char *, keydat *, int); +extern ypstat yp_getbykey(keydat *, valdat *); +extern ypstat yp_firstbykey(keydat *, valdat *); +extern ypstat yp_nextbykey(keydat *, valdat *); #endif -extern unsigned long svcudp_set_xid __P(( SVCXPRT *, unsigned long )); -extern unsigned long svcudp_get_xid __P(( SVCXPRT * )); +extern unsigned long svcudp_set_xid(SVCXPRT *, unsigned long); +extern unsigned long svcudp_get_xid(SVCXPRT *); #ifndef RESOLVER_TIMEOUT #define RESOLVER_TIMEOUT 3600 #endif -extern int yp_init_resolver __P(( void )); -extern void yp_run_dnsq __P(( void )); -extern void yp_prune_dnsq __P(( void )); -extern ypstat yp_async_lookup_name __P(( struct svc_req *, char * )); -extern ypstat yp_async_lookup_addr __P(( struct svc_req *, char * )); +extern int yp_init_resolver(void); +extern void yp_run_dnsq(void); +extern void yp_prune_dnsq(void); +extern ypstat yp_async_lookup_name(struct svc_req *, char *); +extern ypstat yp_async_lookup_addr(struct svc_req *, char *); diff --git a/usr.sbin/ypserv/yp_main.c b/usr.sbin/ypserv/yp_main.c index 07b2089..c31e3fd 100644 --- a/usr.sbin/ypserv/yp_main.c +++ b/usr.sbin/ypserv/yp_main.c @@ -76,9 +76,9 @@ static int _rpcfdtype; #define _SERVED 1 #define _SERVING 2 -extern void ypprog_1 __P((struct svc_req *, register SVCXPRT *)); -extern void ypprog_2 __P((struct svc_req *, register SVCXPRT *)); -extern int _rpc_dtablesize __P((void)); +extern void ypprog_1(struct svc_req *, register SVCXPRT *); +extern void ypprog_2(struct svc_req *, register SVCXPRT *); +extern int _rpc_dtablesize(void); extern int _rpcsvcstate; /* Set when a request is serviced */ char *progname = "ypserv"; char *yp_dir = _PATH_YP; @@ -235,7 +235,7 @@ main(argc, argv) int ch; while ((ch = getopt(argc, argv, "hdnp:")) != -1) { - switch(ch) { + switch (ch) { case 'd': debug = ypdb_debug = 1; break; diff --git a/usr.sbin/ypserv/yp_server.c b/usr.sbin/ypserv/yp_server.c index 5c57b0b..37ab7ef 100644 --- a/usr.sbin/ypserv/yp_server.c +++ b/usr.sbin/ypserv/yp_server.c @@ -172,7 +172,7 @@ ypproc_match_2_svc(ypreq_key *argp, struct svc_req *rqstp) if (do_dns && result.stat != YP_TRUE && strstr(argp->map, "hosts")) { #endif char nbuf[YPMAXRECORD]; - + /* NUL terminate! NUL terminate!! NUL TERMINATE!!! */ bcopy(argp->key.keydat_val, nbuf, argp->key.keydat_len); nbuf[argp->key.keydat_len] = '\0'; @@ -360,7 +360,7 @@ ypproc_xfr_2_svc(ypreq_xfr *argp, struct svc_req *rqstp) YPXFR_RETURN(YPXFR_REFUSED) } - switch(yp_fork()) { + switch (yp_fork()) { case 0: { char g[11], t[11], p[11]; @@ -522,7 +522,7 @@ ypproc_all_2_svc(ypreq_nokey *argp, struct svc_req *rqstp) * async socket I/O?) */ if (!debug) { - switch(yp_fork()) { + switch (yp_fork()) { case 0: break; case -1: @@ -632,7 +632,7 @@ ypproc_order_2_svc(ypreq_nokey *argp, struct svc_req *rqstp) result.stat = YP_BADARGS; return (&result); } - + /* * We could just check the timestamp on the map file, * but that's a hack: we'll only know the last time the file @@ -660,7 +660,7 @@ static void yp_maplist_free(yp_maplist) { register struct ypmaplist *next; - while(yp_maplist) { + while (yp_maplist) { next = yp_maplist->next; free(yp_maplist->map); free(yp_maplist); @@ -736,7 +736,7 @@ ypproc_maplist_2_svc(domainname *argp, struct svc_req *rqstp) result.stat = YP_BADARGS; return (&result); } - + if (yp_validdomain(*argp)) { result.stat = YP_NODOM; return (&result); -- cgit v1.1