From dc584ddbc5eb111cdb9863e2652621d7b5e9ba76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Wed, 6 Feb 2002 15:26:07 +0000 Subject: [PATCH] ANSIfy and remove some dead code. Sponsored by: DARPA, NAI Labs --- lib/libc/yp/xdryp.c | 8 +- lib/libc/yp/yplib.c | 108 +++++++--------------- lib/librpcsvc/yp_passwd.c | 5 +- lib/librpcsvc/yp_update.c | 10 +- libexec/ypxfr/yp_dbwrite.c | 13 +-- libexec/ypxfr/ypxfr_extern.h | 2 +- libexec/ypxfr/ypxfr_getmap.c | 8 +- libexec/ypxfr/ypxfr_main.c | 22 ++--- libexec/ypxfr/ypxfr_misc.c | 27 ++---- libexec/ypxfr/ypxfrd_getmap.c | 10 +- usr.bin/chpass/pw_yp.c | 36 +++----- usr.sbin/rpc.yppasswdd/pw_copy.c | 4 +- usr.sbin/rpc.yppasswdd/pw_util.c | 13 +-- usr.sbin/rpc.yppasswdd/yppasswdd_main.c | 15 ++- usr.sbin/rpc.yppasswdd/yppasswdd_server.c | 44 +++++---- usr.sbin/rpc.ypupdated/update.c | 54 +++-------- usr.sbin/rpc.ypupdated/yp_dbdelete.c | 5 +- usr.sbin/rpc.ypupdated/yp_dbupdate.c | 16 +--- usr.sbin/rpc.ypupdated/ypupdated_main.c | 17 ++-- usr.sbin/rpc.ypupdated/ypupdated_server.c | 24 ++--- usr.sbin/rpc.ypxfrd/ypxfrd_main.c | 16 ++-- usr.sbin/yp_mkdb/yp_mkdb.c | 17 ++-- usr.sbin/ypbind/yp_ping.c | 14 +-- usr.sbin/ypbind/ypbind.c | 59 ++++-------- usr.sbin/yppoll/yppoll.c | 5 +- usr.sbin/yppush/yppush_main.c | 50 +++++----- usr.sbin/ypserv/yp_access.c | 21 ++--- usr.sbin/ypserv/yp_dblookup.c | 101 ++++++++------------ usr.sbin/ypserv/yp_dnslookup.c | 43 +++++---- usr.sbin/ypserv/yp_error.c | 26 +----- usr.sbin/ypserv/yp_main.c | 16 ++-- usr.sbin/ypserv/yp_server.c | 19 ++-- usr.sbin/ypserv/yp_svc_udp.c | 7 +- usr.sbin/ypset/ypset.c | 9 +- 34 files changed, 308 insertions(+), 536 deletions(-) diff --git a/lib/libc/yp/xdryp.c b/lib/libc/yp/xdryp.c index 3d865fee9b54..630180c4c5bb 100644 --- a/lib/libc/yp/xdryp.c +++ b/lib/libc/yp/xdryp.c @@ -51,9 +51,7 @@ typedef struct { } datum; bool_t -xdr_datum(xdrs, objp) -XDR *xdrs; -datum *objp; +xdr_datum(XDR *xdrs, datum *objp) { if (!xdr_bytes(xdrs, (char **)&objp->dptr, (u_int *)&objp->dsize, YPMAXRECORD)) { return (FALSE); @@ -62,9 +60,7 @@ datum *objp; } bool_t -xdr_ypresp_all_seq(xdrs, objp) -XDR *xdrs; -u_long *objp; +xdr_ypresp_all_seq(XDR *xdrs, u_long *objp) { struct ypresp_all out; u_long status; diff --git a/lib/libc/yp/yplib.c b/lib/libc/yp/yplib.c index a762611e7d7d..0a4bc7e09a70 100644 --- a/lib/libc/yp/yplib.c +++ b/lib/libc/yp/yplib.c @@ -105,10 +105,9 @@ static char _yp_domain[MAXHOSTNAMELEN]; int _yplib_timeout = 10; #ifdef YPMATCHCACHE -static void ypmatch_cache_delete(ypdb, prev, cur) - struct dom_binding *ypdb; - struct ypmatch_ent *prev; - struct ypmatch_ent *cur; +static void +ypmatch_cache_delete(struct dom_binding *ypdb, struct ypmatch_ent *prev, + struct ypmatch_ent *cur) { if (prev == NULL) ypdb->cache = cur->ypc_next; @@ -125,8 +124,8 @@ static void ypmatch_cache_delete(ypdb, prev, cur) return; } -static void ypmatch_cache_flush(ypdb) - struct dom_binding *ypdb; +static void +ypmatch_cache_flush(struct dom_binding *ypdb) { struct ypmatch_ent *n, *c = ypdb->cache; @@ -139,8 +138,8 @@ static void ypmatch_cache_flush(ypdb) return; } -static void ypmatch_cache_expire(ypdb) - struct dom_binding *ypdb; +static void +ypmatch_cache_expire(struct dom_binding *ypdb) { struct ypmatch_ent *c = ypdb->cache; struct ypmatch_ent *n, *p = NULL; @@ -162,11 +161,9 @@ static void ypmatch_cache_expire(ypdb) return; } -static void ypmatch_cache_insert(ypdb, map, key, val) - struct dom_binding *ypdb; - char *map; - keydat *key; - valdat *val; +static void +ypmatch_cache_insert(struct dom_binding *ypdb, char *map, keydat *key, + valdat *val) { struct ypmatch_ent *new; @@ -235,11 +232,9 @@ static void ypmatch_cache_insert(ypdb, map, key, val) return; } -static bool_t ypmatch_cache_lookup(ypdb, map, key, val) - struct dom_binding *ypdb; - char *map; - keydat *key; - valdat *val; +static bool_t +ypmatch_cache_lookup(struct dom_binding *ypdb, char *map, keydat *key, + valdat *val) { struct ypmatch_ent *c = ypdb->cache; @@ -266,8 +261,7 @@ static bool_t ypmatch_cache_lookup(ypdb, map, key, val) #endif char * -ypbinderr_string(incode) - int incode; +ypbinderr_string(int incode) { static char err[80]; switch (incode) { @@ -285,9 +279,7 @@ ypbinderr_string(incode) } int -_yp_dobind(dom, ypdb) - char *dom; - struct dom_binding **ypdb; +_yp_dobind(char *dom, struct dom_binding **ypdb) { static pid_t pid = -1; char path[MAXPATHLEN]; @@ -563,8 +555,7 @@ gotit: } static void -_yp_unbind(ypb) - struct dom_binding *ypb; +_yp_unbind(struct dom_binding *ypb) { struct sockaddr_in check; int checklen = sizeof(struct sockaddr_in); @@ -594,15 +585,13 @@ _yp_unbind(ypb) } int -yp_bind(dom) - char *dom; +yp_bind(char *dom) { return (_yp_dobind(dom, NULL)); } void -yp_unbind(dom) - char *dom; +yp_unbind(char *dom) { struct dom_binding *ypb, *ypbp; @@ -623,13 +612,8 @@ yp_unbind(dom) } int -yp_match(indomain, inmap, inkey, inkeylen, outval, outvallen) - char *indomain; - char *inmap; - const char *inkey; - int inkeylen; - char **outval; - int *outvallen; +yp_match(char *indomain, char *inmap, const char *inkey, int inkeylen, + char **outval, int *outvallen) { struct dom_binding *ysd; struct ypresp_val yprv; @@ -701,8 +685,7 @@ again: } int -yp_get_default_domain(domp) -char **domp; +yp_get_default_domain(char **domp) { *domp = NULL; if (_yp_domain[0] == '\0') @@ -713,13 +696,8 @@ char **domp; } int -yp_first(indomain, inmap, outkey, outkeylen, outval, outvallen) - char *indomain; - char *inmap; - char **outkey; - int *outkeylen; - char **outval; - int *outvallen; +yp_first(char *indomain, char *inmap, char **outkey, int *outkeylen, + char **outval, int *outvallen) { struct ypresp_key_val yprkv; struct ypreq_nokey yprnk; @@ -770,15 +748,8 @@ again: } int -yp_next(indomain, inmap, inkey, inkeylen, outkey, outkeylen, outval, outvallen) - char *indomain; - char *inmap; - char *inkey; - int inkeylen; - char **outkey; - int *outkeylen; - char **outval; - int *outvallen; +yp_next(char *indomain, char *inmap, char *inkey, int inkeylen, + char **outkey, int *outkeylen, char **outval, int *outvallen) { struct ypresp_key_val yprkv; struct ypreq_key yprk; @@ -832,10 +803,7 @@ again: } int -yp_all(indomain, inmap, incallback) - char *indomain; - char *inmap; - struct ypall_callback *incallback; +yp_all(char *indomain, char *inmap, struct ypall_callback *incallback) { struct ypreq_nokey yprnk; struct dom_binding *ysd; @@ -893,10 +861,7 @@ again: } int -yp_order(indomain, inmap, outorder) - char *indomain; - char *inmap; - int *outorder; +yp_order(char *indomain, char *inmap, int *outorder) { struct dom_binding *ysd; struct ypresp_order ypro; @@ -948,10 +913,7 @@ again: } int -yp_master(indomain, inmap, outname) - char *indomain; - char *inmap; - char **outname; +yp_master(char *indomain, char *inmap, char **outname) { struct dom_binding *ysd; struct ypresp_master yprm; @@ -991,10 +953,9 @@ again: xdr_free(xdr_ypresp_master, (char *)&yprm); return (r); } + int -yp_maplist(indomain, outmaplist) - char *indomain; - struct ypmaplist **outmaplist; +yp_maplist(char *indomain, struct ypmaplist **outmaplist) { struct dom_binding *ysd; struct ypresp_maplist ypml; @@ -1031,8 +992,7 @@ again: } char * -yperr_string(incode) - int incode; +yperr_string(int incode) { static char err[80]; @@ -1077,8 +1037,7 @@ yperr_string(incode) } int -ypprot_err(incode) - unsigned int incode; +ypprot_err(unsigned int incode) { switch (incode) { case YP_TRUE: @@ -1108,8 +1067,7 @@ ypprot_err(incode) } int -_yp_check(dom) - char **dom; +_yp_check(char **dom) { char *unused; diff --git a/lib/librpcsvc/yp_passwd.c b/lib/librpcsvc/yp_passwd.c index b43669c05be3..1c6e6aade976 100644 --- a/lib/librpcsvc/yp_passwd.c +++ b/lib/librpcsvc/yp_passwd.c @@ -50,9 +50,8 @@ __FBSDID("$FreeBSD$"); * fooling gcc. */ -int _yppasswd(oldpass, newpw) - char *oldpass; - struct x_passwd *newpw; +int +_yppasswd(char *oldpass, struct x_passwd *newpw) { char *server; char *domain; diff --git a/lib/librpcsvc/yp_update.c b/lib/librpcsvc/yp_update.c index bfa1bb10b8d0..5f1c7db987e6 100644 --- a/lib/librpcsvc/yp_update.c +++ b/lib/librpcsvc/yp_update.c @@ -55,14 +55,8 @@ __FBSDID("$FreeBSD$"); #endif int -yp_update(domain, map, ypop, key, keylen, data, datalen) - char *domain; - char *map; - unsigned int ypop; - char *key; - int keylen; - char *data; - int datalen; +yp_update(char *domain, char *map, unsigned int ypop, char *key, int keylen, + char *data, int datalen) { char *master; int rval; diff --git a/libexec/ypxfr/yp_dbwrite.c b/libexec/ypxfr/yp_dbwrite.c index 4715d7fa3204..05031c163d72 100644 --- a/libexec/ypxfr/yp_dbwrite.c +++ b/libexec/ypxfr/yp_dbwrite.c @@ -53,10 +53,8 @@ static const char rcsid[] = /* * Open a DB database read/write */ -DB *yp_open_db_rw(domain, map, flags) - const char *domain; - const char *map; - const int flags; +DB * +yp_open_db_rw(const char *domain, const char *map, const int flags) { DB *dbp; char buf[1025]; @@ -91,11 +89,8 @@ DB *yp_open_db_rw(domain, map, flags) return (dbp); } -int yp_put_record(dbp,key,data,allow_overwrite) - DB *dbp; - DBT *key; - DBT *data; - int allow_overwrite; +int +yp_put_record(DB *dbp, DBT *key, DBT *data, int allow_overwrite) { int rval; diff --git a/libexec/ypxfr/ypxfr_extern.h b/libexec/ypxfr/ypxfr_extern.h index f5feedfec05f..acfa10589076 100644 --- a/libexec/ypxfr/ypxfr_extern.h +++ b/libexec/ypxfr/ypxfr_extern.h @@ -54,7 +54,7 @@ extern DB *yp_open_db_rw(const char *, const char *, const int); extern void yp_init_dbs(void); extern int yp_put_record(DB *, DBT *, DBT *, int); extern int yp_get_record(const char *, const char *, const DBT *, DBT *, int); -extern int ypxfr_get_map(char *, char *, char *, int (*)()); +extern int ypxfr_get_map(char *, char *, char *, int (*)(int, char *, int, char *, int, char*)); extern char *ypxfr_get_master(char *, char *, char *, const int); extern unsigned long ypxfr_get_order(char *, char *, char *, const int); extern int ypxfr_match(char *, char *, char *, char *, unsigned long); diff --git a/libexec/ypxfr/ypxfr_getmap.c b/libexec/ypxfr/ypxfr_getmap.c index b7ec9f2a2d41..3c3d2e7bc771 100644 --- a/libexec/ypxfr/ypxfr_getmap.c +++ b/libexec/ypxfr/ypxfr_getmap.c @@ -59,11 +59,9 @@ extern enum ypstat yp_errno; * talking to one of the slaves instead. We do need to dig into libc * a little though, since it contains the magic XDR function we need. */ -int ypxfr_get_map(map, domain, host, callback) - char *map; - char *domain; - char *host; - int (*callback)(); +int +ypxfr_get_map(char *map, char *domain, char *host, + int (*callback)(int, char *, int, char *, int, char*)) { CLIENT *clnt; ypreq_nokey req; diff --git a/libexec/ypxfr/ypxfr_main.c b/libexec/ypxfr/ypxfr_main.c index 24d9d4a8529f..f1be4f24f26b 100644 --- a/libexec/ypxfr/ypxfr_main.c +++ b/libexec/ypxfr/ypxfr_main.c @@ -64,9 +64,8 @@ struct sockaddr_in ypxfr_callback_addr; struct yppushresp_xfr ypxfr_resp; DB *dbp; -static void ypxfr_exit(retval, temp) - ypxfrstat retval; - char *temp; +static void +ypxfr_exit(ypxfrstat retval, char *temp) { CLIENT *clnt; int sock = RPC_ANYSOCK; @@ -107,7 +106,8 @@ static void ypxfr_exit(retval, temp) exit(0); } -static void usage() +static void +usage(void) { if (_rpcpmstart) { ypxfr_exit(YPXFR_BADARGS,NULL); @@ -120,13 +120,9 @@ static void usage() } } -int ypxfr_foreach(status, key, keylen, val, vallen, data) - int status; - char *key; - int keylen; - char *val; - int vallen; - char *data; +int +ypxfr_foreach(int status, char *key, int keylen, char *val, int vallen, + char *data) { DBT dbkey, dbval; @@ -161,9 +157,7 @@ int ypxfr_foreach(status, key, keylen, val, vallen, data) } int -main(argc,argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int ch; int ypxfr_force = 0; diff --git a/libexec/ypxfr/ypxfr_misc.c b/libexec/ypxfr/ypxfr_misc.c index 0682def089ae..ede4f56e632d 100644 --- a/libexec/ypxfr/ypxfr_misc.c +++ b/libexec/ypxfr/ypxfr_misc.c @@ -46,8 +46,8 @@ struct dom_binding {}; #include #include "ypxfr_extern.h" -char *ypxfrerr_string(code) - ypxfrstat code; +char * +ypxfrerr_string(ypxfrstat code) { switch (code) { case YPXFR_SUCC: @@ -120,11 +120,8 @@ char *ypxfrerr_string(code) * allocated by the XDR routines. We have to rememver to free() or * xdr_free() the memory as required to avoid leaking memory. */ -char *ypxfr_get_master(domain,map,source,yplib) - char *domain; - char *map; - char *source; - const int yplib; +char * +ypxfr_get_master(char *domain, char *map, char *source, const int yplib) { static char mastername[MAXPATHLEN + 2]; @@ -195,11 +192,8 @@ failed")); } } -unsigned long ypxfr_get_order(domain, map, source, yplib) - char *domain; - char *map; - char *source; - const int yplib; +unsigned long +ypxfr_get_order(char *domain, char *map, char *source, const int yplib) { if (yplib) { unsigned long order; @@ -260,12 +254,9 @@ failed")); } } -int ypxfr_match(server, domain, map, key, keylen) - char *server; - char *domain; - char *map; - char *key; - unsigned long keylen; +int +ypxfr_match(char *server, char *domain, char *map, char *key, + unsigned long keylen) { ypreq_key ypkey; ypresp_val *ypval; diff --git a/libexec/ypxfr/ypxfrd_getmap.c b/libexec/ypxfr/ypxfrd_getmap.c index 5d57c846eace..d7a0171c3210 100644 --- a/libexec/ypxfr/ypxfrd_getmap.c +++ b/libexec/ypxfr/ypxfrd_getmap.c @@ -51,7 +51,8 @@ static const char rcsid[] = int fp = 0; -static bool_t xdr_my_xfr(register XDR *xdrs, xfr *objp) +static bool_t +xdr_my_xfr(register XDR *xdrs, xfr *objp) { while (1) { if (!xdr_xfr(xdrs, objp)) @@ -100,11 +101,8 @@ static bool_t xdr_my_xfr(register XDR *xdrs, xfr *objp) #define PERM_SECURE (S_IRUSR|S_IWUSR) -int ypxfrd_get_map(host, map, domain, tmpname) - char *host; - char *map; - char *domain; - char *tmpname; +int +ypxfrd_get_map(char *host, char *map, char *domain, char *tmpname) { CLIENT *clnt; struct ypxfr_mapname req; diff --git a/usr.bin/chpass/pw_yp.c b/usr.bin/chpass/pw_yp.c index 921f30ef0bdf..cc60073811fa 100644 --- a/usr.bin/chpass/pw_yp.c +++ b/usr.bin/chpass/pw_yp.c @@ -90,9 +90,8 @@ extern char *tempname; struct passwd local_password; struct passwd yp_password; -void copy_yp_pass(p, x, m) -char *p; -int x, m; +void +copy_yp_pass(char *p, int x, int m) { register char *t, *s = p; static char *buf; @@ -140,9 +139,8 @@ int x, m; return; } -void copy_local_pass(p,m) -char *p; -int m; +void +copy_local_pass(char *p, int m) { register char *t; static char *buf; @@ -179,14 +177,9 @@ int m; * need our own magic version of yp_match() which we can use in any * environment. */ -static int my_yp_match(server, domain, map, key, keylen, result, resultlen) - char *server; - char *domain; - char *map; - char *key; - unsigned long keylen; - char **result; - unsigned long *resultlen; +static int +my_yp_match(char *server, char *domain, char *map, char *key, + unsigned long keylen, char **result, unsigned long *resultlen) { ypreq_key ypkey; ypresp_val *ypval; @@ -255,10 +248,8 @@ static int my_yp_match(server, domain, map, key, keylen, result, resultlen) /* * Check if the user we're working with is local or in NIS. */ -int use_yp (user, uid, which) - char *user; - uid_t uid; - int which; /* 0 = use username, 1 = use uid */ +int +use_yp(char *user, uid_t uid, int which /* 0 = use username, 1 = use uid */) { int user_local = 0, user_yp = 0, user_exists = 0; DB *dbp; @@ -348,12 +339,11 @@ int use_yp (user, uid, which) * Find the name of the NIS master server for this domain * and make sure it's running yppasswdd. */ -char *get_yp_master(getserver) - int getserver; +char * +get_yp_master(int getserver) { char *mastername; int rval, localport; - struct stat st; /* * Sometimes we are called just to probe for rpc.yppasswdd and @@ -427,8 +417,8 @@ char *get_yp_master(getserver) * information without specifying a password, however this only works * for the superuser on the NIS master server. */ -void yp_submit(pw) - struct passwd *pw; +void +yp_submit(struct passwd *pw) { struct yppasswd yppasswd; struct master_yppasswd master_yppasswd; diff --git a/usr.sbin/rpc.yppasswdd/pw_copy.c b/usr.sbin/rpc.yppasswdd/pw_copy.c index 99a79ca376b4..24caf4d3c746 100644 --- a/usr.sbin/rpc.yppasswdd/pw_copy.c +++ b/usr.sbin/rpc.yppasswdd/pw_copy.c @@ -52,9 +52,7 @@ static const char rcsid[] = #include "yppasswdd_extern.h" int -pw_copy(ffd, tfd, pw) - int ffd, tfd; - struct passwd *pw; +pw_copy(int ffd, int tfd, struct passwd *pw) { FILE *from, *to; int done; diff --git a/usr.sbin/rpc.yppasswdd/pw_util.c b/usr.sbin/rpc.yppasswdd/pw_util.c index 86535b87cbb1..bd85b1501bf4 100644 --- a/usr.sbin/rpc.yppasswdd/pw_util.c +++ b/usr.sbin/rpc.yppasswdd/pw_util.c @@ -67,7 +67,7 @@ int pstat; pid_t pid; void -pw_init() +pw_init(void) { struct rlimit rlim; @@ -99,7 +99,7 @@ pw_init() static int lockfd; int -pw_lock() +pw_lock(void) { /* * If the master password file doesn't exist, the system is hosed. @@ -120,7 +120,7 @@ pw_lock() } int -pw_tmp() +pw_tmp(void) { static char path[MAXPATHLEN]; int fd; @@ -141,8 +141,7 @@ pw_tmp() } int -pw_mkdb(username) - const char *username; +pw_mkdb(const char *username) { yp_error("rebuilding the database..."); @@ -172,9 +171,7 @@ pw_mkdb(username) } void -pw_error(name, err, eval) - const char *name; - int err, eval; +pw_error(const char *name, int err, int eval) { if (err && name != NULL) yp_error("%s", name); diff --git a/usr.sbin/rpc.yppasswdd/yppasswdd_main.c b/usr.sbin/rpc.yppasswdd/yppasswdd_main.c index be422633d745..b261feb644ed 100644 --- a/usr.sbin/rpc.yppasswdd/yppasswdd_main.c +++ b/usr.sbin/rpc.yppasswdd/yppasswdd_main.c @@ -97,8 +97,8 @@ int resvport = 1; int inplace = 0; char *sockname = YP_SOCKNAME; -static void terminate(sig) - int sig; +static void +terminate(int sig) { rpcb_unset(YPPASSWDPROG, YPPASSWDVERS, NULL); rpcb_unset(MASTER_YPPASSWDPROG, MASTER_YPPASSWDVERS, NULL); @@ -106,8 +106,8 @@ static void terminate(sig) exit(0); } -static void reload(sig) - int sig; +static void +reload(int sig) { load_securenets(); } @@ -142,7 +142,8 @@ closedown(int sig) (void) alarm(_RPCSVC_CLOSEDOWN/2); } -static void usage() +static void +usage(void) { fprintf(stderr, "%s\n%s\n", "usage: rpc.yppasswdd [-t master.passwd file] [-d domain] [-p path] [-s]", @@ -151,9 +152,7 @@ static void usage() } int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { register SVCXPRT *transp = NULL; struct sockaddr_in saddr; diff --git a/usr.sbin/rpc.yppasswdd/yppasswdd_server.c b/usr.sbin/rpc.yppasswdd/yppasswdd_server.c index ab70560d667e..2ba3bac46791 100644 --- a/usr.sbin/rpc.yppasswdd/yppasswdd_server.c +++ b/usr.sbin/rpc.yppasswdd/yppasswdd_server.c @@ -64,8 +64,8 @@ struct dom_binding {}; char *tempname; -void reaper(sig) - int sig; +void +reaper(int sig) { extern pid_t pid; extern int pstat; @@ -85,8 +85,8 @@ void reaper(sig) return; } -void install_reaper(on) - int on; +void +install_reaper(int on) { if (on) { signal(SIGCHLD, reaper); @@ -98,9 +98,8 @@ void install_reaper(on) static struct passwd yp_password; -static void copy_yp_pass(p, x, m) -char *p; -int x, m; +static void +copy_yp_pass(char *p, int x, int m) { register char *t, *s = p; static char *buf; @@ -148,8 +147,8 @@ int x, m; return; } -static int validchars(arg) - char *arg; +static int +validchars(char *arg) { int i; @@ -171,9 +170,8 @@ static int validchars(arg) return(0); } -static int validate_master(opw, npw) - struct passwd *opw; - struct x_master_passwd *npw; +static int +validate_master(struct passwd *opw, struct x_master_passwd *npw) { if (npw->pw_name[0] == '+' || npw->pw_name[0] == '-') { @@ -198,9 +196,8 @@ static int validate_master(opw, npw) return(0); } -static int validate(opw, npw) - struct passwd *opw; - struct x_passwd *npw; +static int +validate(struct passwd *opw, struct x_passwd *npw) { if (npw->pw_name[0] == '+' || npw->pw_name[0] == '-') { @@ -259,8 +256,8 @@ static int validate(opw, npw) * all agree), then we use that domain. If we match the user in * more than one database, we must abort. */ -static char *find_domain(pw) - struct x_passwd *pw; +static char * +find_domain(struct x_passwd *pw) { struct stat statbuf; struct dirent *dirp; @@ -314,9 +311,8 @@ static char *find_domain(pw) return((char *)&domain); } -static int update_inplace(pw, domain) - struct passwd *pw; - char *domain; +static int +update_inplace(struct passwd *pw, char *domain) { DB *dbp = NULL; DBT key = { NULL, 0 }; @@ -454,7 +450,8 @@ with the same name - continuing"); return(0); } -static char *yp_mktmpnam() +static char * +yp_mktmpnam(void) { static char path[MAXPATHLEN]; char *p; @@ -694,8 +691,9 @@ cleaning up and bailing out"); * than the last one. Since only the superuser is allowed to use it, * it is assumed that the caller knows what he's doing. */ -int *yppasswdproc_update_master_1_svc(master_yppasswd *argp, - struct svc_req *rqstp) +int * +yppasswdproc_update_master_1_svc(master_yppasswd *argp, + struct svc_req *rqstp) { static int result; int pfd, tfd; diff --git a/usr.sbin/rpc.ypupdated/update.c b/usr.sbin/rpc.ypupdated/update.c index 6566f46d76ab..5cc0d7a56cff 100644 --- a/usr.sbin/rpc.ypupdated/update.c +++ b/usr.sbin/rpc.ypupdated/update.c @@ -85,14 +85,9 @@ static int _openchild(char *, FILE **, FILE **); * and update it if so. Returns the yp status, which is zero * if there is no access violation. */ -mapupdate(requester, mapname, op, keylen, key, datalen, data) - char *requester; - char *mapname; - u_int op; - u_int keylen; - char *key; - u_int datalen; - char *data; +int +mapupdate(char *requester, char *mapname, u_int op, u_int keylen, char *key, + u_int datalen, char *data) { char updater[MAXMAPNAMELEN + 40]; FILE *childargs; @@ -137,23 +132,19 @@ mapupdate(requester, mapname, op, keylen, key, datalen, data) (void)wait(&status); #ifdef WEXITSTATUS - if (WEXITSTATUS(status) != 0) { + if (WEXITSTATUS(status) != 0) #else - if (status.w_retcode != 0) { + if (status.w_retcode != 0) #endif return (YPERR_YPERR); - } return (yperrno); } /* * returns pid, or -1 for failure */ -static -_openchild(command, fto, ffrom) - char *command; - FILE **fto; - FILE **ffrom; +static int +_openchild(char *command, FILE **fto, FILE **ffrom) { int i; pid_t pid; @@ -168,11 +159,7 @@ _openchild(command, fto, ffrom) if (pipe(pdfrom) < 0) { goto error2; } -#ifdef VFORK - switch (pid = vfork()) { -#else switch (pid = fork()) { -#endif case -1: goto error3; @@ -222,8 +209,7 @@ error1: } static char * -basename(path) - char *path; +basename(char *path) { char *p; @@ -237,16 +223,6 @@ basename(path) #else /* YP */ -#ifdef foo -#define ERR_ACCESS 1 -#define ERR_MALLOC 2 -#define ERR_READ 3 -#define ERR_WRITE 4 -#define ERR_DBASE 5 -#define ERR_KEY 6 -extern char *malloc(); -#endif - static int match(char *, char *); /* @@ -256,14 +232,8 @@ static int match(char *, char *); * the local file and then shuts up. */ int -localupdate(name, filename, op, keylen, key, datalen, data) - char *name; /* Name of the requestor */ - char *filename; - u_int op; - u_int keylen; /* Not used */ - char *key; - u_int datalen; /* Not used */ - char *data; +localupdate(char *name, char *filename, u_int op, u_int keylen __unused, + char *key, u_int datalen __unused, char *data) { char line[256]; FILE *rf; @@ -349,9 +319,7 @@ localupdate(name, filename, op, keylen, key, datalen, data) } static int -match(line, name) - char *line; - char *name; +match(char *line, char *name) { int len; diff --git a/usr.sbin/rpc.ypupdated/yp_dbdelete.c b/usr.sbin/rpc.ypupdated/yp_dbdelete.c index 8a97b197e1e5..d38e2be88324 100644 --- a/usr.sbin/rpc.ypupdated/yp_dbdelete.c +++ b/usr.sbin/rpc.ypupdated/yp_dbdelete.c @@ -48,9 +48,8 @@ static const char rcsid[] = #include #include "ypxfr_extern.h" -int yp_del_record(dbp,key) - DB *dbp; - DBT *key; +int +yp_del_record(DB *dbp, DBT *key) { int rval; diff --git a/usr.sbin/rpc.ypupdated/yp_dbupdate.c b/usr.sbin/rpc.ypupdated/yp_dbupdate.c index b94b4b7a372b..44b2b9c91606 100644 --- a/usr.sbin/rpc.ypupdated/yp_dbupdate.c +++ b/usr.sbin/rpc.ypupdated/yp_dbupdate.c @@ -49,9 +49,8 @@ struct dom_binding {}; #include "ypxfr_extern.h" #include "ypupdated_extern.h" -static int yp_domake(map, domain) - char *map; - char *domain; +static int +yp_domake(char *map, char *domain) { int pid; @@ -74,14 +73,9 @@ static int yp_domake(map, domain) return(0); } -int ypmap_update(netname, map, op, keylen, keyval, datlen, datval) - char *netname; - char *map; - unsigned int op; - unsigned int keylen; - char *keyval; - unsigned int datlen; - char *datval; +int +ypmap_update(char *netname, char *map, unsigned int op, unsigned int keylen, + char *keyval, unsigned int datlen, char *datval) { DB *dbp; DBT key = { NULL, 0 }, data = { NULL, 0 }; diff --git a/usr.sbin/rpc.ypupdated/ypupdated_main.c b/usr.sbin/rpc.ypupdated/ypupdated_main.c index 85cd7bf474ed..64302ab74d19 100644 --- a/usr.sbin/rpc.ypupdated/ypupdated_main.c +++ b/usr.sbin/rpc.ypupdated/ypupdated_main.c @@ -79,8 +79,8 @@ extern int _rpcsvcstate; /* Set when a request is serviced */ char *progname = "rpc.ypupdated"; char *yp_dir = "/var/yp/"; -static -void _msgout(char* msg) +static void +_msgout(char* msg) { #ifdef RPC_SVC_FG if (_rpcpmstart) @@ -119,7 +119,7 @@ closedown(int sig) } static void -ypupdated_svc_run() +ypupdated_svc_run(void) { #ifdef FD_SETSIZE fd_set readfds; @@ -157,8 +157,8 @@ ypupdated_svc_run() } } -static void reaper(sig) - int sig; +static void +reaper(int sig) { int status; @@ -178,16 +178,15 @@ static void reaper(sig) } } -void usage() +void +usage(void) { fprintf(stderr, "rpc.ypupdatedd [-p path]\n"); exit(0); } int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { register SVCXPRT *transp = NULL; int sock; diff --git a/usr.sbin/rpc.ypupdated/ypupdated_server.c b/usr.sbin/rpc.ypupdated/ypupdated_server.c index 08f9f56a5fb6..fb1017d30c54 100644 --- a/usr.sbin/rpc.ypupdated/ypupdated_server.c +++ b/usr.sbin/rpc.ypupdated/ypupdated_server.c @@ -66,8 +66,8 @@ int forked = 0; #define WINDOW (60*60) #endif -static enum auth_stat yp_checkauth(svcreq) - struct svc_req *svcreq; +static enum auth_stat +yp_checkauth(struct svc_req *svcreq) { struct authdes_cred *des_cred; @@ -93,9 +93,8 @@ was too large -- possible spoof attempt"); } } -unsigned int *ypu_change_1_svc(args, svcreq) - struct ypupdate_args *args; - struct svc_req *svcreq; +unsigned int * +ypu_change_1_svc(struct ypupdate_args *args, struct svc_req *svcreq) { struct authdes_cred *des_cred; static int res; @@ -128,9 +127,8 @@ unsigned int *ypu_change_1_svc(args, svcreq) return (&res); } -unsigned int *ypu_insert_1_svc(args, svcreq) - struct ypupdate_args *args; - struct svc_req *svcreq; +unsigned int * +ypu_insert_1_svc(struct ypupdate_args *args, struct svc_req *svcreq) { struct authdes_cred *des_cred; static int res; @@ -163,9 +161,8 @@ unsigned int *ypu_insert_1_svc(args, svcreq) return (&res); } -unsigned int *ypu_delete_1_svc(args, svcreq) - struct ypdelete_args *args; - struct svc_req *svcreq; +unsigned int * +ypu_delete_1_svc(struct ypdelete_args *args, struct svc_req *svcreq) { struct authdes_cred *des_cred; static int res; @@ -198,9 +195,8 @@ unsigned int *ypu_delete_1_svc(args, svcreq) return (&res); } -unsigned int *ypu_store_1_svc(args, svcreq) - struct ypupdate_args *args; - struct svc_req *svcreq; +unsigned int * +ypu_store_1_svc(struct ypupdate_args *args, struct svc_req *svcreq) { struct authdes_cred *des_cred; static int res; diff --git a/usr.sbin/rpc.ypxfrd/ypxfrd_main.c b/usr.sbin/rpc.ypxfrd/ypxfrd_main.c index 511539e084ab..7fa866a6077c 100644 --- a/usr.sbin/rpc.ypxfrd/ypxfrd_main.c +++ b/usr.sbin/rpc.ypxfrd/ypxfrd_main.c @@ -80,8 +80,8 @@ extern int _rpcsvcstate; /* Set when a request is serviced */ char *progname = "rpc.ypxfrd"; char *yp_dir = "/var/yp/"; -static -void _msgout(char* msg) +static void +_msgout(char *msg) { #ifdef RPC_SVC_FG if (_rpcpmstart) @@ -121,7 +121,7 @@ closedown(int sig) static void -ypxfrd_svc_run() +ypxfrd_svc_run(void) { #ifdef FD_SETSIZE fd_set readfds; @@ -159,8 +159,7 @@ ypxfrd_svc_run() } } -static void reaper(sig) - int sig; +static void reaper(int sig) { int status; int saved_errno; @@ -185,16 +184,15 @@ static void reaper(sig) return; } -void usage() +void +usage(void) { fprintf(stderr, "usage: rpc.ypxfrd [-p path]\n"); exit(0); } int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { register SVCXPRT *transp = NULL; int sock; diff --git a/usr.sbin/yp_mkdb/yp_mkdb.c b/usr.sbin/yp_mkdb/yp_mkdb.c index 6f0d71b0feda..e37cf35f3db5 100644 --- a/usr.sbin/yp_mkdb/yp_mkdb.c +++ b/usr.sbin/yp_mkdb/yp_mkdb.c @@ -55,7 +55,8 @@ char *yp_dir = ""; /* No particular default needed. */ int _rpcpmstart = 0; int debug = 1; -static void usage() +static void +usage(void) { fprintf(stderr, "%s\n%s\n%s\n%s\n", "usage: yp_mkdb -c", @@ -67,17 +68,16 @@ static void usage() #define PERM_SECURE (S_IRUSR|S_IWUSR) -static DB *open_db(path, flags) - char *path; - int flags; +static DB * +open_db(char *path, int flags) { extern HASHINFO openinfo; return(dbopen(path, flags, PERM_SECURE, DB_HASH, &openinfo)); } -static void unwind(map) - char *map; +static void +unwind(char *map) { DB *dbp; DBT key, data; @@ -95,9 +95,8 @@ static void unwind(map) return; } -int main (argc, argv) - int argc; - char *argv[]; +int +main(int argc, char *argv[]) { int ch; int un = 0; diff --git a/usr.sbin/ypbind/yp_ping.c b/usr.sbin/ypbind/yp_ping.c index d3ea4c990289..3983ff30a634 100644 --- a/usr.sbin/ypbind/yp_ping.c +++ b/usr.sbin/ypbind/yp_ping.c @@ -129,11 +129,8 @@ static struct timeval tottimeout = { 1, 0 }; * Returns 0 if no map exists. */ static u_short -__pmap_getport(address, program, version, protocol) - struct sockaddr_in *address; - u_long program; - u_long version; - u_int protocol; +__pmap_getport(struct sockaddr_in *address, u_long program, u_long version, + u_int protocol) { u_short port = 0; int sock = -1; @@ -229,11 +226,8 @@ struct ping_req { unsigned long xid; }; -int __yp_ping(restricted_addrs, cnt, dom, port) - struct in_addr *restricted_addrs; - int cnt; - char *dom; - short *port; +int +__yp_ping(struct in_addr *restricted_addrs, int cnt, char *dom, short *port) { struct timeval tv = { 5, 0 }; struct ping_req **reqs; diff --git a/usr.sbin/ypbind/ypbind.c b/usr.sbin/ypbind/ypbind.c index 38924877f4e5..8b85e9532ab0 100644 --- a/usr.sbin/ypbind/ypbind.c +++ b/usr.sbin/ypbind/ypbind.c @@ -156,10 +156,7 @@ fd_set fdsr; SVCXPRT *udptransp, *tcptransp; void * -ypbindproc_null_2_yp(transp, argp, clnt) -SVCXPRT *transp; -void *argp; -CLIENT *clnt; +ypbindproc_null_2_yp(SVCXPRT *transp, void *argp, CLIENT *clnt) { static char res; @@ -168,10 +165,7 @@ CLIENT *clnt; } struct ypbind_resp * -ypbindproc_domain_2_yp(transp, argp, clnt) -SVCXPRT *transp; -domainname *argp; -CLIENT *clnt; +ypbindproc_domain_2_yp(SVCXPRT *transp, domainname *argp, CLIENT *clnt) { static struct ypbind_resp res; struct _dom_binding *ypdb; @@ -241,10 +235,7 @@ rejecting.", *argp); } void * -ypbindproc_setdom_2_yp(transp, argp, clnt) -SVCXPRT *transp; -ypbind_setdom *argp; -CLIENT *clnt; +ypbindproc_setdom_2_yp(SVCXPRT *transp, ypbind_setdom *argp, CLIENT *clnt) { struct sockaddr_in *fromsin, bindsin; static char *result = NULL; @@ -291,9 +282,7 @@ rejecting.", argp->ypsetdom_domain); } static void -ypbindprog_2(rqstp, transp) -struct svc_req *rqstp; -register SVCXPRT *transp; +ypbindprog_2(struct svc_req *rqstp, register SVCXPRT *transp) { union { domainname ypbindproc_domain_2_arg; @@ -353,8 +342,8 @@ register SVCXPRT *transp; } /* Jack the reaper */ -void reaper(sig) -int sig; +void +reaper(int sig) { int st; @@ -362,8 +351,8 @@ int sig; children--; } -void terminate(sig) -int sig; +void +terminate(int sig) { struct _dom_binding *ypdb; char path[MAXPATHLEN]; @@ -386,9 +375,7 @@ int sig; } int -main(argc, argv) -int argc; -char **argv; +main(int argc, char *argv[]) { struct timeval tv; int i; @@ -513,7 +500,7 @@ char **argv; } void -checkwork() +checkwork(void) { struct _dom_binding *ypdb; @@ -533,8 +520,8 @@ checkwork() * doesn't always result in an error (otherwise I would have caught * the mistake much sooner), even though logically it should. */ -void handle_children(ypdb) -struct _dom_binding *ypdb; +void +handle_children(struct _dom_binding *ypdb) { char buf[YPMAXDOMAIN + 1]; struct sockaddr_in addr; @@ -590,9 +577,7 @@ struct _dom_binding *ypdb; * Send our dying words back to our parent before we perish. */ int -tell_parent(dom, addr) -char *dom; -struct sockaddr_in *addr; +tell_parent(char *dom, struct sockaddr_in *addr) { char buf[YPMAXDOMAIN + 1]; struct timeval timeout; @@ -658,8 +643,7 @@ struct sockaddr_in *addr; * the 'eachresult' callback function. */ void -broadcast(ypdb) -struct _dom_binding *ypdb; +broadcast(struct _dom_binding *ypdb) { bool_t out = FALSE; enum clnt_stat stat; @@ -772,8 +756,7 @@ struct _dom_binding *ypdb; * need it to keep the system on its feet. */ int -ping(ypdb) -struct _dom_binding *ypdb; +ping(struct _dom_binding *ypdb) { bool_t out; struct timeval interval, timeout; @@ -819,10 +802,8 @@ struct _dom_binding *ypdb; return(0); } -void rpc_received(dom, raddrp, force) -char *dom; -struct sockaddr_in *raddrp; -int force; +void +rpc_received(char *dom, struct sockaddr_in *raddrp, int force) { struct _dom_binding *ypdb, *prev = NULL; struct iovec iov[2]; @@ -965,8 +946,7 @@ int force; * 1 if not matched. */ int -verify(addr) -struct in_addr addr; +verify(struct in_addr addr) { int i; @@ -983,8 +963,7 @@ struct in_addr addr; * resolve the specified hostnames. */ void -yp_restricted_mode(args) -char *args; +yp_restricted_mode(char *args) { struct hostent *h; int i = 0; diff --git a/usr.sbin/yppoll/yppoll.c b/usr.sbin/yppoll/yppoll.c index ce66c9fb8cc5..c528b0dc27a8 100644 --- a/usr.sbin/yppoll/yppoll.c +++ b/usr.sbin/yppoll/yppoll.c @@ -48,15 +48,14 @@ static const char rcsid[] = #include static void -usage() +usage(void) { fprintf(stderr, "usage: yppoll [-h host] [-d domainname] mapname\n"); exit(1); } int -main(argc, argv) -char **argv; +main(int argc, char *argv[]) { char *domainname; char *hostname = "localhost"; diff --git a/usr.sbin/yppush/yppush_main.c b/usr.sbin/yppush/yppush_main.c index 38043a57cf70..8620047357e3 100644 --- a/usr.sbin/yppush/yppush_main.c +++ b/usr.sbin/yppush/yppush_main.c @@ -88,8 +88,8 @@ struct jobs *yppush_joblist; /* Linked list of running jobs. */ /* * Local error messages. */ -static char *yppusherr_string(err) - int err; +static char * +yppusherr_string(int err) { switch (err) { case YPPUSH_TIMEDOUT: return("transfer or callback timed out"); @@ -103,9 +103,8 @@ static char *yppusherr_string(err) /* * Report state of a job. */ -static int yppush_show_status(status, tid) - ypxfrstat status; - unsigned long tid; +static int +yppush_show_status(ypxfrstat status, unsigned long tid) { struct jobs *job; @@ -142,8 +141,8 @@ static int yppush_show_status(status, tid) } /* Exit routine. */ -static void yppush_exit(now) - int now; +static void +yppush_exit(int now) { struct jobs *jptr; int still_pending = 1; @@ -203,8 +202,8 @@ to %s (transid = %lu) still pending", jptr->server, jptr->tid); * Handler for 'normal' signals. */ -static void handler(sig) - int sig; +static void +handler(int sig) { if (sig == SIGTERM || sig == SIGINT || sig == SIGABRT) { yppush_jobs = 0; @@ -222,7 +221,8 @@ static void handler(sig) /* * Dispatch loop for callback RPC services. */ -static void yppush_svc_run() +static void +yppush_svc_run(void) { #ifdef FD_SETSIZE fd_set readfds; @@ -262,8 +262,8 @@ retry: * events here, which will occur when the callback handler has * something interesting to tell us. */ -static void async_handler(sig) - int sig; +static void +async_handler(int sig) { yppush_svc_run(); @@ -296,8 +296,8 @@ yppushproc_xfrresp_1_svc(yppushresp_xfr *argp, struct svc_req *rqstp) /* * Transmit a YPPROC_XFR request to ypserv. */ -static int yppush_send_xfr(job) - struct jobs *job; +static int +yppush_send_xfr(struct jobs *job) { ypreq_xfr req; /* ypresp_xfr *resp; */ @@ -384,10 +384,8 @@ create udp handle to NIS server")); * request to the internal list, send the YPPROC_XFR request to ypserv * do other magic things. */ -int yp_push(server, map, tid) - char *server; - char *map; - unsigned long tid; +int +yp_push(char *server, char *map, unsigned long tid) { unsigned long prognum; int sock = RPC_ANYSOCK; @@ -470,13 +468,9 @@ int yp_push(server, map, tid) * Called for each entry in the ypservers map from yp_get_map(), which * is our private yp_all() routine. */ -int yppush_foreach(status, key, keylen, val, vallen, data) - int status; - char *key; - int keylen; - char *val; - int vallen; - char *data; +int +yppush_foreach(int status, char *key, int keylen, char *val, int vallen, + char *data) { char server[YPMAXRECORD + 2]; @@ -530,9 +524,7 @@ static void usage() * Entry point. (About time!) */ int -main(argc,argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int ch; DBT key, data; @@ -666,7 +658,7 @@ main(argc,argv) tmp = yppush_hostlist; while (tmp) { yppush_foreach(YP_TRUE, NULL, 0, tmp->name, - strlen(tmp->name)); + strlen(tmp->name), NULL); tmp = tmp->next; } } else { diff --git a/usr.sbin/ypserv/yp_access.c b/usr.sbin/ypserv/yp_access.c index 610f209a35cb..d5e8f5acb02d 100644 --- a/usr.sbin/ypserv/yp_access.c +++ b/usr.sbin/ypserv/yp_access.c @@ -90,7 +90,8 @@ char *yp_procs[] = { "ypoldproc_null", #ifdef TCP_WRAPPER -void load_securenets() +void +load_securenets(void) { } #else @@ -109,7 +110,8 @@ struct securenet *securenets; * list. If the file doesn't exist, we set up a dummy entry that * allows all hosts to connect. */ -void load_securenets() +void +load_securenets(void) { FILE *fp; char path[MAXPATHLEN + 2]; @@ -211,15 +213,12 @@ void load_securenets() */ #ifdef DB_CACHE -int yp_access(map, domain, rqstp) +int +yp_access(const char *map, const char *domain, const struct svc_req *rqstp) #else -int yp_access(map, rqstp) +int +yp_access(const char *map, const struct svc_req *rqstp) #endif - const char *map; -#ifdef DB_CACHE - const char *domain; -#endif - const struct svc_req *rqstp; { struct sockaddr_in *rqhost; int status = 0; @@ -304,8 +303,8 @@ not privileged", map, inet_ntoa(rqhost->sin_addr), ntohs(rqhost->sin_port)); } -int yp_validdomain(domain) - const char *domain; +int +yp_validdomain(const char *domain) { struct stat statbuf; char dompath[MAXPATHLEN + 2]; diff --git a/usr.sbin/ypserv/yp_dblookup.c b/usr.sbin/ypserv/yp_dblookup.c index 984736bc0ea2..23ab2a288bc2 100644 --- a/usr.sbin/ypserv/yp_dblookup.c +++ b/usr.sbin/ypserv/yp_dblookup.c @@ -89,7 +89,8 @@ struct circleq_entry { /* * Initialize the circular queue. */ -void yp_init_dbs() +void +yp_init_dbs(void) { TAILQ_INIT(&qhead); return; @@ -99,7 +100,8 @@ void yp_init_dbs() * Dynamically allocate an entry for the circular queue. * Return a NULL pointer on failure. */ -static struct circleq_entry *yp_malloc_qent() +static struct circleq_entry * +yp_malloc_qent(void) { register struct circleq_entry *q; @@ -124,8 +126,8 @@ static struct circleq_entry *yp_malloc_qent() * Free a previously allocated circular queue * entry. */ -static void yp_free_qent(q) - struct circleq_entry *q; +static void +yp_free_qent(struct circleq_entry *q) { /* * First, close the database. In theory, this is also @@ -162,7 +164,8 @@ static void yp_free_qent(q) * all its resources. (This always removes the last entry * in the queue.) */ -static void yp_flush() +static void +yp_flush(void) { register struct circleq_entry *qptr; @@ -177,7 +180,8 @@ static void yp_flush() /* * Close all databases, erase all database names and empty the queue. */ -void yp_flush_all() +void +yp_flush_all(void) { register struct circleq_entry *qptr; @@ -196,8 +200,8 @@ static char *secure_string = "YP_SECURE"; static int inter_sz = sizeof("YP_INTERDOMAIN") - 1; static int secure_sz = sizeof("YP_SECURE") - 1; -static int yp_setflags(dbp) - DB *dbp; +static int +yp_setflags(DB *dbp) { DBT key = { NULL, 0 }, data = { NULL, 0 }; int flags = 0; @@ -217,10 +221,8 @@ static int yp_setflags(dbp) return(flags); } -int yp_testflag(map, domain, flag) - char *map; - char *domain; - int flag; +int +yp_testflag(char *map, char *domain, int flag) { char buf[MAXPATHLEN + 2]; register struct circleq_entry *qptr; @@ -256,10 +258,8 @@ int yp_testflag(map, domain, flag) * a new entry when all our slots are already filled, we have to kick * out the entry in the last slot to make room. */ -static int yp_cache_db(dbp, name, size) - DB *dbp; - char *name; - int size; +static int +yp_cache_db(DB *dbp, char *name, int size) { register struct circleq_entry *qptr; @@ -317,10 +317,8 @@ static int yp_cache_db(dbp, name, size) * so that it will be easier to find if another request for * the same database comes in later. */ -static DB *yp_find_db(name, key, size) - char *name; - char *key; - int size; +static DB * +yp_find_db(char *name, char *key, int size) { register struct circleq_entry *qptr; @@ -351,11 +349,9 @@ static DB *yp_find_db(name, key, size) * If so, we fetch the handle from the cache. If not, we try to open * the database and save the handle in the cache for later use. */ -DB *yp_open_db_cache(domain, map, key, size) - const char *domain; - const char *map; - const char *key; - const int size; +DB * +yp_open_db_cache(const char *domain, const char *map, const char *key, + const int size) { DB *dbp = NULL; char buf[MAXPATHLEN + 2]; @@ -387,9 +383,8 @@ DB *yp_open_db_cache(domain, map, key, size) /* * Open a DB database. */ -DB *yp_open_db(domain, map) - const char *domain; - const char *map; +DB * +yp_open_db(const char *domain, const char *map) { DB *dbp = NULL; char buf[MAXPATHLEN + 2]; @@ -455,16 +450,13 @@ again: */ #ifdef DB_CACHE -int yp_get_record(dbp,key,data,allow) - DB *dbp; +int +yp_get_record(DB *dbp, const DBT *key, DBT *data, int allow) #else -int yp_get_record(domain,map,key,data,allow) - const char *domain; - const char *map; +int +yp_get_record(const char *domain, const char *map, + const DBT *key, DBT *data, int allow) #endif - const DBT *key; - DBT *data; - int allow; { #ifndef DB_CACHE DB *dbp; @@ -522,11 +514,8 @@ int yp_get_record(domain,map,key,data,allow) return(YP_TRUE); } -int yp_first_record(dbp,key,data,allow) - const DB *dbp; - DBT *key; - DBT *data; - int allow; +int +yp_first_record(const DB *dbp, DBT *key, DBT *data, int allow) { int rval; #ifndef DB_CACHE @@ -576,12 +565,8 @@ int yp_first_record(dbp,key,data,allow) return(YP_TRUE); } -int yp_next_record(dbp,key,data,all,allow) - const DB *dbp; - DBT *key; - DBT *data; - int all; - int allow; +int +yp_next_record(const DB *dbp, DBT *key, DBT *data, int all, int allow) { static DBT lkey = { NULL, 0 }; static DBT ldata = { NULL, 0 }; @@ -672,11 +657,8 @@ int yp_next_record(dbp,key,data,all,allow) static DB *yp_currmap_db = NULL; static int yp_allow_db = 0; -ypstat yp_select_map(map, domain, key, allow) - char *map; - char *domain; - keydat *key; - int allow; +ypstat +yp_select_map(char *map, char *domain, keydat *key, int allow) { if (key == NULL) yp_currmap_db = yp_open_db_cache(domain, map, NULL, 0); @@ -689,9 +671,8 @@ ypstat yp_select_map(map, domain, key, allow) return(yp_errno); } -ypstat yp_getbykey(key, val) - keydat *key; - valdat *val; +ypstat +yp_getbykey(keydat *key, valdat *val) { DBT db_key = { NULL, 0 }, db_val = { NULL, 0 }; ypstat rval; @@ -710,9 +691,8 @@ ypstat yp_getbykey(key, val) return(rval); } -ypstat yp_firstbykey(key, val) - keydat *key; - valdat *val; +ypstat +yp_firstbykey(keydat *key, valdat *val) { DBT db_key = { NULL, 0 }, db_val = { NULL, 0 }; ypstat rval; @@ -729,9 +709,8 @@ ypstat yp_firstbykey(key, val) return(rval); } -ypstat yp_nextbykey(key, val) - keydat *key; - valdat *val; +ypstat +yp_nextbykey(keydat *key, valdat *val) { DBT db_key = { NULL, 0 }, db_val = { NULL, 0 }; ypstat rval; diff --git a/usr.sbin/ypserv/yp_dnslookup.c b/usr.sbin/ypserv/yp_dnslookup.c index 0abffcd144cc..016cbb0c483b 100644 --- a/usr.sbin/ypserv/yp_dnslookup.c +++ b/usr.sbin/ypserv/yp_dnslookup.c @@ -66,8 +66,8 @@ static const char rcsid[] = #include #include "yp_extern.h" -static char *parse(hp) - struct hostent *hp; +static char * +parse(struct hostent *hp) { static char result[MAXHOSTNAMELEN * 2]; int len,i; @@ -124,7 +124,8 @@ struct circleq_dnsentry { static int pending = 0; -int yp_init_resolver() +int +yp_init_resolver(void) { TAILQ_INIT(&qhead); if (!(_res.options & RES_INIT) && res_init() == -1) { @@ -142,7 +143,8 @@ int yp_init_resolver() return(0); } -static struct circleq_dnsentry *yp_malloc_dnsent() +static struct +circleq_dnsentry *yp_malloc_dnsent(void) { register struct circleq_dnsentry *q; @@ -159,9 +161,8 @@ static struct circleq_dnsentry *yp_malloc_dnsent() /* * Transmit a query. */ -static unsigned long yp_send_dns_query(name, type) - char *name; - int type; +static unsigned long +yp_send_dns_query(char *name, int type) { char buf[MAXPACKET]; int n; @@ -195,9 +196,8 @@ static unsigned long yp_send_dns_query(name, type) return(id); } -static struct circleq_dnsentry *yp_find_dnsqent(id, type) - unsigned long id; - int type; +static struct circleq_dnsentry * +yp_find_dnsqent(unsigned long id, int type) { register struct circleq_dnsentry *q; @@ -217,9 +217,8 @@ static struct circleq_dnsentry *yp_find_dnsqent(id, type) return (NULL); } -static void yp_send_dns_reply(q, buf) - struct circleq_dnsentry *q; - char *buf; +static void +yp_send_dns_reply(struct circleq_dnsentry *q, char *buf) { ypresponse result_v1; ypresp_val result_v2; @@ -254,8 +253,8 @@ static void yp_send_dns_reply(q, buf) */ bzero((char *)&result_v1, sizeof(result_v1)); result_v1.yp_resptype = YPRESP_VAL; -# define YPVAL ypresponse_u.yp_resp_valtype +#define YPVAL ypresponse_u.yp_resp_valtype if (buf == NULL) result_v1.YPVAL.stat = YP_NOKEY; else { @@ -314,7 +313,8 @@ static void yp_send_dns_reply(q, buf) * Decrement TTL on all queue entries, possibly nuking * any that have been around too long without being serviced. */ -void yp_prune_dnsq() +void +yp_prune_dnsq(void) { register struct circleq_dnsentry *q, *n; @@ -341,7 +341,8 @@ void yp_prune_dnsq() * Data is pending on the DNS socket; check for valid replies * to our queries and dispatch them to waiting clients. */ -void yp_run_dnsq() +void +yp_run_dnsq(void) { register struct circleq_dnsentry *q; char buf[sizeof(HEADER) + MAXPACKET]; @@ -425,9 +426,8 @@ void yp_run_dnsq() /* * Queue and transmit an asynchronous DNS hostname lookup. */ -ypstat yp_async_lookup_name(rqstp, name) - struct svc_req *rqstp; - char *name; +ypstat +yp_async_lookup_name(struct svc_req *rqstp, char *name) { register struct circleq_dnsentry *q; int type, len; @@ -479,9 +479,8 @@ ypstat yp_async_lookup_name(rqstp, name) /* * Queue and transmit an asynchronous DNS IP address lookup. */ -ypstat yp_async_lookup_addr(rqstp, addr) - struct svc_req *rqstp; - char *addr; +ypstat +yp_async_lookup_addr(struct svc_req *rqstp, char *addr) { register struct circleq_dnsentry *q; char buf[MAXHOSTNAMELEN]; diff --git a/usr.sbin/ypserv/yp_error.c b/usr.sbin/ypserv/yp_error.c index ce5b343742c7..020d5f7ea54d 100644 --- a/usr.sbin/ypserv/yp_error.c +++ b/usr.sbin/ypserv/yp_error.c @@ -41,8 +41,9 @@ static const char rcsid[] = * stolen from /usr/libexec/mail.local via ypserv */ -#include #include +#include +#include #include #include "yp_extern.h" @@ -51,18 +52,9 @@ extern int _rpcpmstart; extern char *progname; -#if __STDC__ -#include -#else -#include -#endif - -static void __verr(const char *fmt, _BSD_VA_LIST_ ap) __printflike(1, 0); - -static void __verr(fmt, ap) - const char *fmt; - _BSD_VA_LIST_ ap; +static void __verr(const char *fmt, va_list ap) __printflike(1, 0); +static void __verr(const char *fmt, va_list ap) { if (debug && !_rpcpmstart) { fprintf(stderr,"%s: ",progname); @@ -74,20 +66,10 @@ static void __verr(fmt, ap) } void -#ifdef __STDC__ yp_error(const char *fmt, ...) -#else -yp_error(fmt, va_list) - const char *fmt; - va_dcl -#endif { va_list ap; -#ifdef __STDC__ va_start(ap, fmt); -#else - va_start(ap); -#endif __verr(fmt,ap); va_end(ap); } diff --git a/usr.sbin/ypserv/yp_main.c b/usr.sbin/ypserv/yp_main.c index c31e3fdf8cf2..e7f6b0bbcaff 100644 --- a/usr.sbin/ypserv/yp_main.c +++ b/usr.sbin/ypserv/yp_main.c @@ -101,7 +101,7 @@ void _msgout(char* msg) pid_t yp_pid; static void -yp_svc_run() +yp_svc_run(void) { #ifdef FD_SETSIZE fd_set readfds; @@ -152,14 +152,15 @@ yp_svc_run() } } -static void unregister() +static void +unregister(void) { (void) pmap_unset(YPPROG, YPVERS); (void) pmap_unset(YPPROG, YPOLDVERS); } -static void reaper(sig) - int sig; +static void +reaper(int sig) { int status; int saved_errno; @@ -186,7 +187,8 @@ static void reaper(sig) return; } -static void usage() +static void +usage(void) { fprintf(stderr, "usage: ypserv [-h] [-d] [-n] [-p path]\n"); exit(1); @@ -223,9 +225,7 @@ closedown(int sig) } int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { register SVCXPRT *transp = NULL; int sock; diff --git a/usr.sbin/ypserv/yp_server.c b/usr.sbin/ypserv/yp_server.c index 37ab7ef543c5..80d9da99288f 100644 --- a/usr.sbin/ypserv/yp_server.c +++ b/usr.sbin/ypserv/yp_server.c @@ -56,7 +56,8 @@ int children = 0; #define ORDER_STRING "YP_LAST_MODIFIED" #define ORDER_SZ sizeof(ORDER_STRING) - 1 -static pid_t yp_fork() +static pid_t +yp_fork(void) { if (yp_pid != getpid()) { yp_error("child %d trying to fork!", getpid()); @@ -259,12 +260,9 @@ ypproc_next_2_svc(ypreq_key *argp, struct svc_req *rqstp) return (&result); } -static void ypxfr_callback(rval,addr,transid,prognum,port) - ypxfrstat rval; - struct sockaddr_in *addr; - unsigned int transid; - unsigned int prognum; - unsigned long port; +static void +ypxfr_callback(ypxfrstat rval, struct sockaddr_in *addr, unsigned int transid, + unsigned int prognum, unsigned long port) { CLIENT *clnt; int sock = RPC_ANYSOCK; @@ -655,8 +653,7 @@ ypproc_order_2_svc(ypreq_nokey *argp, struct svc_req *rqstp) return (&result); } -static void yp_maplist_free(yp_maplist) - struct ypmaplist *yp_maplist; +static void yp_maplist_free(struct ypmaplist *yp_maplist) { register struct ypmaplist *next; @@ -669,8 +666,8 @@ static void yp_maplist_free(yp_maplist) return; } -static struct ypmaplist *yp_maplist_create(domain) - const char *domain; +static struct ypmaplist * +yp_maplist_create(const char *domain) { char yp_mapdir[MAXPATHLEN + 2]; char yp_mapname[MAXPATHLEN + 2]; diff --git a/usr.sbin/ypserv/yp_svc_udp.c b/usr.sbin/ypserv/yp_svc_udp.c index b62f9f90d933..ea4fbcbc1705 100644 --- a/usr.sbin/ypserv/yp_svc_udp.c +++ b/usr.sbin/ypserv/yp_svc_udp.c @@ -48,8 +48,7 @@ static const char rcsid[] = */ unsigned long -svcudp_get_xid(xprt) - SVCXPRT *xprt; +svcudp_get_xid(SVCXPRT *xprt) { struct svc_dg_data *su; @@ -60,9 +59,7 @@ svcudp_get_xid(xprt) } unsigned long -svcudp_set_xid(xprt, xid) - SVCXPRT *xprt; - unsigned long xid; +svcudp_set_xid(SVCXPRT *xprt, unsigned long xid) { struct svc_dg_data *su; unsigned long old_xid; diff --git a/usr.sbin/ypset/ypset.c b/usr.sbin/ypset/ypset.c index 5b3e7cbba5d9..b75926a6c849 100644 --- a/usr.sbin/ypset/ypset.c +++ b/usr.sbin/ypset/ypset.c @@ -50,16 +50,14 @@ struct dom_binding{}; extern bool_t xdr_domainname(); static void -usage() +usage(void) { fprintf(stderr, "usage: ypset [-h host] [-d domain] server\n"); exit(1); } int -bind_tohost(sin, dom, server) -struct sockaddr_in *sin; -char *dom, *server; +bind_tohost(struct sockaddr_in *sin, char *dom, char *server) { struct ypbind_setdom ypsd; struct timeval tv; @@ -113,8 +111,7 @@ char *dom, *server; } int -main(argc, argv) -char **argv; +main(int argc, char *argv[]) { struct sockaddr_in sin; struct hostent *hent;