diff options
author | Philippe Charnier <charnier@FreeBSD.org> | 1997-10-13 11:13:33 +0000 |
---|---|---|
committer | Philippe Charnier <charnier@FreeBSD.org> | 1997-10-13 11:13:33 +0000 |
commit | df82e9ba02c7ea6099480b44d09a741c4293ba62 (patch) | |
tree | 150c279fd834e2c448b213619744ed4ef2d0c0d2 /usr.sbin/rpc.statd/statd.c | |
parent | 5dbfe9a1380b39d1cdf17ec8d9bcbcdaa5f1cc3a (diff) | |
download | src-df82e9ba02c7ea6099480b44d09a741c4293ba62.tar.gz src-df82e9ba02c7ea6099480b44d09a741c4293ba62.zip |
Use err(3). Add usage() and #includes.
Notes
Notes:
svn path=/head/; revision=30376
Diffstat (limited to 'usr.sbin/rpc.statd/statd.c')
-rw-r--r-- | usr.sbin/rpc.statd/statd.c | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/usr.sbin/rpc.statd/statd.c b/usr.sbin/rpc.statd/statd.c index 915cab55c97f..0c0889239985 100644 --- a/usr.sbin/rpc.statd/statd.c +++ b/usr.sbin/rpc.statd/statd.c @@ -31,28 +31,33 @@ * */ +#ifndef lint +static const char rcsid[] = + "$Id$"; +#endif /* not lint */ /* main() function for status monitor daemon. Some of the code in this */ /* file was generated by running rpcgen /usr/include/rpcsvc/sm_inter.x */ /* The actual program logic is in the file procs.c */ +#include <err.h> #include <stdio.h> +#include <stdlib.h> #include <rpc/rpc.h> +#include <rpc/pmap_clnt.h> #include <syslog.h> #include <sys/types.h> #include <sys/wait.h> #include <signal.h> #include "statd.h" -#ifndef lint -static char rcsid[] = "$id: $"; -#endif /* not lint */ - int debug = 0; /* Controls syslog() calls for debug messages */ extern void sm_prog_1(struct svc_req *rqstp, SVCXPRT *transp); static void handle_sigchld(); +static void usage __P((void)); +int main(int argc, char **argv) { SVCXPRT *transp; @@ -61,10 +66,7 @@ main(int argc, char **argv) if (argc > 1) { if (strcmp(argv[1], "-d")) - { - fprintf(stderr, "Usage: rpc.statd [-d]\n"); - exit(1); - } + usage(); debug = 1; } @@ -72,26 +74,15 @@ main(int argc, char **argv) transp = svcudp_create(RPC_ANYSOCK); if (transp == NULL) - { - fprintf(stderr, "cannot create udp service.\n"); - exit(1); - } + errx(1, "cannot create udp service"); if (!svc_register(transp, SM_PROG, SM_VERS, sm_prog_1, IPPROTO_UDP)) - { - fprintf(stderr, "unable to register (SM_PROG, SM_VERS, udp).\n"); - exit(1); - } + errx(1, "unable to register (SM_PROG, SM_VERS, udp)"); transp = svctcp_create(RPC_ANYSOCK, 0, 0); if (transp == NULL) - { - fprintf(stderr, "cannot create tcp service.\n"); - exit(1); - } - if (!svc_register(transp, SM_PROG, SM_VERS, sm_prog_1, IPPROTO_TCP)) { - fprintf(stderr, "unable to register (SM_PROG, SM_VERS, tcp).\n"); - exit(1); - } + errx(1, "cannot create tcp service"); + if (!svc_register(transp, SM_PROG, SM_VERS, sm_prog_1, IPPROTO_TCP)) + errx(1, "unable to register (SM_PROG, SM_VERS, tcp)"); init_file("/var/db/statd.status"); /* Note that it is NOT sensible to run this program from inetd - the */ @@ -116,6 +107,12 @@ main(int argc, char **argv) exit(1); } +static void +usage() +{ + fprintf(stderr, "usage: rpc.statd [-d]\n"); + exit(1); +} /* handle_sigchld ---------------------------------------------------------- */ /* |