X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fdoc_extract-core.c;h=2862eedc3b91a839749e34fe2f0ac516532a1eb6;hp=583328a16c6ea5797f6dfebd5789c71d206dcf5b;hb=ad3f309e3c13d6b88864aab146895c9df9bc6e5b;hpb=8566131a68d4e0e5e10a5179bd50e18106ac646d diff --git a/tools/doc_extract-core.c b/tools/doc_extract-core.c index 583328a1..2862eedc 100644 --- a/tools/doc_extract-core.c +++ b/tools/doc_extract-core.c @@ -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)