summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2002-05-25 07:37:20 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2002-05-25 07:37:20 +0000
commit8f1785af9fa1ebeb3a6908817b4d3049da77b491 (patch)
tree8dd0ce422abd83f1b78a4e4f47ac91ca0b695be0
parent82c105ce95daf8d06b3fd723d76558f47248d8ca (diff)
__progname stuff; jason@ackley.net
-rw-r--r--usr.sbin/amd/amd/amd.c17
-rw-r--r--usr.sbin/amd/amd/get_args.c14
-rw-r--r--usr.sbin/amd/amd/xutil.c12
3 files changed, 16 insertions, 27 deletions
diff --git a/usr.sbin/amd/amd/amd.c b/usr.sbin/amd/amd/amd.c
index b0b32b389f1..53b62d68749 100644
--- a/usr.sbin/amd/amd/amd.c
+++ b/usr.sbin/amd/amd/amd.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)amd.c 8.1 (Berkeley) 6/6/93
- * $Id: amd.c,v 1.3 2002/05/25 07:33:36 deraadt Exp $
+ * $Id: amd.c,v 1.4 2002/05/25 07:37:19 deraadt Exp $
*/
#ifndef lint
@@ -62,7 +62,6 @@ static char copyright[] =
#include <rpcsvc/yp_prot.h>
char pid_fsname[16 + MAXHOSTNAMELEN]; /* "kiska.southseas.nz:(pid%d)" */
-char *progname; /* "amd" */
#ifdef HAS_HOST
#ifdef HOST_EXEC
char *host_helper;
@@ -213,20 +212,6 @@ char *argv[];
amd_state = Start;
/*
- * Determine program name
- */
- if (argv[0]) {
- progname = strrchr(argv[0], '/');
- if (progname && progname[1])
- progname++;
- else
- progname = argv[0];
- }
-
- if (!progname)
- progname = "amd";
-
- /*
* Initialise process id. This is kept
* cached since it is used for generating
* and using file handles.
diff --git a/usr.sbin/amd/amd/get_args.c b/usr.sbin/amd/amd/get_args.c
index 30d6c846c8d..6303354c03a 100644
--- a/usr.sbin/amd/amd/get_args.c
+++ b/usr.sbin/amd/amd/get_args.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)get_args.c 8.1 (Berkeley) 6/6/93
- * $Id: get_args.c,v 1.2 1997/01/15 23:43:45 millert Exp $
+ * $Id: get_args.c,v 1.3 2002/05/25 07:37:19 deraadt Exp $
*/
/*
@@ -51,6 +51,7 @@
extern int optind;
extern char *optarg;
+extern char *__progname;
#if defined(DEBUG) && defined(PARANOID)
char **gargv;
@@ -116,7 +117,7 @@ char *v[];
case 'a':
if (*optarg != '/') {
fprintf(stderr, "%s: -a option must begin with a '/'\n",
- progname);
+ __progname);
exit(1);
}
auto_dir = optarg;
@@ -216,7 +217,8 @@ char *v[];
#ifdef DEBUG
usage += debug_option(optarg);
#else
- fprintf(stderr, "%s: not compiled with DEBUG option -- sorry.\n", progname);
+ fprintf(stderr, "%s: not compiled with DEBUG option -- sorry.\n",
+ __progname);
#endif /* DEBUG */
break;
@@ -311,9 +313,9 @@ char *v[];
show_usage:
fprintf(stderr,
-"Usage: %s [-mnprv] [-a mnt_point] [-c cache_time] [-d domain]\n\
-\t[-k kernel_arch] [-l logfile|\"syslog\"] [-t afs_timeout]\n\
-\t[-w wait_timeout] [-C cluster_name]", progname);
+ "Usage: %s [-mnprv] [-a mnt_point] [-c cache_time] [-d domain]\n"
+ "\t[-k kernel_arch] [-l logfile|\"syslog\"] [-t afs_timeout]\n"
+ "\t[-w wait_timeout] [-C cluster_name]", __progname);
#if defined(HAS_HOST) && defined(HOST_EXEC)
fputs(" [-h host_helper]\n", stderr);
diff --git a/usr.sbin/amd/amd/xutil.c b/usr.sbin/amd/amd/xutil.c
index c3ac88f5dbd..f5e6c1dec99 100644
--- a/usr.sbin/amd/amd/xutil.c
+++ b/usr.sbin/amd/amd/xutil.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)xutil.c 8.1 (Berkeley) 6/6/93
- * $Id: xutil.c,v 1.4 2001/03/02 06:22:05 deraadt Exp $
+ * $Id: xutil.c,v 1.5 2002/05/25 07:37:19 deraadt Exp $
*/
#include "config.h"
@@ -58,6 +58,8 @@ int syslogging;
int xlog_level = XLOG_ALL & ~XLOG_MAP & ~XLOG_STATS;
int xlog_level_init = ~0;
+extern char *__progname;
+
/*
* List of log options
*/
@@ -156,7 +158,7 @@ extern struct mallinfo __mallinfo;
if (orig_mem_bytes == 0)
mem_bytes = orig_mem_bytes = __mallinfo.uordbytes;
else {
- fprintf(logfp, "%s[%d]: ", progname, mypid);
+ fprintf(logfp, "%s[%d]: ", __progname, mypid);
if (mem_bytes < __mallinfo.uordbytes) {
fprintf(logfp, "ALLOC: %d bytes",
__mallinfo.uordbytes - mem_bytes);
@@ -252,7 +254,7 @@ extern char **gargv;
#if defined(DEBUG) && defined(PARANOID)
gargv[0],
#else
- progname,
+ __progname,
#endif /* defined(DEBUG) && defined(PARANOID) */
mypid,
sev);
@@ -451,11 +453,11 @@ char *logfile;
syslogging = 1;
new_logfp = stderr;
#if defined(LOG_CONS) && defined(LOG_NOWAIT)
- openlog(progname, LOG_PID|LOG_CONS|LOG_NOWAIT,
+ openlog(__progname, LOG_PID|LOG_CONS|LOG_NOWAIT,
LOG_DAEMON);
#else
/* 4.2 compat mode - XXX */
- openlog(progname, LOG_PID);
+ openlog(__progname, LOG_PID);
#endif /* LOG_CONS && LOG_NOWAIT */
#else
plog(XLOG_WARNING, "syslog option not supported, logging unchanged");