convert to use getprogname()

This commit is contained in:
cgd 2001-02-19 22:43:42 +00:00
parent 0fd3d5e599
commit 65a1026492
11 changed files with 38 additions and 51 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pidfile.c,v 1.3 2000/07/05 11:46:41 ad Exp $ */
/* $NetBSD: pidfile.c,v 1.4 2001/02/19 22:43:42 cgd Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: pidfile.c,v 1.3 2000/07/05 11:46:41 ad Exp $");
__RCSID("$NetBSD: pidfile.c,v 1.4 2001/02/19 22:43:42 cgd Exp $");
#endif
#include <sys/param.h>
@ -52,8 +52,6 @@ static char *pidfile_path;
static void pidfile_cleanup(void);
extern const char *__progname; /* from crt0.o */
void
pidfile(const char *basename)
{
@ -63,7 +61,7 @@ pidfile(const char *basename)
return;
if (basename == NULL)
basename = __progname;
basename = getprogname();
/* _PATH_VARRUN includes trailing / */
(void) asprintf(&pidfile_path, "%s%s.pid", _PATH_VARRUN, basename);

View File

@ -1,4 +1,4 @@
/* $NetBSD: comsat.c,v 1.18 2001/02/04 21:59:52 christos Exp $ */
/* $NetBSD: comsat.c,v 1.19 2001/02/19 22:46:13 cgd Exp $ */
/*
* Copyright (c) 1980, 1993
@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
#if 0
static char sccsid[] = "from: @(#)comsat.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: comsat.c,v 1.18 2001/02/04 21:59:52 christos Exp $");
__RCSID("$NetBSD: comsat.c,v 1.19 2001/02/19 22:46:13 cgd Exp $");
#endif
#endif /* not lint */
@ -85,8 +85,6 @@ void notify (struct utmp *, off_t);
void onalrm (int);
void reapchildren (int);
extern char *__progname;
int
main(int argc, char *argv[])
{
@ -111,7 +109,7 @@ main(int argc, char *argv[])
logging = 1;
break;
default:
syslog(LOG_ERR, "Usage: %s [-l]", __progname);
syslog(LOG_ERR, "Usage: %s [-l]", getprogname());
exit(1);
}
if (chdir(_PATH_MAILDIR)) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: getNAME.c,v 1.18 2001/02/04 22:05:13 christos Exp $ */
/* $NetBSD: getNAME.c,v 1.19 2001/02/19 22:46:14 cgd Exp $ */
/*-
* Copyright (c) 1997, Christos Zoulas
@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
#if 0
static char sccsid[] = "@(#)getNAME.c 8.1 (Berkeley) 6/30/93";
#else
__RCSID("$NetBSD: getNAME.c,v 1.18 2001/02/04 22:05:13 christos Exp $");
__RCSID("$NetBSD: getNAME.c,v 1.19 2001/02/19 22:46:14 cgd Exp $");
#endif
#endif /* not lint */
@ -88,8 +88,6 @@ int main __P((int, char *[]));
/* The .SH NAMEs that are allowed. */
char *names[] = { "name", "namn", 0 };
extern char *__progname;
int
main(argc, argv)
int argc;
@ -534,6 +532,7 @@ again:
static void
usage()
{
(void)fprintf(stderr, "Usage: %s [-itw] file ...\n", __progname);
(void)fprintf(stderr, "Usage: %s [-itw] file ...\n", getprogname());
exit(1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.37 2001/02/04 22:09:01 christos Exp $ */
/* $NetBSD: main.c,v 1.38 2001/02/19 22:46:14 cgd Exp $ */
/*-
* Copyright (c) 1980, 1993
@ -44,7 +44,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
#if 0
static char sccsid[] = "from: @(#)main.c 8.1 (Berkeley) 6/20/93";
#else
__RCSID("$NetBSD: main.c,v 1.37 2001/02/04 22:09:01 christos Exp $");
__RCSID("$NetBSD: main.c,v 1.38 2001/02/19 22:46:14 cgd Exp $");
#endif
#endif /* not lint */
@ -78,7 +78,6 @@ __RCSID("$NetBSD: main.c,v 1.37 2001/02/04 22:09:01 christos Exp $");
#include "extern.h"
extern char **environ;
extern char *__progname;
extern char editedhost[];
/*
@ -195,6 +194,7 @@ main(argc, argv)
int argc;
char *argv[];
{
const char *progname;
char *tname;
int repcnt = 0, failopenlogged = 0, uugetty = 0, first_time = 1;
struct rlimit limit;
@ -216,7 +216,8 @@ main(argc, argv)
strcpy(hostname, "Amnesiac");
uname(&kerninfo);
if (__progname[0] == 'u' && __progname[1] == 'u')
progname = getprogname();
if (progname[0] == 'u' && progname[1] == 'u')
uugetty = 1;
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: makewhatis.c,v 1.12 2000/07/13 06:45:22 tron Exp $ */
/* $NetBSD: makewhatis.c,v 1.13 2001/02/19 22:46:14 cgd Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1999 The NetBSD Foundation, Inc.\n\
#endif /* not lint */
#ifndef lint
__RCSID("$NetBSD: makewhatis.c,v 1.12 2000/07/13 06:45:22 tron Exp $");
__RCSID("$NetBSD: makewhatis.c,v 1.13 2001/02/19 22:46:14 cgd Exp $");
#endif /* not lint */
#include <sys/types.h>
@ -102,8 +102,6 @@ char *default_manpath[] = {
char sectionext[] = "0123456789ln";
char whatisdb[] = "whatis.db";
extern char *__progname;
int
main(int argc,char **argv)
{
@ -119,7 +117,7 @@ main(int argc,char **argv)
manpath = (argc < 2) ? default_manpath : &argv[1];
if ((fts = fts_open(manpath, FTS_LOGICAL, NULL)) == NULL) {
perror(__progname);
perror(getprogname());
return EXIT_FAILURE;
}
@ -462,19 +460,19 @@ nroff(gzFile *in)
pid_t child;
if (gzrewind(in) < 0) {
perror(__progname);
perror(getprogname());
return NULL;
}
if ((devnull < 0) &&
((devnull = open(_PATH_DEVNULL, O_WRONLY, 0)) < 0)) {
perror(__progname);
perror(getprogname());
return NULL;
}
(void)strcpy(tempname, _PATH_TMP "makewhatis.XXXXXX");
if ((tempfd = mkstemp(tempname)) < 0) {
perror(__progname);
perror(getprogname());
return NULL;
}
@ -487,7 +485,7 @@ nroff(gzFile *in)
if ((bytes < 0) ||
(lseek(tempfd, 0, SEEK_SET) < 0) ||
(pipe(pipefd) < 0)) {
perror(__progname);
perror(getprogname());
(void)close(tempfd);
(void)unlink(tempname);
return NULL;
@ -495,7 +493,7 @@ nroff(gzFile *in)
switch (child = vfork()) {
case -1:
perror(__progname);
perror(getprogname());
(void)close(pipefd[1]);
(void)close(pipefd[0]);
(void)close(tempfd);
@ -527,7 +525,7 @@ nroff(gzFile *in)
if ((in = gzdopen(pipefd[0], "r")) == NULL) {
if (errno == 0)
errno = ENOMEM;
perror(__progname);
perror(getprogname());
(void)close(pipefd[0]);
(void)kill(child, SIGTERM);
while (waitpid(child, NULL, 0) != child);

View File

@ -1,4 +1,4 @@
/* $NetBSD: talkd.c,v 1.11 2001/02/04 22:16:34 christos Exp $ */
/* $NetBSD: talkd.c,v 1.12 2001/02/19 22:46:14 cgd Exp $ */
/*
* Copyright (c) 1983, 1993
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\
#if 0
static char sccsid[] = "@(#)talkd.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: talkd.c,v 1.11 2001/02/04 22:16:34 christos Exp $");
__RCSID("$NetBSD: talkd.c,v 1.12 2001/02/19 22:46:14 cgd Exp $");
#endif
#endif /* not lint */
@ -87,8 +87,6 @@ char hostname[MAXHOSTNAMELEN + 1];
static void timeout __P((int));
int main __P((int, char *[]));
extern char *__progname;
int
main(argc, argv)
int argc;
@ -107,7 +105,7 @@ main(argc, argv)
logging = 1;
break;
default:
syslog(LOG_ERR, "Usage: %s [-dl]", __progname);
syslog(LOG_ERR, "Usage: %s [-dl]", getprogname());
exit(1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: tftpd.c,v 1.22 2001/01/09 23:29:22 lukem Exp $ */
/* $NetBSD: tftpd.c,v 1.23 2001/02/19 22:46:14 cgd Exp $ */
/*
* Copyright (c) 1983, 1993
@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\
#if 0
static char sccsid[] = "@(#)tftpd.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: tftpd.c,v 1.22 2001/01/09 23:29:22 lukem Exp $");
__RCSID("$NetBSD: tftpd.c,v 1.23 2001/02/19 22:46:14 cgd Exp $");
#endif
#endif /* not lint */
@ -82,7 +82,6 @@ __RCSID("$NetBSD: tftpd.c,v 1.22 2001/01/09 23:29:22 lukem Exp $");
#define TIMEOUT 5
extern char *__progname;
int peer;
int rexmtval = TIMEOUT;
int maxtimeout = 5*TIMEOUT;
@ -142,7 +141,7 @@ usage(void)
syslog(LOG_ERR,
"Usage: %s [-ln] [-u user] [-g group] [-s directory] [directory ...]",
__progname);
getprogname());
exit(1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: msgtest.c,v 1.5 1999/08/24 23:17:46 thorpej Exp $ */
/* $NetBSD: msgtest.c,v 1.6 2001/02/19 22:44:41 cgd Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -297,9 +297,8 @@ print_msqid_ds(mp, mode)
void
usage()
{
extern const char *__progname;
fprintf(stderr, "usage: %s keypath\n", __progname);
fprintf(stderr, "usage: %s keypath\n", getprogname());
exit(1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: semtest.c,v 1.2 2000/01/31 15:10:34 christos Exp $ */
/* $NetBSD: semtest.c,v 1.3 2001/02/19 22:44:41 cgd Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -304,9 +304,8 @@ print_semid_ds(sp, mode)
void
usage()
{
extern const char *__progname;
fprintf(stderr, "usage: %s keypath\n", __progname);
fprintf(stderr, "usage: %s keypath\n", getprogname());
exit(1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: shmtest.c,v 1.1 1999/08/24 23:01:57 thorpej Exp $ */
/* $NetBSD: shmtest.c,v 1.2 2001/02/19 22:44:41 cgd Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -271,9 +271,8 @@ print_shmid_ds(sp, mode)
void
usage()
{
extern const char *__progname;
fprintf(stderr, "usage: %s keypath\n", __progname);
fprintf(stderr, "usage: %s keypath\n", getprogname());
exit(1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: mmap.c,v 1.11 2000/05/19 04:56:48 thorpej Exp $ */
/* $NetBSD: mmap.c,v 1.12 2001/02/19 22:44:41 cgd Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -427,8 +427,7 @@ check_residency(addr, npgs)
void
usage()
{
extern const char *__progname;
fprintf(stderr, "usage: %s [-v] filename\n", __progname);
fprintf(stderr, "usage: %s [-v] filename\n", getprogname());
exit(1);
}