diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-07-19 02:38:41 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-07-19 02:38:41 +0000 |
commit | e2e599c8ed62c4886dfcebc74b0d3bf7436b418e (patch) | |
tree | 9a49861d623e3d5520a4114bbb545f3beb994dcf /usr.sbin/ypserv/yppush | |
parent | 1cccfea064ca712bce2bfdebd5da7f086362a656 (diff) |
4344 lines of KNF diff
Diffstat (limited to 'usr.sbin/ypserv/yppush')
-rw-r--r-- | usr.sbin/ypserv/yppush/yppush.c | 51 | ||||
-rw-r--r-- | usr.sbin/ypserv/yppush/yppush.h | 6 | ||||
-rw-r--r-- | usr.sbin/ypserv/yppush/yppush_err.c | 11 | ||||
-rw-r--r-- | usr.sbin/ypserv/yppush/yppush_proc.c | 27 | ||||
-rw-r--r-- | usr.sbin/ypserv/yppush/yppush_svc.c | 12 |
5 files changed, 39 insertions, 68 deletions
diff --git a/usr.sbin/ypserv/yppush/yppush.c b/usr.sbin/ypserv/yppush/yppush.c index 6807e2e444d..641b1b9f6c2 100644 --- a/usr.sbin/ypserv/yppush/yppush.c +++ b/usr.sbin/ypserv/yppush/yppush.c @@ -1,4 +1,4 @@ -/* $OpenBSD: yppush.c,v 1.16 2001/11/19 09:01:43 deraadt Exp $ */ +/* $OpenBSD: yppush.c,v 1.17 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1995 Mats O Jansson <moj@stacken.kth.se> @@ -32,7 +32,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: yppush.c,v 1.16 2001/11/19 09:01:43 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: yppush.c,v 1.17 2002/07/19 02:38:40 deraadt Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -43,6 +43,7 @@ static char rcsid[] = "$OpenBSD: yppush.c,v 1.16 2001/11/19 09:01:43 deraadt Exp #include <stdio.h> #include <unistd.h> #include <stdlib.h> +#include <signal.h> #include <ctype.h> #include <rpc/rpc.h> @@ -68,15 +69,14 @@ extern void yppush_xfrrespprog_1(struct svc_req *request, SVCXPRT *xprt); extern bool_t xdr_ypreq_xfr(XDR *, struct ypreq_xfr *); void -usage() +usage(void) { - fprintf(stderr, "Usage:\n"); - fprintf(stderr, "\typpush [-d domainname] [-h host] [-v] mapname\n"); + fprintf(stderr, "usage: yppush [-d domainname] [-h host] [-v] mapname\n"); exit(1); } void -_svc_run() +_svc_run(void) { fd_set *readfdsp = NULL; extern fd_set *__svc_fdset; @@ -116,12 +116,7 @@ _svc_run() } void -req_xfr(pid, prog, transp, host, client) -pid_t pid; -u_int prog; -SVCXPRT *transp; -char *host; -CLIENT *client; +req_xfr(pid_t pid, u_int prog, SVCXPRT *transp, char *host, CLIENT *client) { struct ypreq_xfr request; struct timeval tv; @@ -155,9 +150,7 @@ CLIENT *client; } void -push(inlen, indata) -int inlen; -char *indata; +push(int inlen, char *indata) { char host[MAXHOSTNAMELEN]; CLIENT *client; @@ -201,7 +194,7 @@ char *indata; return; } - switch(pid=fork()) { + switch (pid=fork()) { case -1: fprintf(stderr, "yppush: Cannot fork.\n"); exit(1); @@ -222,13 +215,8 @@ char *indata; } int -pushit(instatus, inkey, inkeylen, inval, invallen, indata) -int instatus; -char *inkey; -int inkeylen; -char *inval; -int invallen; -char *indata; +pushit(u_long instatus, char *inkey, int inkeylen, char *inval, int invallen, + void *indata) { if (instatus != YP_TRUE) return instatus; @@ -237,9 +225,7 @@ char *indata; } int -main(argc, argv) -int argc; -char **argv; +main(int argc, char *argv[]) { struct ypall_callback ypcb; extern char *optarg; @@ -257,7 +243,7 @@ char **argv; yp_get_default_domain(&domain); hostname = NULL; while ((c=getopt(argc, argv, "d:h:v")) != -1) - switch(c) { + switch (c) { case 'd': domain = optarg; break; @@ -291,12 +277,11 @@ char **argv; /* Check domain */ snprintf(map_path, sizeof map_path, "%s/%s", YP_DB_PATH, domain); if (!((stat(map_path, &finfo) == 0) && - ((finfo.st_mode & S_IFMT) == S_IFDIR))) { - fprintf(stderr, "yppush: Map does not exist.\n"); + ((finfo.st_mode & S_IFMT) == S_IFDIR))) { + fprintf(stderr, "yppush: Map does not exist.\n"); exit(1); } - - + /* Check map */ snprintf(map_path, sizeof map_path, "%s/%s/%s%s", YP_DB_PATH, domain, Map, YPDB_SUFFIX); @@ -304,7 +289,7 @@ char **argv; fprintf(stderr, "yppush: Map does not exist.\n"); exit(1); } - + snprintf(map_path, sizeof map_path, "%s/%s/%s", YP_DB_PATH, domain, Map); yp_databas = ypdb_open(map_path, 0, O_RDONLY); @@ -335,7 +320,6 @@ char **argv; } } } - yp_bind(Domain); @@ -362,4 +346,3 @@ char **argv; exit(0); } - diff --git a/usr.sbin/ypserv/yppush/yppush.h b/usr.sbin/ypserv/yppush/yppush.h index 5114d0f403b..5aa278e5bca 100644 --- a/usr.sbin/ypserv/yppush/yppush.h +++ b/usr.sbin/ypserv/yppush/yppush.h @@ -1,4 +1,4 @@ -/* $OpenBSD: yppush.h,v 1.5 2002/02/19 19:39:41 millert Exp $ */ +/* $OpenBSD: yppush.h,v 1.6 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1996 Mats O Jansson <moj@stacken.kth.se> @@ -68,8 +68,8 @@ typedef struct yppushresp_xfr yppushresp_xfr; #define YPPUSHPROC_XFRRESP ((u_long)1) __BEGIN_DECLS -bool_t xdr_yppush_status(XDR *, yppush_status*); -bool_t xdr_yppushresp_xfr(XDR *, yppushresp_xfr*); +bool_t xdr_yppush_status(XDR *, yppush_status *); +bool_t xdr_yppushresp_xfr(XDR *, yppushresp_xfr *); void * yppushproc_null_1(void *, CLIENT *); void * yppushproc_null_1_svc(void *, struct svc_req *); void * yppushproc_xfrresp_1(yppushresp_xfr *, CLIENT *); diff --git a/usr.sbin/ypserv/yppush/yppush_err.c b/usr.sbin/ypserv/yppush/yppush_err.c index 070bba2a9ab..c910dede8f2 100644 --- a/usr.sbin/ypserv/yppush/yppush_err.c +++ b/usr.sbin/ypserv/yppush/yppush_err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: yppush_err.c,v 1.3 2000/10/12 09:47:27 deraadt Exp $ */ +/* $OpenBSD: yppush_err.c,v 1.4 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1996 Mats O Jansson <moj@stacken.kth.se> @@ -32,17 +32,16 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: yppush_err.c,v 1.3 2000/10/12 09:47:27 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: yppush_err.c,v 1.4 2002/07/19 02:38:40 deraadt Exp $"; #endif /* not lint */ #include <rpcsvc/yp.h> char * -yppush_err_string(y) - enum yppush_status y; +yppush_err_string(enum yppush_status y) { - switch(y) { + switch (y) { case YPPUSH_SUCC: return ("Success"); case YPPUSH_AGE: @@ -75,6 +74,6 @@ yppush_err_string(y) return ("ypxfr error"); case YPPUSH_REFUSED: return ("Transfer request refused by ypserv"); - } + } return ("unknown error"); } diff --git a/usr.sbin/ypserv/yppush/yppush_proc.c b/usr.sbin/ypserv/yppush/yppush_proc.c index 6b5cab3abae..1c451984da9 100644 --- a/usr.sbin/ypserv/yppush/yppush_proc.c +++ b/usr.sbin/ypserv/yppush/yppush_proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: yppush_proc.c,v 1.4 2000/10/12 09:47:28 deraadt Exp $ */ +/* $OpenBSD: yppush_proc.c,v 1.5 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1996 Mats O Jansson <moj@stacken.kth.se> @@ -32,7 +32,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: yppush_proc.c,v 1.4 2000/10/12 09:47:28 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: yppush_proc.c,v 1.5 2002/07/19 02:38:40 deraadt Exp $"; #endif /* not lint */ #include <stdio.h> @@ -40,27 +40,21 @@ static char rcsid[] = "$OpenBSD: yppush_proc.c,v 1.4 2000/10/12 09:47:28 deraadt extern int Verbose; -void * -yppushproc_null_1_svc(argp, rqstp) - void *argp; - struct svc_req *rqstp; +void * +yppushproc_null_1_svc(void *argp, struct svc_req *rqstp) { - - static char* result; + static char *result; /* * insert server code here */ - return((void*) &result); + return((void *) &result); } -void * -yppushproc_xfrresp_1_svc(argp, rqstp) - yppushresp_xfr *argp; - struct svc_req *rqstp; +void * +yppushproc_xfrresp_1_svc(yppushresp_xfr *argp, struct svc_req *rqstp) { - - static char* result; + static char *result; /* * insert server code here @@ -68,6 +62,5 @@ yppushproc_xfrresp_1_svc(argp, rqstp) if ((argp->status < YPPUSH_SUCC) || Verbose) fprintf(stderr, "yppush: %s\n", yppush_err_string(argp->status)); - - return((void*) &result); + return((void *) &result); } diff --git a/usr.sbin/ypserv/yppush/yppush_svc.c b/usr.sbin/ypserv/yppush/yppush_svc.c index c900176b107..425b8ab2167 100644 --- a/usr.sbin/ypserv/yppush/yppush_svc.c +++ b/usr.sbin/ypserv/yppush/yppush_svc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: yppush_svc.c,v 1.7 2002/03/14 16:44:25 mpech Exp $ */ +/* $OpenBSD: yppush_svc.c,v 1.8 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1996 Mats O Jansson <moj@stacken.kth.se> @@ -32,7 +32,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: yppush_svc.c,v 1.7 2002/03/14 16:44:25 mpech Exp $"; +static char rcsid[] = "$OpenBSD: yppush_svc.c,v 1.8 2002/07/19 02:38:40 deraadt Exp $"; #endif /* not lint */ #include "yppush.h" @@ -57,8 +57,7 @@ int _rpcfdtype; /* Whether Stream or Datagram ? */ int _rpcsvcdirty; /* Still serving ? */ static -void _msgout(msg) - char *msg; +void _msgout(char *msg) { #ifdef RPC_SVC_FG if (_rpcpmstart) @@ -71,9 +70,7 @@ void _msgout(msg) } void -yppush_xfrrespprog_1(rqstp, transp) - struct svc_req *rqstp; - SVCXPRT *transp; +yppush_xfrrespprog_1(struct svc_req *rqstp, SVCXPRT *transp) { union { int fill; @@ -120,5 +117,4 @@ yppush_xfrrespprog_1(rqstp, transp) _rpcsvcdirty = 0; if (rqstp->rq_proc!=YPPUSHPROC_NULL) exit(0); - return; } |