=================================================================== RCS file: /cvs/mandoc/Attic/mdoctree.c,v retrieving revision 1.6 retrieving revision 1.8 diff -u -p -r1.6 -r1.8 --- mandoc/Attic/mdoctree.c 2009/03/08 14:01:46 1.6 +++ mandoc/Attic/mdoctree.c 2009/03/16 23:37:28 1.8 @@ -1,6 +1,6 @@ - /* $Id: mdoctree.c,v 1.6 2009/03/08 14:01:46 kristaps Exp $ */ +/* $Id: mdoctree.c,v 1.8 2009/03/16 23:37:28 kristaps Exp $ */ /* - * Copyright (c) 2008 Kristaps Dzonsons + * Copyright (c) 2008, 2009 Kristaps Dzonsons * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the @@ -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); - if (NULL == (mdoc = mmain_mdoc(p))) + argv += c; + if ((argc -= c) > 0) + in = *argv++; + else + in = "-"; + + if (NULL == (mdoc = mmain_mdoc(p, in))) mmain_exit(p, 1); doprint(mdoc_node(mdoc), 0);