summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2014-06-21 16:17:56 +0000
committerschwarze <schwarze@openbsd.org>2014-06-21 16:17:56 +0000
commita060caaaaf9ccf7df1261f038fcd0020c1b430fd (patch)
treefb50a5a22381e45165a5eb30ea5cbb67bbaff842
parentfix expected message level (diff)
downloadwireguard-openbsd-a060caaaaf9ccf7df1261f038fcd0020c1b430fd.tar.xz
wireguard-openbsd-a060caaaaf9ccf7df1261f038fcd0020c1b430fd.zip
Prefix messages about bad command line options and arguments
with "mandoc: " or "makewhatis: ", respectively, similar to what we already do for other messages.
-rw-r--r--usr.bin/mandoc/main.c18
-rw-r--r--usr.bin/mandoc/mandocdb.c13
2 files changed, 19 insertions, 12 deletions
diff --git a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c
index e754060cb60..4be08974820 100644
--- a/usr.bin/mandoc/main.c
+++ b/usr.bin/mandoc/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.92 2014/06/20 22:58:41 schwarze Exp $ */
+/* $Id: main.c,v 1.93 2014/06/21 16:17:56 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011, 2012, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -109,13 +109,14 @@ main(int argc, char *argv[])
case 'I':
if (strncmp(optarg, "os=", 3)) {
fprintf(stderr,
- "-I%s: Bad argument\n", optarg);
+ "%s: -I%s: Bad argument\n",
+ progname, optarg);
return((int)MANDOCLEVEL_BADARG);
}
if (defos) {
fprintf(stderr,
- "-I%s: Duplicate argument\n",
- optarg);
+ "%s: -I%s: Duplicate argument\n",
+ progname, optarg);
return((int)MANDOCLEVEL_BADARG);
}
defos = mandoc_strdup(optarg + 3);
@@ -325,7 +326,8 @@ moptions(int *options, char *arg)
else if (0 == strcmp(arg, "an"))
*options |= MPARSE_MAN;
else {
- fprintf(stderr, "%s: Bad argument\n", arg);
+ fprintf(stderr, "%s: -m%s: Bad argument\n",
+ progname, arg);
return(0);
}
@@ -358,7 +360,8 @@ toptions(struct curparse *curp, char *arg)
else if (0 == strcmp(arg, "pdf"))
curp->outtype = OUTT_PDF;
else {
- fprintf(stderr, "%s: Bad argument\n", arg);
+ fprintf(stderr, "%s: -T%s: Bad argument\n",
+ progname, arg);
return(0);
}
@@ -396,7 +399,8 @@ woptions(struct curparse *curp, char *arg)
curp->wlevel = MANDOCLEVEL_FATAL;
break;
default:
- fprintf(stderr, "-W%s: Bad argument\n", o);
+ fprintf(stderr, "%s: -W%s: Bad argument\n",
+ progname, o);
return(0);
}
}
diff --git a/usr.bin/mandoc/mandocdb.c b/usr.bin/mandoc/mandocdb.c
index 22636e4f514..589713b52ec 100644
--- a/usr.bin/mandoc/mandocdb.c
+++ b/usr.bin/mandoc/mandocdb.c
@@ -1,4 +1,4 @@
-/* $Id: mandocdb.c,v 1.110 2014/06/20 01:20:55 schwarze Exp $ */
+/* $Id: mandocdb.c,v 1.111 2014/06/21 16:17:56 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -347,7 +347,8 @@ mandocdb(int argc, char *argv[])
*/
#define CHECKOP(_op, _ch) do \
if (OP_DEFAULT != (_op)) { \
- fprintf(stderr, "-%c: Conflicting option\n", (_ch)); \
+ fprintf(stderr, "%s: -%c: Conflicting option\n", \
+ progname, (_ch)); \
goto usage; \
} while (/*CONSTCOND*/0)
@@ -383,8 +384,9 @@ mandocdb(int argc, char *argv[])
break;
case 'T':
if (strcmp(optarg, "utf8")) {
- fprintf(stderr, "-T%s: Unsupported "
- "output format\n", optarg);
+ fprintf(stderr, "%s: -T%s: "
+ "Unsupported output format\n",
+ progname, optarg);
goto usage;
}
write_utf8 = 1;
@@ -411,7 +413,8 @@ mandocdb(int argc, char *argv[])
argv += optind;
if (OP_CONFFILE == op && argc > 0) {
- fprintf(stderr, "-C: Too many arguments\n");
+ fprintf(stderr, "%s: -C: Too many arguments\n",
+ progname);
goto usage;
}