diff options
author | 2002-07-19 03:16:24 +0000 | |
---|---|---|
committer | 2002-07-19 03:16:24 +0000 | |
commit | 7bcc963dfd22311361f344aa3b51c3ea66ec6475 (patch) | |
tree | 3fa75697eff159a96fffc1fae2eee67f976cd708 | |
parent | 4344 lines of KNF diff (diff) | |
download | wireguard-openbsd-7bcc963dfd22311361f344aa3b51c3ea66ec6475.tar.xz wireguard-openbsd-7bcc963dfd22311361f344aa3b51c3ea66ec6475.zip |
ansi
-rw-r--r-- | usr.bin/ypcat/ypcat.c | 24 | ||||
-rw-r--r-- | usr.bin/ypmatch/ypmatch.c | 25 | ||||
-rw-r--r-- | usr.bin/ypwhich/ypwhich.c | 52 | ||||
-rw-r--r-- | usr.sbin/yppoll/yppoll.c | 33 | ||||
-rw-r--r-- | usr.sbin/ypset/ypset.c | 31 |
5 files changed, 65 insertions, 100 deletions
diff --git a/usr.bin/ypcat/ypcat.c b/usr.bin/ypcat/ypcat.c index e7177ac21f2..35f058d3158 100644 --- a/usr.bin/ypcat/ypcat.c +++ b/usr.bin/ypcat/ypcat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ypcat.c,v 1.7 2002/01/02 20:07:09 deraadt Exp $ */ +/* $OpenBSD: ypcat.c,v 1.8 2002/07/19 03:21:41 deraadt Exp $ */ /* * Copyright (c) 1992, 1993, 1996 Theo de Raadt <deraadt@theos.com> @@ -33,7 +33,7 @@ */ #ifndef LINT -static char rcsid[] = "$OpenBSD: ypcat.c,v 1.7 2002/01/02 20:07:09 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: ypcat.c,v 1.8 2002/07/19 03:21:41 deraadt Exp $"; #endif #include <sys/param.h> @@ -66,7 +66,7 @@ struct ypalias { int key; void -usage() +usage(void) { fprintf(stderr, "Usage:\n"); fprintf(stderr, "\typcat [-k] [-d domainname] [-t] mapname\n"); @@ -75,13 +75,8 @@ usage() } int -printit(instatus, inkey, inkeylen, inval, invallen, indata) -int instatus; -char *inkey; -int inkeylen; -char *inval; -int invallen; -char *indata; +printit(u_long instatus, char *inkey, int inkeylen, char *inval, int invallen, + void *indata) { if (instatus != YP_TRUE) return instatus; @@ -92,16 +87,13 @@ char *indata; } int -main(argc, argv) -char **argv; +main(int argc, char *argv[]) { - char *domain = NULL; + char *domain = NULL, *inmap; struct ypall_callback ypcb; - char *inmap; extern char *optarg; extern int optind; - int notrans; - int c, r, i; + int notrans, c, r, i; notrans = key = 0; while ((c=getopt(argc, argv, "xd:kt")) != -1) diff --git a/usr.bin/ypmatch/ypmatch.c b/usr.bin/ypmatch/ypmatch.c index 0750793e34a..8633476deec 100644 --- a/usr.bin/ypmatch/ypmatch.c +++ b/usr.bin/ypmatch/ypmatch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ypmatch.c,v 1.7 2002/06/02 06:42:28 deraadt Exp $ */ +/* $OpenBSD: ypmatch.c,v 1.8 2002/07/19 03:22:39 deraadt Exp $ */ /* $NetBSD: ypmatch.c,v 1.8 1996/05/07 01:24:52 jtc Exp $ */ /* @@ -34,7 +34,7 @@ */ #ifndef LINT -static char rcsid[] = "$OpenBSD: ypmatch.c,v 1.7 2002/06/02 06:42:28 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: ypmatch.c,v 1.8 2002/07/19 03:22:39 deraadt Exp $"; #endif #include <sys/param.h> @@ -64,7 +64,7 @@ struct ypalias { }; void -usage() +usage(void) { fprintf(stderr, "Usage:\n"); fprintf(stderr, "\typmatch [-d domain] [-t] [-k] key [key ...] mname\n"); @@ -78,20 +78,17 @@ usage() } int -main(argc, argv) -char **argv; +main(int argc, char *argv[]) { - char *domainname; - char *inkey, *inmap, *outbuf; + char *domainname, *inkey, *inmap, *outbuf; extern char *optarg; extern int optind; - int outbuflen, key, notrans; + int outbuflen, key, notrans, rval; int c, r, i; - int rval; domainname = NULL; notrans = key = 0; - while( (c=getopt(argc, argv, "xd:kt")) != -1) + while ((c=getopt(argc, argv, "xd:kt")) != -1) switch (c) { case 'x': for(i=0; i<sizeof ypaliases/sizeof ypaliases[0]; i++) @@ -112,7 +109,7 @@ char **argv; usage(); } - if( (argc-optind) < 2 ) + if ((argc-optind) < 2 ) usage(); if (!domainname) { @@ -122,7 +119,7 @@ char **argv; inmap = argv[argc-1]; if (!notrans) { for(i=0; i<sizeof ypaliases/sizeof ypaliases[0]; i++) - if( strcmp(inmap, ypaliases[i].alias) == 0) + if (strcmp(inmap, ypaliases[i].alias) == 0) inmap = ypaliases[i].name; } @@ -134,7 +131,7 @@ char **argv; strlen(inkey), &outbuf, &outbuflen); switch (r) { case 0: - if(key) + if (key) printf("%s: ", inkey); printf("%*.*s\n", outbuflen, outbuflen, outbuf); break; @@ -143,7 +140,7 @@ char **argv; exit(1); default: fprintf(stderr, "Can't match key %s in map %s. Reason: %s\n", - inkey, inmap, yperr_string(r)); + inkey, inmap, yperr_string(r)); rval = 1; break; } diff --git a/usr.bin/ypwhich/ypwhich.c b/usr.bin/ypwhich/ypwhich.c index 2e7fdfd5bf5..d9864542837 100644 --- a/usr.bin/ypwhich/ypwhich.c +++ b/usr.bin/ypwhich/ypwhich.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ypwhich.c,v 1.12 2002/06/02 06:42:28 deraadt Exp $ */ +/* $OpenBSD: ypwhich.c,v 1.13 2002/07/19 03:20:17 deraadt Exp $ */ /* $NetBSD: ypwhich.c,v 1.6 1996/05/13 02:43:48 thorpej Exp $ */ /* @@ -34,7 +34,7 @@ */ #ifndef LINT -static char rcsid[] = "$Id: ypwhich.c,v 1.12 2002/06/02 06:42:28 deraadt Exp $"; +static char rcsid[] = "$Id: ypwhich.c,v 1.13 2002/07/19 03:20:17 deraadt Exp $"; #endif #include <sys/param.h> @@ -73,11 +73,11 @@ struct ypalias { }; void -usage() +usage(void) { - fprintf(stderr, "Usage:\n"); - fprintf(stderr, "\typwhich [-d domain] [[-h host] [-t] -m [mname] | host]\n"); - fprintf(stderr, "\typwhich -x\n"); + fprintf(stderr, + "usage: ypwhich [-d domain] [[-h host] [-t] -m [mname] | host]\n"); + fprintf(stderr, " ypwhich -x\n"); exit(1); } @@ -86,16 +86,14 @@ usage() * Like yp_bind except can query a specific host */ int -bind_host(dom, sin) -char *dom; -struct sockaddr_in *sin; +bind_host(char *dom, struct sockaddr_in *sin) { struct hostent *hent = NULL; struct ypbind_resp ypbr; + struct in_addr ss_addr; struct timeval tv; CLIENT *client; int sock, r; - struct in_addr ss_addr; sock = RPC_ANYSOCK; tv.tv_sec = 15; @@ -139,22 +137,17 @@ struct sockaddr_in *sin; return 0; } - + int -main(argc, argv) - int argc; - char **argv; +main(int argc, char *argv[]) { - char *domain, *master, *map; + char *domain, *master, *map = NULL, *host = NULL; + int notrans, mode, getmap, c, r, i; struct ypmaplist *ypml, *y; - struct hostent *hent; struct sockaddr_in sin; - int notrans, mode, getmap; - int c, r, i; - CLIENT *client; - char *host = NULL; + struct hostent *hent; + CLIENT *client = NULL; - map = NULL; getmap = notrans = mode = 0; yp_get_default_domain(&domain); @@ -221,21 +214,20 @@ main(argc, argv) if (argc > 1) usage(); - if (host != NULL) { + if (host != NULL) client = yp_bind_host(host,YPPROG,YPVERS,0,1); - } - + if (argv[0]) { map = argv[0]; for (i=0; (!notrans) && i<sizeof ypaliases/sizeof ypaliases[0]; i++) if (strcmp(map, ypaliases[i].alias) == 0) map = ypaliases[i].name; - if (host != NULL) { + if (host != NULL) r = yp_master_host(client, domain, map, &master); - } else { + else r = yp_master(domain, map, &master); - } + switch (r) { case 0: printf("%s\n", master); @@ -253,11 +245,11 @@ main(argc, argv) } ypml = NULL; - if (host != NULL) { + if (host != NULL) r = yp_maplist_host(client, domain, &ypml); - } else { + else r = yp_maplist(domain, &ypml); - } + r = 0; switch (r) { case 0: diff --git a/usr.sbin/yppoll/yppoll.c b/usr.sbin/yppoll/yppoll.c index 6e8087843bf..7ae7034f230 100644 --- a/usr.sbin/yppoll/yppoll.c +++ b/usr.sbin/yppoll/yppoll.c @@ -1,4 +1,4 @@ -/* $OpenBSD: yppoll.c,v 1.4 2002/05/30 19:09:06 deraadt Exp $ */ +/* $OpenBSD: yppoll.c,v 1.5 2002/07/19 03:16:24 deraadt Exp $ */ /* $NetBSD: yppoll.c,v 1.5 1996/05/13 02:46:36 thorpej Exp $ */ /* @@ -36,7 +36,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: yppoll.c,v 1.4 2002/05/30 19:09:06 deraadt Exp $"; +static char rcsid[] = "$Id: yppoll.c,v 1.5 2002/07/19 03:16:24 deraadt Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -56,30 +56,25 @@ static char rcsid[] = "$Id: yppoll.c,v 1.4 2002/05/30 19:09:06 deraadt Exp $"; #include <rpcsvc/ypclnt.h> void -usage() +usage(void) { - fprintf(stderr, "Usage:\n"); - fprintf(stderr, "\typpoll [-h host] [-d domainname] mapname\n"); + fprintf(stderr, "Usage: yppoll [-h host] [-d domainname] mapname\n"); exit(1); } int -get_remote_info(indomain, inmap, server, outorder, outname) - char *indomain; - char *inmap; - char *server; - int *outorder; - char **outname; +get_remote_info(char *indomain, char *inmap, char *server, int *outorder, + char **outname) { struct ypresp_order ypro; struct ypresp_master yprm; struct ypreq_nokey yprnk; struct timeval tv; - int r; struct sockaddr_in rsrv_sin; int rsrv_sock; CLIENT *client; struct hostent *h; + int r; bzero((char *)&rsrv_sin, sizeof rsrv_sin); rsrv_sin.sin_len = sizeof rsrv_sin; @@ -92,9 +87,8 @@ get_remote_info(indomain, inmap, server, outorder, outname) fprintf(stderr, "unknown host %s\n", server); exit(1); } - } else { + } else rsrv_sin.sin_addr.s_addr = *(u_int32_t *)h->h_addr; - } tv.tv_sec = 10; tv.tv_usec = 0; @@ -137,17 +131,12 @@ get_remote_info(indomain, inmap, server, outorder, outname) } int -main(argc, argv) - int argc; - char **argv; +main(int argc, char *argv[]) { - char *domainname; - char *hostname = NULL; - char *inmap, *master; - int order; + char *domainname, *hostname = NULL, *inmap, *master; extern char *optarg; extern int optind; - int c, r; + int order, c, r; yp_get_default_domain(&domainname); diff --git a/usr.sbin/ypset/ypset.c b/usr.sbin/ypset/ypset.c index 04651ce7182..bc4cfd764cb 100644 --- a/usr.sbin/ypset/ypset.c +++ b/usr.sbin/ypset/ypset.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ypset.c,v 1.6 2002/05/30 19:09:06 deraadt Exp $ */ +/* $OpenBSD: ypset.c,v 1.7 2002/07/19 03:17:43 deraadt Exp $ */ /* $NetBSD: ypset.c,v 1.8 1996/05/13 02:46:33 thorpej Exp $ */ /* @@ -34,7 +34,7 @@ */ #ifndef LINT -static char rcsid[] = "$OpenBSD: ypset.c,v 1.6 2002/05/30 19:09:06 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: ypset.c,v 1.7 2002/07/19 03:17:43 deraadt Exp $"; #endif #include <sys/param.h> @@ -54,27 +54,23 @@ static char rcsid[] = "$OpenBSD: ypset.c,v 1.6 2002/05/30 19:09:06 deraadt Exp $ extern bool_t xdr_domainname(); void -usage() +usage(void) { - fprintf(stderr, "Usage:\n"); - fprintf(stderr, "\typset [-h host ] [-d domain] server\n"); + 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; + struct in_addr iaddr; struct hostent *hp; + struct timeval tv; CLIENT *client; - int sock, port; - int r; - struct in_addr iaddr; + int sock, port, r; - if( (port=htons(getrpcport(server, YPPROG, YPPROC_NULL, IPPROTO_UDP))) == 0) { + if ((port=htons(getrpcport(server, YPPROG, YPPROC_NULL, IPPROTO_UDP))) == 0) { fprintf(stderr, "%s not running ypserv.\n", server); exit(1); } @@ -109,7 +105,7 @@ char *dom, *server; r = clnt_call(client, YPBINDPROC_SETDOM, xdr_ypbind_setdom, &ypsd, xdr_void, NULL, tv); - if(r) { + if (r) { fprintf(stderr, "Sorry, cannot ypset for domain %s on host.\n", dom); clnt_destroy(client); return YPERR_YPBIND; @@ -119,8 +115,7 @@ char *dom, *server; } int -main(argc, argv) -char **argv; +main(int argc, char *argv[]) { struct sockaddr_in sin; struct hostent *hent; @@ -135,7 +130,7 @@ char **argv; sin.sin_family = AF_INET; sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - while( (c=getopt(argc, argv, "h:d:")) != -1) + while ((c=getopt(argc, argv, "h:d:")) != -1) switch(c) { case 'd': domainname = optarg; @@ -156,7 +151,7 @@ char **argv; usage(); } - if(optind + 1 != argc ) + if (optind + 1 != argc ) usage(); if (bind_tohost(&sin, domainname, argv[optind])) |