Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/games/hunt/huntd - openlog "huntd" instead of "HUNT"



details:   https://anonhg.NetBSD.org/src/rev/652547824530
branches:  trunk
changeset: 501974:652547824530
user:      lukem <lukem%NetBSD.org@localhost>
date:      Tue Jan 09 23:49:54 2001 +0000

description:
- openlog "huntd" instead of "HUNT"
- consistently log non-critical errors at LOG_WARNING not LOG_ERR
- consistently use positive numbers for exit() and _exit()
- one warning was using printf() instead of syslog()

diffstat:

 games/hunt/huntd/driver.c    |  12 ++++++------
 games/hunt/huntd/faketalk.c  |  10 +++++-----
 games/hunt/huntd/get_names.c |  15 ++++++++++-----
 3 files changed, 21 insertions(+), 16 deletions(-)

diffs (137 lines):

diff -r e9e70f2f61b6 -r 652547824530 games/hunt/huntd/driver.c
--- a/games/hunt/huntd/driver.c Tue Jan 09 23:36:50 2001 +0000
+++ b/games/hunt/huntd/driver.c Tue Jan 09 23:49:54 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: driver.c,v 1.6 2000/04/14 05:58:03 simonb Exp $        */
+/*     $NetBSD: driver.c,v 1.7 2001/01/09 23:49:54 lukem Exp $ */
 /*
  *  Hunt
  *  Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
@@ -7,7 +7,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: driver.c,v 1.6 2000/04/14 05:58:03 simonb Exp $");
+__RCSID("$NetBSD: driver.c,v 1.7 2001/01/09 23:49:54 lukem Exp $");
 #endif /* not lint */
 
 # include      <sys/ioctl.h>
@@ -266,10 +266,10 @@
 
 # ifdef LOG
 # ifdef        SYSLOG_43
-       openlog("HUNT", LOG_PID, LOG_DAEMON);
+       openlog("huntd", LOG_PID, LOG_DAEMON);
 # endif
 # ifdef        SYSLOG_42
-       openlog("HUNT", LOG_PID);
+       openlog("huntd", LOG_PID);
 # endif
 # endif
 
@@ -907,7 +907,7 @@
                if (errno == EINTR)
                        return;
 # ifdef LOG
-               syslog(LOG_ERR, "accept: %m");
+               syslog(LOG_WARNING, "accept: %m");
 # else
                warn("accept");
 # endif
@@ -916,7 +916,7 @@
        fp = fdopen(s, "w");
        if (fp == NULL) {
 # ifdef LOG
-               syslog(LOG_ERR, "fdopen: %m");
+               syslog(LOG_WARNING, "fdopen: %m");
 # else
                warn("fdopen");
 # endif
diff -r e9e70f2f61b6 -r 652547824530 games/hunt/huntd/faketalk.c
--- a/games/hunt/huntd/faketalk.c       Tue Jan 09 23:36:50 2001 +0000
+++ b/games/hunt/huntd/faketalk.c       Tue Jan 09 23:49:54 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: faketalk.c,v 1.4 1997/10/11 08:13:48 lukem Exp $       */
+/*     $NetBSD: faketalk.c,v 1.5 2001/01/09 23:49:54 lukem Exp $       */
 /*
  *  Hunt
  *  Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
@@ -11,7 +11,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: faketalk.c,v 1.4 1997/10/11 08:13:48 lukem Exp $");
+__RCSID("$NetBSD: faketalk.c,v 1.5 2001/01/09 23:49:54 lukem Exp $");
 #endif /* not lint */
 
 #include "bsd.h"
@@ -123,7 +123,7 @@
 # else
                warn("falktalk:  socket");
 # endif
-               _exit(-1);
+               _exit(1);
        }
 
        if (connect(service, (struct sockaddr *) &des, sizeof(des)) != 0) {
@@ -132,7 +132,7 @@
 # else
                warn("faketalk:  connect");
 # endif
-               _exit(-1);
+               _exit(1);
        }
        if ((f = fdopen(service, "r")) == NULL) {
 # ifdef LOG
@@ -140,7 +140,7 @@
 # else
                warn("faketalk:  fdopen");
 # endif
-               _exit(-2);
+               _exit(2);
        }
 
        (void) fgets(buf, BUFSIZ, f);
diff -r e9e70f2f61b6 -r 652547824530 games/hunt/huntd/get_names.c
--- a/games/hunt/huntd/get_names.c      Tue Jan 09 23:36:50 2001 +0000
+++ b/games/hunt/huntd/get_names.c      Tue Jan 09 23:49:54 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: get_names.c,v 1.4 2000/07/03 03:57:41 matt Exp $       */
+/*     $NetBSD: get_names.c,v 1.5 2001/01/09 23:49:54 lukem Exp $      */
 /*
  * Copyright (c) 1983 Regents of the University of California.
  * All rights reserved.  The Berkeley software License Agreement
@@ -7,7 +7,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: get_names.c,v 1.4 2000/07/03 03:57:41 matt Exp $");
+__RCSID("$NetBSD: get_names.c,v 1.5 2001/01/09 23:49:54 lukem Exp $");
 #endif /* not lint */
 
 #include "bsd.h"
@@ -59,8 +59,13 @@
        /* look up the address of the local host */
        hp = gethostbyname(my_machine_name);
        if (hp == (struct hostent *) 0) {
-               printf("This machine doesn't exist. Boy, am I confused!\n");
-               exit(-1);
+# ifdef LOG
+               syslog(LOG_ERR,
+                   "This machine doesn't exist. Boy, am I confused!");
+# else
+               perror("This machine doesn't exist. Boy, am I confused!");
+# endif
+               exit(1);
        }
        memcpy(&my_machine_addr, hp->h_addr, hp->h_length);
        /* find the daemon portal */
@@ -75,7 +80,7 @@
 # else
                perror("This machine doesn't support talk");
 # endif
-               exit(-1);
+               exit(1);
        }
        daemon_port = sp->s_port;
 }



Home | Main Index | Thread Index | Old Index