]>
git.cameronkatri.com Git - mandoc.git/blob - main.c
1 /* $Id: main.c,v 1.242 2015/07/19 06:05:16 schwarze Exp $ */
3 * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
4 * Copyright (c) 2010-2012, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
5 * Copyright (c) 2010 Joerg Sonnenberger <joerg@netbsd.org>
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 #include <sys/types.h>
22 #include <sys/param.h> /* MACHINE */
37 #include "mandoc_aux.h"
45 #include "mansearch.h"
47 #if !defined(__GNUC__) || (__GNUC__ < 2)
49 # define __attribute__(x)
51 #endif /* !defined(__GNUC__) || (__GNUC__ < 2) */
62 typedef void (*out_mdoc
)(void *, const struct roff_man
*);
63 typedef void (*out_man
)(void *, const struct roff_man
*);
64 typedef void (*out_free
)(void *);
67 OUTT_ASCII
= 0, /* -Tascii */
68 OUTT_LOCALE
, /* -Tlocale */
69 OUTT_UTF8
, /* -Tutf8 */
70 OUTT_TREE
, /* -Ttree */
72 OUTT_HTML
, /* -Thtml */
73 OUTT_LINT
, /* -Tlint */
80 struct mchars
*mchars
; /* character table */
81 enum mandoclevel wlevel
; /* ignore messages below this */
82 int wstop
; /* stop after a file with a warning */
83 enum outt outtype
; /* which output to use */
84 out_mdoc outmdoc
; /* mdoc output ptr */
85 out_man outman
; /* man output ptr */
86 out_free outfree
; /* free output ptr */
87 void *outdata
; /* data for output */
88 struct manoutput
*outopts
; /* output options */
91 static int fs_lookup(const struct manpaths
*,
92 size_t ipath
, const char *,
93 const char *, const char *,
94 struct manpage
**, size_t *);
95 static void fs_search(const struct mansearch
*,
96 const struct manpaths
*, int, char**,
97 struct manpage
**, size_t *);
98 static void handle_sigpipe(int);
99 static int koptions(int *, char *);
101 int mandocdb(int, char**);
103 static int moptions(int *, char *);
104 static void mmsg(enum mandocerr
, enum mandoclevel
,
105 const char *, int, int, const char *);
106 static void parse(struct curparse
*, int, const char *);
107 static void passthrough(const char *, int, int);
108 static pid_t
spawn_pager(void);
109 static int toptions(struct curparse
*, char *);
110 static void usage(enum argmode
) __attribute__((noreturn
));
111 static int woptions(struct curparse
*, char *);
113 static const int sec_prios
[] = {1, 4, 5, 8, 6, 3, 7, 2, 9};
114 static char help_arg
[] = "help";
115 static char *help_argv
[] = {help_arg
, NULL
};
116 static const char *progname
;
117 static enum mandoclevel rc
;
121 main(int argc
, char *argv
[])
124 struct curparse curp
;
125 struct mansearch search
;
129 struct manpage
*res
, *resp
;
130 char *conf_file
, *defpaths
;
134 enum mandoclevel rctmp
;
135 enum outmode outmode
;
140 pid_t pager_pid
; /* 0: don't use; 1: not yet spawned. */
144 else if ((progname
= strrchr(argv
[0], '/')) == NULL
)
150 if (strcmp(progname
, BINM_MAKEWHATIS
) == 0)
151 return(mandocdb(argc
, argv
));
154 /* Search options. */
156 memset(&conf
, 0, sizeof(conf
));
157 conf_file
= defpaths
= NULL
;
160 memset(&search
, 0, sizeof(struct mansearch
));
161 search
.outkey
= "Nd";
163 if (strcmp(progname
, BINM_MAN
) == 0)
164 search
.argmode
= ARG_NAME
;
165 else if (strcmp(progname
, BINM_APROPOS
) == 0)
166 search
.argmode
= ARG_EXPR
;
167 else if (strcmp(progname
, BINM_WHATIS
) == 0)
168 search
.argmode
= ARG_WORD
;
169 else if (strncmp(progname
, "help", 4) == 0)
170 search
.argmode
= ARG_NAME
;
172 search
.argmode
= ARG_FILE
;
174 /* Parser and formatter options. */
176 memset(&curp
, 0, sizeof(struct curparse
));
177 curp
.outtype
= OUTT_LOCALE
;
178 curp
.wlevel
= MANDOCLEVEL_BADARG
;
179 curp
.outopts
= &conf
.output
;
180 options
= MPARSE_SO
| MPARSE_UTF8
| MPARSE_LATIN1
;
185 outmode
= OUTMODE_DEF
;
187 while (-1 != (c
= getopt(argc
, argv
,
188 "aC:cfhI:iK:klM:m:O:S:s:T:VW:w"))) {
191 outmode
= OUTMODE_ALL
;
200 search
.argmode
= ARG_WORD
;
203 conf
.output
.synopsisonly
= 1;
205 outmode
= OUTMODE_ALL
;
208 if (strncmp(optarg
, "os=", 3)) {
210 "%s: -I %s: Bad argument\n",
212 return((int)MANDOCLEVEL_BADARG
);
216 "%s: -I %s: Duplicate argument\n",
218 return((int)MANDOCLEVEL_BADARG
);
220 defos
= mandoc_strdup(optarg
+ 3);
223 outmode
= OUTMODE_INT
;
226 if ( ! koptions(&options
, optarg
))
227 return((int)MANDOCLEVEL_BADARG
);
230 search
.argmode
= ARG_EXPR
;
233 search
.argmode
= ARG_FILE
;
234 outmode
= OUTMODE_ALL
;
243 search
.outkey
= optarg
;
244 while (optarg
!= NULL
)
245 manconf_output(&conf
.output
,
246 strsep(&optarg
, ","));
249 search
.arch
= optarg
;
255 if ( ! toptions(&curp
, optarg
))
256 return((int)MANDOCLEVEL_BADARG
);
259 if ( ! woptions(&curp
, optarg
))
260 return((int)MANDOCLEVEL_BADARG
);
263 outmode
= OUTMODE_FLN
;
272 usage(search
.argmode
);
274 /* Postprocess options. */
276 if (outmode
== OUTMODE_DEF
) {
277 switch (search
.argmode
) {
279 outmode
= OUTMODE_ALL
;
283 outmode
= OUTMODE_ONE
;
286 outmode
= OUTMODE_LST
;
291 /* Parse arguments. */
301 * and for a man(1) section argument without -s.
304 if (search
.argmode
== ARG_NAME
) {
305 if (*progname
== 'h') {
310 } else if (argc
> 1 &&
311 ((uc
= (unsigned char *)argv
[0]) != NULL
) &&
312 ((isdigit(uc
[0]) && (uc
[1] == '\0' ||
313 (isalpha(uc
[1]) && uc
[2] == '\0'))) ||
314 (uc
[0] == 'n' && uc
[1] == '\0'))) {
315 search
.sec
= (char *)uc
;
319 if (search
.arch
== NULL
)
320 search
.arch
= getenv("MACHINE");
322 if (search
.arch
== NULL
)
323 search
.arch
= MACHINE
;
329 /* man(1), whatis(1), apropos(1) */
331 if (search
.argmode
!= ARG_FILE
) {
333 usage(search
.argmode
);
335 if (search
.argmode
== ARG_NAME
&&
336 outmode
== OUTMODE_ONE
)
337 search
.firstmatch
= 1;
339 /* Access the mandoc database. */
341 manconf_parse(&conf
, conf_file
, defpaths
, auxpaths
);
344 if ( ! mansearch(&search
, &conf
.manpath
,
345 argc
, argv
, &res
, &sz
))
346 usage(search
.argmode
);
348 if (search
.argmode
!= ARG_NAME
) {
349 fputs("mandoc: database support not compiled in\n",
351 return((int)MANDOCLEVEL_BADARG
);
357 if (search
.argmode
== ARG_NAME
)
358 fs_search(&search
, &conf
.manpath
,
359 argc
, argv
, &res
, &sz
);
362 "%s: nothing appropriate\n",
367 rc
= MANDOCLEVEL_BADARG
;
372 * For standard man(1) and -a output mode,
373 * prepare for copying filename pointers
374 * into the program parameter array.
377 if (outmode
== OUTMODE_ONE
) {
380 } else if (outmode
== OUTMODE_ALL
)
383 /* Iterate all matching manuals. */
386 for (i
= 0; i
< sz
; i
++) {
387 if (outmode
== OUTMODE_FLN
)
389 else if (outmode
== OUTMODE_LST
)
390 printf("%s - %s\n", res
[i
].names
,
391 res
[i
].output
== NULL
? "" :
393 else if (outmode
== OUTMODE_ONE
) {
394 /* Search for the best section. */
395 isec
= strcspn(res
[i
].file
, "123456789");
396 sec
= res
[i
].file
[isec
];
399 prio
= sec_prios
[sec
- '1'];
400 if (prio
>= best_prio
)
408 * For man(1), -a and -i output mode, fall through
409 * to the main mandoc(1) code iterating files
410 * and running the parsers on each of them.
413 if (outmode
== OUTMODE_FLN
|| outmode
== OUTMODE_LST
)
419 if (search
.argmode
== ARG_FILE
&& ! moptions(&options
, auxpaths
))
420 return((int)MANDOCLEVEL_BADARG
);
422 if (pager_pid
== 1 && isatty(STDOUT_FILENO
) == 0)
425 curp
.mchars
= mchars_alloc();
426 curp
.mp
= mparse_alloc(options
, curp
.wlevel
, mmsg
,
430 * Conditionally start up the lookaside buffer before parsing.
432 if (OUTT_MAN
== curp
.outtype
)
433 mparse_keep(curp
.mp
);
437 pager_pid
= spawn_pager();
438 parse(&curp
, STDIN_FILENO
, "<stdin>");
442 rctmp
= mparse_open(curp
.mp
, &fd
,
443 resp
!= NULL
? resp
->file
: *argv
);
449 pager_pid
= spawn_pager();
452 parse(&curp
, fd
, *argv
);
453 else if (resp
->form
& FORM_SRC
) {
454 /* For .so only; ignore failure. */
455 chdir(conf
.manpath
.paths
[resp
->ipath
]);
456 parse(&curp
, fd
, resp
->file
);
458 passthrough(resp
->file
, fd
,
459 conf
.output
.synopsisonly
);
461 if (argc
> 1 && curp
.outtype
<= OUTT_UTF8
)
462 ascii_sepline(curp
.outdata
);
465 if (MANDOCLEVEL_OK
!= rc
&& curp
.wstop
)
473 mparse_reset(curp
.mp
);
477 (*curp
.outfree
)(curp
.outdata
);
478 mparse_free(curp
.mp
);
479 mchars_free(curp
.mchars
);
482 if (search
.argmode
!= ARG_FILE
) {
485 mansearch_free(res
, sz
);
493 * If a pager is attached, flush the pipe leading to it
494 * and signal end of file such that the user can browse
495 * to the end. Then wait for the user to close the pager.
498 if (pager_pid
!= 0 && pager_pid
!= 1) {
501 waitpid(pager_pid
, NULL
, 0);
509 usage(enum argmode argmode
)
514 fputs("usage: mandoc [-acfhkl] [-I os=name] "
515 "[-K encoding] [-mformat] [-O option]\n"
516 "\t [-T output] [-W level] [file ...]\n", stderr
);
519 fputs("usage: man [-acfhklw] [-C file] [-I os=name] "
520 "[-K encoding] [-M path] [-m path]\n"
521 "\t [-O option=value] [-S subsection] [-s section] "
522 "[-T output] [-W level]\n"
523 "\t [section] name ...\n", stderr
);
526 fputs("usage: whatis [-acfhklw] [-C file] "
527 "[-M path] [-m path] [-O outkey] [-S arch]\n"
528 "\t [-s section] name ...\n", stderr
);
531 fputs("usage: apropos [-acfhklw] [-C file] "
532 "[-M path] [-m path] [-O outkey] [-S arch]\n"
533 "\t [-s section] expression ...\n", stderr
);
536 exit((int)MANDOCLEVEL_BADARG
);
540 fs_lookup(const struct manpaths
*paths
, size_t ipath
,
541 const char *sec
, const char *arch
, const char *name
,
542 struct manpage
**res
, size_t *ressz
)
545 struct manpage
*page
;
550 mandoc_asprintf(&file
, "%s/man%s/%s.%s",
551 paths
->paths
[ipath
], sec
, name
, sec
);
552 if (access(file
, R_OK
) != -1)
556 mandoc_asprintf(&file
, "%s/cat%s/%s.0",
557 paths
->paths
[ipath
], sec
, name
);
558 if (access(file
, R_OK
) != -1) {
565 mandoc_asprintf(&file
, "%s/man%s/%s/%s.%s",
566 paths
->paths
[ipath
], sec
, arch
, name
, sec
);
567 if (access(file
, R_OK
) != -1)
572 mandoc_asprintf(&file
, "%s/man%s/%s.[01-9]*",
573 paths
->paths
[ipath
], sec
, name
);
574 globres
= glob(file
, 0, NULL
, &globinfo
);
575 if (globres
!= 0 && globres
!= GLOB_NOMATCH
)
576 fprintf(stderr
, "%s: %s: glob: %s\n",
577 progname
, file
, strerror(errno
));
580 file
= mandoc_strdup(*globinfo
.gl_pathv
);
587 fprintf(stderr
, "%s: outdated mandoc.db lacks %s(%s) entry, run "
588 "makewhatis %s\n", progname
, name
, sec
, paths
->paths
[ipath
]);
590 *res
= mandoc_reallocarray(*res
, ++*ressz
, sizeof(struct manpage
));
591 page
= *res
+ (*ressz
- 1);
596 page
->bits
= NAME_FILE
& NAME_MASK
;
597 page
->sec
= (*sec
>= '1' && *sec
<= '9') ? *sec
- '1' + 1 : 10;
603 fs_search(const struct mansearch
*cfg
, const struct manpaths
*paths
,
604 int argc
, char **argv
, struct manpage
**res
, size_t *ressz
)
606 const char *const sections
[] =
607 {"1", "8", "6", "2", "3", "3p", "5", "7", "4", "9"};
608 const size_t nsec
= sizeof(sections
)/sizeof(sections
[0]);
610 size_t ipath
, isec
, lastsz
;
612 assert(cfg
->argmode
== ARG_NAME
);
617 for (ipath
= 0; ipath
< paths
->sz
; ipath
++) {
618 if (cfg
->sec
!= NULL
) {
619 if (fs_lookup(paths
, ipath
, cfg
->sec
,
620 cfg
->arch
, *argv
, res
, ressz
) &&
623 } else for (isec
= 0; isec
< nsec
; isec
++)
624 if (fs_lookup(paths
, ipath
, sections
[isec
],
625 cfg
->arch
, *argv
, res
, ressz
) &&
629 if (*ressz
== lastsz
)
631 "%s: No entry for %s in the manual.\n",
640 parse(struct curparse
*curp
, int fd
, const char *file
)
642 enum mandoclevel rctmp
;
643 struct roff_man
*man
;
645 /* Begin by parsing the file itself. */
650 rctmp
= mparse_readfd(curp
->mp
, fd
, file
);
655 * With -Wstop and warnings or errors of at least the requested
656 * level, do not produce output.
659 if (rctmp
!= MANDOCLEVEL_OK
&& curp
->wstop
)
662 /* If unset, allocate output dev now (if applicable). */
664 if ( ! (curp
->outman
&& curp
->outmdoc
)) {
665 switch (curp
->outtype
) {
667 curp
->outdata
= html_alloc(curp
->mchars
,
669 curp
->outfree
= html_free
;
672 curp
->outdata
= utf8_alloc(curp
->mchars
,
674 curp
->outfree
= ascii_free
;
677 curp
->outdata
= locale_alloc(curp
->mchars
,
679 curp
->outfree
= ascii_free
;
682 curp
->outdata
= ascii_alloc(curp
->mchars
,
684 curp
->outfree
= ascii_free
;
687 curp
->outdata
= pdf_alloc(curp
->mchars
,
689 curp
->outfree
= pspdf_free
;
692 curp
->outdata
= ps_alloc(curp
->mchars
,
694 curp
->outfree
= pspdf_free
;
700 switch (curp
->outtype
) {
702 curp
->outman
= html_man
;
703 curp
->outmdoc
= html_mdoc
;
706 curp
->outman
= tree_man
;
707 curp
->outmdoc
= tree_mdoc
;
710 curp
->outmdoc
= man_mdoc
;
711 curp
->outman
= man_man
;
722 curp
->outman
= terminal_man
;
723 curp
->outmdoc
= terminal_mdoc
;
730 mparse_result(curp
->mp
, &man
, NULL
);
732 /* Execute the out device, if it exists. */
736 if (curp
->outmdoc
!= NULL
&& man
->macroset
== MACROSET_MDOC
)
737 (*curp
->outmdoc
)(curp
->outdata
, man
);
738 if (curp
->outman
!= NULL
&& man
->macroset
== MACROSET_MAN
)
739 (*curp
->outman
)(curp
->outdata
, man
);
743 passthrough(const char *file
, int fd
, int synopsis_only
)
745 const char synb
[] = "S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS";
746 const char synr
[] = "SYNOPSIS";
757 if ((stream
= fdopen(fd
, "r")) == NULL
) {
764 while ((line
= fgetln(stream
, &len
)) != NULL
) {
767 if ( ! isspace((unsigned char)*line
))
770 isspace((unsigned char)*line
)) {
775 if ((len
== sizeof(synb
) &&
776 ! strncmp(line
, synb
, len
- 1)) ||
777 (len
== sizeof(synr
) &&
778 ! strncmp(line
, synr
, len
- 1)))
783 for (off
= 0; off
< len
; off
+= nw
)
784 if ((nw
= write(STDOUT_FILENO
, line
+ off
,
785 len
- off
)) == -1 || nw
== 0) {
792 if (ferror(stream
)) {
803 fprintf(stderr
, "%s: %s: SYSERR: %s: %s",
804 progname
, file
, syscall
, strerror(errno
));
805 if (rc
< MANDOCLEVEL_SYSERR
)
806 rc
= MANDOCLEVEL_SYSERR
;
810 koptions(int *options
, char *arg
)
813 if ( ! strcmp(arg
, "utf-8")) {
814 *options
|= MPARSE_UTF8
;
815 *options
&= ~MPARSE_LATIN1
;
816 } else if ( ! strcmp(arg
, "iso-8859-1")) {
817 *options
|= MPARSE_LATIN1
;
818 *options
&= ~MPARSE_UTF8
;
819 } else if ( ! strcmp(arg
, "us-ascii")) {
820 *options
&= ~(MPARSE_UTF8
| MPARSE_LATIN1
);
822 fprintf(stderr
, "%s: -K %s: Bad argument\n",
830 moptions(int *options
, char *arg
)
835 else if (0 == strcmp(arg
, "doc"))
836 *options
|= MPARSE_MDOC
;
837 else if (0 == strcmp(arg
, "andoc"))
839 else if (0 == strcmp(arg
, "an"))
840 *options
|= MPARSE_MAN
;
842 fprintf(stderr
, "%s: -m %s: Bad argument\n",
851 toptions(struct curparse
*curp
, char *arg
)
854 if (0 == strcmp(arg
, "ascii"))
855 curp
->outtype
= OUTT_ASCII
;
856 else if (0 == strcmp(arg
, "lint")) {
857 curp
->outtype
= OUTT_LINT
;
858 curp
->wlevel
= MANDOCLEVEL_WARNING
;
859 } else if (0 == strcmp(arg
, "tree"))
860 curp
->outtype
= OUTT_TREE
;
861 else if (0 == strcmp(arg
, "man"))
862 curp
->outtype
= OUTT_MAN
;
863 else if (0 == strcmp(arg
, "html"))
864 curp
->outtype
= OUTT_HTML
;
865 else if (0 == strcmp(arg
, "utf8"))
866 curp
->outtype
= OUTT_UTF8
;
867 else if (0 == strcmp(arg
, "locale"))
868 curp
->outtype
= OUTT_LOCALE
;
869 else if (0 == strcmp(arg
, "xhtml"))
870 curp
->outtype
= OUTT_HTML
;
871 else if (0 == strcmp(arg
, "ps"))
872 curp
->outtype
= OUTT_PS
;
873 else if (0 == strcmp(arg
, "pdf"))
874 curp
->outtype
= OUTT_PDF
;
876 fprintf(stderr
, "%s: -T %s: Bad argument\n",
885 woptions(struct curparse
*curp
, char *arg
)
900 switch (getsubopt(&arg
, UNCONST(toks
), &v
)) {
907 curp
->wlevel
= MANDOCLEVEL_WARNING
;
910 curp
->wlevel
= MANDOCLEVEL_ERROR
;
913 curp
->wlevel
= MANDOCLEVEL_UNSUPP
;
916 curp
->wlevel
= MANDOCLEVEL_BADARG
;
919 fprintf(stderr
, "%s: -W %s: Bad argument\n",
929 mmsg(enum mandocerr t
, enum mandoclevel lvl
,
930 const char *file
, int line
, int col
, const char *msg
)
932 const char *mparse_msg
;
934 fprintf(stderr
, "%s: %s:", progname
, file
);
937 fprintf(stderr
, "%d:%d:", line
, col
+ 1);
939 fprintf(stderr
, " %s", mparse_strlevel(lvl
));
941 if (NULL
!= (mparse_msg
= mparse_strerror(t
)))
942 fprintf(stderr
, ": %s", mparse_msg
);
945 fprintf(stderr
, ": %s", msg
);
951 handle_sigpipe(int signum
)
960 #define MAX_PAGER_ARGS 16
961 char *argv
[MAX_PAGER_ARGS
];
969 pager
= getenv("MANPAGER");
970 if (pager
== NULL
|| *pager
== '\0')
971 pager
= getenv("PAGER");
972 if (pager
== NULL
|| *pager
== '\0')
974 cp
= mandoc_strdup(pager
);
977 * Parse the pager command into words.
978 * Intentionally do not do anything fancy here.
982 while (argc
+ 4 < MAX_PAGER_ARGS
) {
984 cp
= strchr(cp
, ' ');
994 /* Read all text right away and use the tag file. */
996 if ((cmdlen
= strlen(argv
[0])) >= 4) {
997 cp
= argv
[0] + cmdlen
- 4;
998 if (strcmp(cp
, "less") == 0 ||
999 strcmp(cp
, "more") == 0) {
1001 argv
[argc
++] = mandoc_strdup("+G1G");
1002 argv
[argc
++] = mandoc_strdup("-T");
1003 argv
[argc
++] = tag_filename();
1008 if (pipe(fildes
) == -1) {
1009 fprintf(stderr
, "%s: pipe: %s\n",
1010 progname
, strerror(errno
));
1014 switch (pager_pid
= fork()) {
1016 fprintf(stderr
, "%s: fork: %s\n",
1017 progname
, strerror(errno
));
1018 exit((int)MANDOCLEVEL_SYSERR
);
1023 if (dup2(fildes
[1], STDOUT_FILENO
) == -1) {
1024 fprintf(stderr
, "%s: dup output: %s\n",
1025 progname
, strerror(errno
));
1026 exit((int)MANDOCLEVEL_SYSERR
);
1029 signal(SIGPIPE
, handle_sigpipe
);
1033 /* The child process becomes the pager. */
1036 if (dup2(fildes
[0], STDIN_FILENO
) == -1) {
1037 fprintf(stderr
, "%s: dup input: %s\n",
1038 progname
, strerror(errno
));
1039 exit((int)MANDOCLEVEL_SYSERR
);
1043 /* Hand over to the pager. */
1045 execvp(argv
[0], argv
);
1046 fprintf(stderr
, "%s: exec %s: %s\n",
1047 progname
, argv
[0], strerror(errno
));
1048 exit((int)MANDOCLEVEL_SYSERR
);