aboutsummaryrefslogtreecommitdiffstatshomepage
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
commit94e75ede705a99ffe81500ad50e2c57d100be2a7 (patch)
treef7e6974185e2b7870f1ce1d670b531885937266f
parent36ca5446d30ace05d796a3cdb1c9781f41b090cc (diff)
downloadmandoc-94e75ede705a99ffe81500ad50e2c57d100be2a7.tar.gz
mandoc-94e75ede705a99ffe81500ad50e2c57d100be2a7.tar.zst
mandoc-94e75ede705a99ffe81500ad50e2c57d100be2a7.zip
Fixed mandoc read from stdin.
Added some more groff_chars.
-rw-r--r--ascii.in9
-rw-r--r--main.c36
-rw-r--r--mandoc.16
-rw-r--r--mdoc.716
4 files changed, 52 insertions, 15 deletions
diff --git a/ascii.in b/ascii.in
index fe898288..060f2d50 100644
--- a/ascii.in
+++ b/ascii.in
@@ -1,4 +1,4 @@
-/* $Id: ascii.in,v 1.2 2009/03/19 11:49:00 kristaps Exp $ */
+/* $Id: ascii.in,v 1.3 2009/03/19 18:30:26 kristaps Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@openbsd.org>
*
@@ -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 188a3732..3a6506d5 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.3 2009/03/19 16:40:49 kristaps Exp $ */
+/* $Id: main.c,v 1.4 2009/03/19 18:30:26 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@openbsd.org>
*
@@ -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 7e32f7ff..625a72a2 100644
--- a/mandoc.1
+++ b/mandoc.1
@@ -1,4 +1,4 @@
-.\" $Id: mandoc.1,v 1.1 2009/03/19 16:17:27 kristaps Exp $
+.\" $Id: mandoc.1,v 1.2 2009/03/19 18:30:26 kristaps Exp $
.\"
.\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@openbsd.org>
.\"
@@ -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 a761cbb5..a28619ff 100644
--- a/mdoc.7
+++ b/mdoc.7
@@ -1,4 +1,4 @@
-.\" $Id: mdoc.7,v 1.7 2009/03/19 11:49:00 kristaps Exp $
+.\" $Id: mdoc.7,v 1.8 2009/03/19 18:30:26 kristaps Exp $
.\"
.\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@openbsd.org>
.\"
@@ -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