diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-03-19 18:30:26 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-03-19 18:30:26 +0000 |
commit | d6927385079d4fc8e93729813362b9123340c85e (patch) | |
tree | ad3b4b516d0465d5e11f62dec51d6427be849fca /main.c | |
parent | 677b18213e2f3cdbe7bb2c9df54a0e2488c89714 (diff) | |
download | mandoc-d6927385079d4fc8e93729813362b9123340c85e.tar.gz |
Fixed mandoc read from stdin.
Added some more groff_chars.
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 34 |
1 files changed, 24 insertions, 10 deletions
@@ -165,19 +165,33 @@ main(int argc, char *argv[]) mdoc = mdoc_alloc(&wflags, fflags, &cb); - while (*argv) { - if ( ! file(&line, &linesz, &buf, &bufsz, *argv, mdoc)) - break; - if (outrun && ! (*outrun)(outdata, mdoc)) - break; + /* + * Loop around available files. + */ - /* Reset the parser for another file. */ - mdoc_reset(mdoc); - argv++; + if (NULL == *argv) { + c = fdesc(&line, &linesz, &buf, &bufsz, + "stdin", STDIN_FILENO, mdoc); + rc = 0; + if (c && NULL == outrun) + rc = 1; + else if (c && outrun && (*outrun)(outdata, mdoc)) + rc = 1; + } else { + while (*argv) { + c = file(&line, &linesz, &buf, + &bufsz, *argv, mdoc); + if ( ! c) + break; + if (outrun && ! (*outrun)(outdata, mdoc)) + break; + /* Reset the parser for another file. */ + mdoc_reset(mdoc); + argv++; + } + rc = NULL == *argv; } - rc = NULL == *argv; - if (buf) free(buf); if (line) |