]> granicus.if.org Git - mutt/commitdiff
Fix the makedoc program to cope with the new MuttVars format.
authorKevin McCarthy <kevin@8t8.us>
Tue, 25 Jun 2019 02:41:30 +0000 (19:41 -0700)
committerKevin McCarthy <kevin@8t8.us>
Wed, 26 Jun 2019 22:52:39 +0000 (15:52 -0700)
Add '=' to token delimiter, to make the parsing more robust if
someone decides to add spaces between a designator and value.

doc/makedoc.c

index 94324bdc904cabf0b7067880d8c221780cdb81a1..e9f42d03d16e9a94134598b2a80fa274c60258cf 100644 (file)
@@ -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);
 
-  /* <default value> or UL <default value> */
-  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=" + <default value> + "}" */
+  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));