diff options
author | Mike Pechkin <mpech@cvs.openbsd.org> | 2002-01-07 17:08:29 +0000 |
---|---|---|
committer | Mike Pechkin <mpech@cvs.openbsd.org> | 2002-01-07 17:08:29 +0000 |
commit | 7bc415c7f209856c24b29012229f4e70841ae723 (patch) | |
tree | f57134a22f6f70cf24497a7c10c6fea419080acb /libexec | |
parent | b12b94b216d073cf50a2a775a6abaeb20133bc52 (diff) |
While I'm here (next issue):
o) __progname;
o) remove #define LOG_DAEMON;
o) use openlog() before syslog();
o) write $version to stderr;
millert@ ok
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/identd/identd.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/libexec/identd/identd.c b/libexec/identd/identd.c index 7acf378ce29..b82f3809c91 100644 --- a/libexec/identd/identd.c +++ b/libexec/identd/identd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: identd.c,v 1.23 2002/01/07 08:13:31 mpech Exp $ */ +/* $OpenBSD: identd.c,v 1.24 2002/01/07 17:08:28 mpech Exp $ */ /* * This program is in the public domain and may be used freely by anyone @@ -36,6 +36,7 @@ #include "error.h" extern char *version; +extern char *__progname; int verbose_flag = 0; int debug_flag = 0; @@ -58,20 +59,15 @@ char *indirect_password = NULL; static pid_t child_pid; -#ifdef LOG_DAEMON -static int syslog_facility = LOG_DAEMON; -#endif - void usage() { syslog(LOG_ERR, - "identd [-i | -w | -b] [-t seconds] [-u uid] [-g gid] [-p port] " - "[-a address] [-c charset] [-noelVvmNUdh]"); + "%s [-i | -w | -b] [-t seconds] [-u uid] [-g gid] [-p port] " + "[-a address] [-c charset] [-noelVvmNUdh]", __progname); exit(2); } - /* * Return the name of the connecting host, or the IP number as a string. */ @@ -172,6 +168,7 @@ main(argc, argv) extern int optind; int ch; + openlog(__progname, LOG_PID, LOG_DAEMON); /* * Parse the command line arguments */ @@ -243,7 +240,7 @@ main(argc, argv) number_flag = 1; break; case 'V': /* Give version of this daemon */ - printf("[identd version %s]\r\n", version); + (void)fprintf(stderr, "[identd version %s]\r\n", version); exit(0); break; case 'v': /* Be verbose */ @@ -447,14 +444,9 @@ main(argc, argv) /* * Open the connection to the Syslog daemon if requested */ - if (syslog_flag) { -#ifdef LOG_DAEMON - openlog("identd", LOG_PID, syslog_facility); -#else - openlog("identd", LOG_PID); -#endif + if (syslog_flag) syslog(LOG_INFO, "Connection from %s", gethost(&sa)); - } + /* * Get local internet address */ |