summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/mandoc/main.c')
-rw-r--r--usr.bin/mandoc/main.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c
index ed3e92c79bd..81691364218 100644
--- a/usr.bin/mandoc/main.c
+++ b/usr.bin/mandoc/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.161 2015/10/22 21:53:49 schwarze Exp $ */
+/* $OpenBSD: main.c,v 1.162 2015/11/06 16:27:13 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2012, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -92,8 +92,6 @@ static int toptions(struct curparse *, char *);
static void usage(enum argmode) __attribute__((noreturn));
static int woptions(struct curparse *, char *);
-extern char *__progname;
-
static const int sec_prios[] = {1, 4, 5, 8, 6, 3, 7, 2, 9};
static char help_arg[] = "help";
static char *help_argv[] = {help_arg, NULL};
@@ -107,6 +105,7 @@ main(int argc, char *argv[])
struct curparse curp;
struct mansearch search;
struct tag_files *tag_files;
+ const char *progname;
char *auxpaths;
char *defos;
unsigned char *uc;
@@ -123,8 +122,9 @@ main(int argc, char *argv[])
int use_pager;
int c;
- if (0 == strncmp(__progname, "mandocdb", 8) ||
- 0 == strncmp(__progname, "makewhatis", 10))
+ progname = getprogname();
+ if (strncmp(progname, "mandocdb", 8) == 0 ||
+ strncmp(progname, "makewhatis", 10) == 0)
return mandocdb(argc, argv);
if (pledge("stdio rpath tmppath proc exec flock", NULL) == -1)
@@ -139,13 +139,13 @@ main(int argc, char *argv[])
memset(&search, 0, sizeof(struct mansearch));
search.outkey = "Nd";
- if (strcmp(__progname, "man") == 0)
+ if (strcmp(progname, "man") == 0)
search.argmode = ARG_NAME;
- else if (strncmp(__progname, "apropos", 7) == 0)
+ else if (strncmp(progname, "apropos", 7) == 0)
search.argmode = ARG_EXPR;
- else if (strncmp(__progname, "whatis", 6) == 0)
+ else if (strncmp(progname, "whatis", 6) == 0)
search.argmode = ARG_WORD;
- else if (strncmp(__progname, "help", 4) == 0)
+ else if (strncmp(progname, "help", 4) == 0)
search.argmode = ARG_NAME;
else
search.argmode = ARG_FILE;
@@ -286,7 +286,7 @@ main(int argc, char *argv[])
*/
if (search.argmode == ARG_NAME) {
- if (*__progname == 'h') {
+ if (*progname == 'h') {
if (argc == 0) {
argv = help_argv;
argc = 1;
@@ -907,7 +907,7 @@ mmsg(enum mandocerr t, enum mandoclevel lvl,
{
const char *mparse_msg;
- fprintf(stderr, "%s: %s:", __progname, file);
+ fprintf(stderr, "%s: %s:", getprogname(), file);
if (line)
fprintf(stderr, "%d:%d:", line, col + 1);