-/* $Id: main.c,v 1.173 2014/04/20 16:46:04 schwarze Exp $ */
+/* $Id: main.c,v 1.176 2014/06/21 16:18:25 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011, 2012, 2014 Ingo Schwarze <schwarze@openbsd.org>
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);
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);
}
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);
}
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);
}
}
const char *file, int line, int col, const char *msg)
{
- fprintf(stderr, "%s:%d:%d: %s: %s", file, line, col + 1,
- mparse_strlevel(lvl), mparse_strerror(t));
+ fprintf(stderr, "%s: %s:", progname, file);
+
+ if (line)
+ fprintf(stderr, "%d:%d:", line, col + 1);
+
+ fprintf(stderr, " %s: %s", mparse_strlevel(lvl),
+ mparse_strerror(t));
if (msg)
fprintf(stderr, ": %s", msg);