diff options
Diffstat (limited to 'mdoctree.c')
-rw-r--r-- | mdoctree.c | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -32,16 +32,22 @@ int main(int argc, char *argv[]) { struct mmain *p; - int c; const struct mdoc *mdoc; + int c; + char *in; p = mmain_alloc(); - c = mmain_getopt(p, argc, argv, NULL, NULL, NULL, NULL); - if (1 != c) - mmain_exit(p, -1 == c ? 1 : 0); + c = mmain_getopt(p, argc, argv, NULL, + "[infile]", NULL, NULL, NULL); + + argv += c; + if ((argc -= c) > 0) + in = *argv++; + else + in = "-"; - if (NULL == (mdoc = mmain_mdoc(p))) + if (NULL == (mdoc = mmain_mdoc(p, in))) mmain_exit(p, 1); doprint(mdoc_node(mdoc), 0); |