From 668a4dd9670a380961d659528d5afcb4f6404aae Mon Sep 17 00:00:00 2001 From: cgd Date: Mon, 19 Feb 2001 22:39:39 +0000 Subject: [PATCH] convert to use getprogname() --- bin/chio/chio.c | 9 ++++----- bin/ln/ln.c | 8 +++----- distrib/utils/x_gzip/gzip.c | 13 ++++++------- games/arithmetic/arithmetic.c | 8 +++----- games/fortune/fortune/fortune.c | 9 ++++----- 5 files changed, 20 insertions(+), 27 deletions(-) diff --git a/bin/chio/chio.c b/bin/chio/chio.c index 2d29232879d6..9fe508ca916b 100644 --- a/bin/chio/chio.c +++ b/bin/chio/chio.c @@ -1,4 +1,4 @@ -/* $NetBSD: chio.c,v 1.14 1999/09/09 23:32:10 thorpej Exp $ */ +/* $NetBSD: chio.c,v 1.15 2001/02/19 22:39:39 cgd Exp $ */ /*- * Copyright (c) 1996, 1998, 1999 The NetBSD Foundation, Inc. @@ -46,7 +46,7 @@ __COPYRIGHT( "@(#) Copyright (c) 1996, 1998, 1999\ The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: chio.c,v 1.14 1999/09/09 23:32:10 thorpej Exp $"); +__RCSID("$NetBSD: chio.c,v 1.15 2001/02/19 22:39:39 cgd Exp $"); #endif #include @@ -66,8 +66,6 @@ __RCSID("$NetBSD: chio.c,v 1.14 1999/09/09 23:32:10 thorpej Exp $"); #include "defs.h" #include "pathnames.h" -extern const char *__progname; /* from crt0.o */ - int main __P((int, char *[])); static void usage __P((void)); static void cleanup __P((void)); @@ -854,7 +852,8 @@ usage() { int i; - (void) fprintf(stderr, "Usage: %s command arg1 arg2 ...\n", __progname); + (void) fprintf(stderr, "Usage: %s command arg1 arg2 ...\n", + getprogname()); (void) fprintf(stderr, "Where command (and args) are:\n"); for (i = 0; commands[i].cc_name != NULL; i++) diff --git a/bin/ln/ln.c b/bin/ln/ln.c index 015c26ab6d69..a573a89f5a74 100644 --- a/bin/ln/ln.c +++ b/bin/ln/ln.c @@ -1,4 +1,4 @@ -/* $NetBSD: ln.c,v 1.17 2001/02/04 19:32:26 christos Exp $ */ +/* $NetBSD: ln.c,v 1.18 2001/02/19 22:39:39 cgd Exp $ */ /* * Copyright (c) 1987, 1993, 1994 @@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 1993, 1994\n\ #if 0 static char sccsid[] = "@(#)ln.c 8.2 (Berkeley) 3/31/94"; #else -__RCSID("$NetBSD: ln.c,v 1.17 2001/02/04 19:32:26 christos Exp $"); +__RCSID("$NetBSD: ln.c,v 1.18 2001/02/19 22:39:39 cgd Exp $"); #endif #endif /* not lint */ @@ -63,8 +63,6 @@ int sflag; /* Symbolic, not hard, link. */ /* System link call. */ int (*linkf) __P((const char *, const char *)); -extern char *__progname; - int linkit __P((char *, char *, int)); void usage __P((void)); int main __P((int, char *[])); @@ -177,7 +175,7 @@ usage() (void)fprintf(stderr, "Usage:\t%s [-fhns] file1 file2\n\t%s [-fhns] file ... directory\n", - __progname, __progname); + getprogname(), getprogname()); exit(1); /* NOTREACHED */ } diff --git a/distrib/utils/x_gzip/gzip.c b/distrib/utils/x_gzip/gzip.c index 99045ec76b2f..6909dc75fcc0 100644 --- a/distrib/utils/x_gzip/gzip.c +++ b/distrib/utils/x_gzip/gzip.c @@ -1,4 +1,4 @@ -/* $NetBSD: gzip.c,v 1.2 2001/01/04 16:17:15 lukem Exp $ */ +/* $NetBSD: gzip.c,v 1.3 2001/02/19 22:40:52 cgd Exp $ */ /* * Copyright (c) 1997, 1998 Matthew R. Green @@ -55,8 +55,6 @@ #define BUFLEN 4096 -extern char *__progname; /* XXX */ - static char gzip_version[] = "NetBSD gzip 1.0"; static char gzipflags[3] = ""; /* `w' or `r', possible with [1-9] */ @@ -94,6 +92,7 @@ main(argc, argv) int argc; char *argv[]; { + const char *progname = getprogname(); int ch; gzipflags[0] = 'w'; @@ -103,10 +102,10 @@ main(argc, argv) * XXX * handle being called `gunzip', `zcat' and `gzcat' */ - if (strcmp(__progname, "gunzip") == 0) + if (strcmp(progname, "gunzip") == 0) dflag = 1; - else if (strcmp(__progname, "zcat") == 0 || - strcmp(__progname, "gzcat") == 0) + else if (strcmp(progname, "zcat") == 0 || + strcmp(progname, "gzcat") == 0) dflag = cflag = 1; while ((ch = getopt(argc, argv, "cdfhnqrS:tvV123456789")) != -1) @@ -625,7 +624,7 @@ usage() fprintf(stderr, "Usage: %s [-cdfhnqrtVv123456789] [ [ ...]]\n", - __progname); + getprogname()); fflush(stderr); exit(0); } diff --git a/games/arithmetic/arithmetic.c b/games/arithmetic/arithmetic.c index 03e00106a9e1..45a7109e68dc 100644 --- a/games/arithmetic/arithmetic.c +++ b/games/arithmetic/arithmetic.c @@ -1,4 +1,4 @@ -/* $NetBSD: arithmetic.c,v 1.16 2001/02/05 00:20:58 christos Exp $ */ +/* $NetBSD: arithmetic.c,v 1.17 2001/02/19 22:41:45 cgd Exp $ */ /* * Copyright (c) 1989, 1993 @@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\ #if 0 static char sccsid[] = "@(#)arithmetic.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: arithmetic.c,v 1.16 2001/02/05 00:20:58 christos Exp $"); +__RCSID("$NetBSD: arithmetic.c,v 1.17 2001/02/19 22:41:45 cgd Exp $"); #endif #endif /* not lint */ @@ -106,8 +106,6 @@ int nright, nwrong; time_t qtime; #define NQUESTS 20 -extern char *__progname; /* from crt0.o */ - /* * Select keys from +-x/ to be asked addition, subtraction, multiplication, * and division problems. More than one key may be given. The default is @@ -389,6 +387,6 @@ void usage() { (void)fprintf(stderr, "Usage: %s [-o +-x/] [-r range]\n", - __progname); + getprogname()); exit(1); } diff --git a/games/fortune/fortune/fortune.c b/games/fortune/fortune/fortune.c index 5a383bc15881..0593b0c7e3e8 100644 --- a/games/fortune/fortune/fortune.c +++ b/games/fortune/fortune/fortune.c @@ -1,4 +1,4 @@ -/* $NetBSD: fortune.c,v 1.26 2001/02/05 00:29:44 christos Exp $ */ +/* $NetBSD: fortune.c,v 1.27 2001/02/19 22:41:45 cgd Exp $ */ /*- * Copyright (c) 1986, 1993 @@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1986, 1993\n\ #if 0 static char sccsid[] = "@(#)fortune.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: fortune.c,v 1.26 2001/02/05 00:29:44 christos Exp $"); +__RCSID("$NetBSD: fortune.c,v 1.27 2001/02/19 22:41:45 cgd Exp $"); #endif #endif /* not lint */ @@ -206,8 +206,6 @@ regex_t *Re_pat = NULL; #define NAMLEN(d) ((d)->d_namlen) #endif -extern char *__progname; - int main(ac, av) int ac; @@ -1357,7 +1355,8 @@ matches_in_list(list) void usage() { - (void) fprintf(stderr, "Usage: %s [-a", __progname); + + (void) fprintf(stderr, "Usage: %s [-a", getprogname()); #ifdef DEBUG (void) fprintf(stderr, "D"); #endif /* DEBUG */