summaryrefslogtreecommitdiffstats
path: root/usr.sbin/rpc.statd/statd.c
diff options
context:
space:
mode:
authorcharnier <charnier@FreeBSD.org>1997-10-13 11:13:33 +0000
committercharnier <charnier@FreeBSD.org>1997-10-13 11:13:33 +0000
commit8f640499e9439317b5c4c86c9e29cebdf7d2fcbd (patch)
tree8551f6336b076c1eac810d9b3c0620185755588a /usr.sbin/rpc.statd/statd.c
parent5b323e1a4836fcfb03b1e09ee91f62997da87f09 (diff)
downloadFreeBSD-src-8f640499e9439317b5c4c86c9e29cebdf7d2fcbd.zip
FreeBSD-src-8f640499e9439317b5c4c86c9e29cebdf7d2fcbd.tar.gz
Use err(3). Add usage() and #includes.
Diffstat (limited to 'usr.sbin/rpc.statd/statd.c')
-rw-r--r--usr.sbin/rpc.statd/statd.c45
1 files changed, 21 insertions, 24 deletions
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 <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 ---------------------------------------------------------- */
/*
OpenPOWER on IntegriCloud