]> git.cameronkatri.com Git - mandoc.git/blobdiff - mdoc.c
NetBSD '.[[:whitespace:]]*' properly handled.
[mandoc.git] / mdoc.c
diff --git a/mdoc.c b/mdoc.c
index ff8a3ba414f90f259de87575fe545b3f04ec43d0..719434ae020fd66c223884d8842d1b3e38797711 100644 (file)
--- 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 <kristaps@kth.se>
  *
 /*
  * Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
  *
@@ -72,7 +72,8 @@ const char *const __mdoc_macronames[MDOC_MAX] = {
        "Fo",           "Fc",           "Oo",           "Oc",
        "Bk",           "Ek",           "Bt",           "Hf",
        "Fr",           "Ud",           "Lb",           "Ap",
        "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] = {            
        };
 
 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];
 
        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])
 
        if (buf[1] && '\\' == buf[1])
                if (buf[2] && '\"' == buf[2])
@@ -534,8 +547,6 @@ parsemacro(struct mdoc *m, int ln, char *buf)
                        break;
        }
 
                        break;
        }
 
-       /* FIXME: be able to skip unknown macro lines! */
-
        mac[i - 1] = 0;
 
        if (i == 5 || i <= 2) {
        mac[i - 1] = 0;
 
        if (i == 5 || i <= 2) {