X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=tools%2Fdoc_extract-core.c;h=07d31c77c01f15e85cbc3cebda601b050b916c5f;hb=0ea24c2371174de37c61fe9af37201f21a67f50e;hp=583328a16c6ea5797f6dfebd5789c71d206dcf5b;hpb=904cfe9453e7350d6df3d0f2166c36d86f252546;p=ccan diff --git a/tools/doc_extract-core.c b/tools/doc_extract-core.c index 583328a1..07d31c77 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) @@ -75,9 +82,10 @@ static unsigned int is_summary_line(const char *line) id_len = strspn(line, IDENT_CHARS" "); if (id_len == 0) return 0; + if (strspn(line, " ") == id_len) + return 0; if (!strstarts(line + id_len-1, " - ")) return 0; - return id_len - 1; }