X-Git-Url: https://git.cameronkatri.com/mandoc.git/blobdiff_plain/8acb3c90fb3c3f33d986c8a11474138a497e1ec9..58ec1de730c493d7dac46e9e8c77b5551fcc8df3:/mdoc.c diff --git a/mdoc.c b/mdoc.c index ff8a3ba4..719434ae 100644 --- a/mdoc.c +++ b/mdoc.c @@ -1,4 +1,4 @@ -/* $Id: mdoc.c,v 1.59 2009/03/09 13:35:09 kristaps Exp $ */ +/* $Id: mdoc.c,v 1.63 2009/03/12 15:55:11 kristaps Exp $ */ /* * Copyright (c) 2008 Kristaps Dzonsons * @@ -72,7 +72,8 @@ const char *const __mdoc_macronames[MDOC_MAX] = { "Fo", "Fc", "Oo", "Oc", "Bk", "Ek", "Bt", "Hf", "Fr", "Ud", "Lb", "Ap", - "Lp" + "Lp", "Lk", "Mt", "Brq", + "Bro", "Brc" }; const char *const __mdoc_argnames[MDOC_ARG_MAX] = { @@ -519,7 +520,19 @@ parsemacro(struct mdoc *m, int ln, char *buf) int i, c; char mac[5]; - /* Comments are quickly ignored. */ + /* Comments and empties are quickly ignored. */ + + if (0 == buf[1]) + return(1); + + if (isspace((unsigned char)buf[1])) { + i = 2; + while (buf[i] && isspace((unsigned char)buf[i])) + i++; + if (0 == buf[i]) + return(1); + return(mdoc_perr(m, ln, 1, "invalid syntax")); + } if (buf[1] && '\\' == buf[1]) if (buf[2] && '\"' == buf[2]) @@ -534,8 +547,6 @@ parsemacro(struct mdoc *m, int ln, char *buf) break; } - /* FIXME: be able to skip unknown macro lines! */ - mac[i - 1] = 0; if (i == 5 || i <= 2) {