summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-03-19 18:30:26 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-03-19 18:30:26 +0000
commitd6927385079d4fc8e93729813362b9123340c85e (patch)
treead3b4b516d0465d5e11f62dec51d6427be849fca
parent677b18213e2f3cdbe7bb2c9df54a0e2488c89714 (diff)
downloadmandoc-d6927385079d4fc8e93729813362b9123340c85e.tar.gz
Fixed mandoc read from stdin.
Added some more groff_chars.
-rw-r--r--ascii.in7
-rw-r--r--main.c34
-rw-r--r--mandoc.14
-rw-r--r--mdoc.714
4 files changed, 48 insertions, 11 deletions
diff --git a/ascii.in b/ascii.in
index 781b3831..da74cc08 100644
--- a/ascii.in
+++ b/ascii.in
@@ -48,14 +48,18 @@ LINE("Rq", 2, "\'\'", 2)
LINE("rq", 2, "\'\'", 2)
LINE("oq", 2, "`", 1)
LINE("aq", 2, "\'", 1)
+LINE("Bq", 2, ",,", 2)
+LINE("bq", 2, ",,", 2)
LINE("<-", 2, "<-", 2)
LINE("->", 2, "->", 2)
LINE("<>", 2, "<>", 2)
LINE("ua", 2, "^", 1)
LINE("da", 2, "v", 1)
LINE("bu", 2, "o", 1)
+LINE("ci", 2, "O", 1)
LINE("Ba", 2, "|", 1)
LINE("ba", 2, "|", 1)
+LINE("bb", 2, "|", 1)
LINE("co", 2, "(C)", 3)
LINE("rg", 2, "(R)", 3)
LINE("tm", 2, "tm", 2)
@@ -164,6 +168,7 @@ LINE("ah", 2, "v", 1)
LINE("ao", 2, "o", 1)
LINE("ho", 2, ",", 1)
LINE("ab", 2, "`", 1)
+LINE("a\"", 2, "\"", 1)
LINE("a-", 2, "-", 1)
LINE("Cs", 2, "x", 1)
LINE("Do", 2, "$", 1)
@@ -176,3 +181,5 @@ LINE("fi", 2, "fi", 2)
LINE("fl", 2, "fl", 2)
LINE("Fi", 2, "ffi", 3)
LINE("Fl", 2, "ffl", 3)
+LINE("r!", 2, "i", 1)
+LINE("r?", 2, "c", 1)
diff --git a/main.c b/main.c
index 703b9483..31ed41d4 100644
--- a/main.c
+++ b/main.c
@@ -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)
diff --git a/mandoc.1 b/mandoc.1
index a3f881b8..52dabb27 100644
--- a/mandoc.1
+++ b/mandoc.1
@@ -72,7 +72,9 @@ arguments may be comma-separated, such as
.It Ar infile...
Read input from zero or more
.Ar infile .
-If unspecified, reads from stdin.
+If unspecified, reads from stdin. If multiple files are specified,
+.Nm
+will halt with the first failed parse.
.El
.\" PARAGRAPH
.Pp
diff --git a/mdoc.7 b/mdoc.7
index 2845664d..044f8084 100644
--- a/mdoc.7
+++ b/mdoc.7
@@ -117,6 +117,10 @@ Grammatic:
.Pq space
.It \\.
.Pq period
+.It \\(r!
+.Pq upside-down exclamation
+.It \\(r?
+.Pq upside-down question
.El
.\" PARAGRAPH
.Pp
@@ -162,6 +166,10 @@ Enclosures:
.Pq left single-quote
.It \\(aq
.Pq right single-quote
+.It \\(Bq
+.Pq right low double-quote
+.It \\(bq
+.Pq right low single-quote
.El
.\" PARAGRAPH
.Pp
@@ -258,6 +266,8 @@ Diacritics and letters:
.Pq grave accent
.It \\(aa
.Pq accute accent
+.It \\(a"
+.Pq umlaut accent
.It \\(ad
.Pq dieresis accent
.It \\(a~
@@ -420,8 +430,12 @@ Special symbols:
.Bl -tag -width 12n -offset "XXXX" -compact
.It \\(bu
.Pq bullet
+.It \\(ci
+.Pq circle
.It \\(ba
.Pq bar
+.It \\(bb
+.Pq broken bar
.It \\(Ba
.Pq bar, deprecated
.It \\(co