From: Kevin McCarthy Date: Tue, 25 Jun 2019 02:41:30 +0000 (-0700) Subject: Fix the makedoc program to cope with the new MuttVars format. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0d53c86e55a8142744a5dad3c75271b97744785b;p=mutt Fix the makedoc program to cope with the new MuttVars format. Add '=' to token delimiter, to make the parsing more robust if someone decides to add spaces between a designator and value. --- diff --git a/doc/makedoc.c b/doc/makedoc.c index 94324bdc..e9f42d03 100644 --- a/doc/makedoc.c +++ b/doc/makedoc.c @@ -240,7 +240,7 @@ static char *skip_ws (char *s) /* isolate a token */ -static char single_char_tokens[] = "[]{},;|"; +static char single_char_tokens[] = "[]{},;|="; static char *get_token (char *d, size_t l, char *s) { @@ -446,23 +446,25 @@ static void handle_confline (char *s, FILE *out) break; } - /* option name or UL &address */ - if (!(s = get_token (buff, sizeof (buff), s))) return; - if (!strcmp (buff, "UL")) - if (!(s = get_token (buff, sizeof (buff), s))) return; + /* "{.l=" or "{.p=" + option name or &address + "}" */ + if (!(s = get_token (buff, sizeof (buff), s))) return; /* { */ + if (!(s = get_token (buff, sizeof (buff), s))) return; /* .l or .p */ + if (strcmp (buff, ".l") && (strcmp (buff, ".p"))) return; + if (!(s = get_token (buff, sizeof (buff), s))) return; /* = */ + if (!(s = get_token (buff, sizeof (buff), s))) return; /* option name */ + if (!(s = get_token (buff, sizeof (buff), s))) return; /* } */ /* comma */ if (!(s = get_token (buff, sizeof (buff), s))) return; if (Debug) fprintf (stderr, "%s: Expecting default value.\n", Progname); - /* or UL */ - if (!(s = get_token (buff, sizeof (buff), s))) return; - if (!strcmp (buff, "UL")) - { - if (Debug) fprintf (stderr, "%s: Skipping UL.\n", Progname); - if (!(s = get_token (buff, sizeof (buff), s))) return; - } + /* "{.l=" or "{.p=" + + "}" */ + if (!(s = get_token (buff, sizeof (buff), s))) return; /* { */ + if (!(s = get_token (buff, sizeof (buff), s))) return; /* .l or .p */ + if (strcmp (buff, ".l") && (strcmp (buff, ".p"))) return; + if (!(s = get_token (buff, sizeof (buff), s))) return; /* = */ + if (!(s = get_token (buff, sizeof (buff), s))) return; /* default value */ memset (tmp, 0, sizeof (tmp));