]> git.ozlabs.org Git - ccan/blobdiff - tools/doc_extract-core.c
ccanlint: typo fix and fix errant description parsing.
[ccan] / tools / doc_extract-core.c
index 583328a16c6ea5797f6dfebd5789c71d206dcf5b..2862eedc3b91a839749e34fe2f0ac516532a1eb6 100644 (file)
@@ -52,13 +52,20 @@ static bool is_blank(const char *line)
 
 static bool is_section(const char *line, bool one_liner)
 {
-       unsigned int len;
+       unsigned int len = 0;
 
-       if (!isupper(line[0]))
-               return false;
-       len = strspn(line, IDENT_CHARS" ");
-       if (line[len] != ':')
-               return false;
+       /* Any number of upper case words separated by spaces, ending in : */
+       for (;;) {
+               if (!isupper(line[len]))
+                       return false;
+               len += strspn(line+len, IDENT_CHARS);
+               if (line[len] == ':')
+                       break;
+
+               if (line[len] != ' ')
+                       return false;
+               len++;
+       }
 
        /* If it can be a one-liner, a space is sufficient.*/
        if (one_liner)