From 8f640499e9439317b5c4c86c9e29cebdf7d2fcbd Mon Sep 17 00:00:00 2001 From: charnier Date: Mon, 13 Oct 1997 11:13:33 +0000 Subject: Use err(3). Add usage() and #includes. --- usr.sbin/rpc.statd/statd.c | 45 +++++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 24 deletions(-) (limited to 'usr.sbin/rpc.statd/statd.c') diff --git a/usr.sbin/rpc.statd/statd.c b/usr.sbin/rpc.statd/statd.c index 915cab5..0c08892 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 #include +#include #include +#include #include #include #include #include #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 ---------------------------------------------------------- */ /* -- cgit v1.1