If a shortopt is configured out right before a bare longopt, the option parsing infrastructure segfaults because there's no next shortopt but the list isn't empty. (There was a test for this, but we're simultaneously traversing two lists and it was testing the wrong one.)
diff --git a/scripts/mkflags.c b/scripts/mkflags.c
index 228cd2f..d87087b 100644
--- a/scripts/mkflags.c
+++ b/scripts/mkflags.c
@@ -122,10 +122,14 @@
     char *gaps, *mgaps, c;
     unsigned bit;
 
-    *command = 0;
+    *command = *flags = *allflags = 0;
     bit = fscanf(stdin, "%255s \"%1023[^\"]\" \"%1023[^\"]\"\n",
                     command, flags, allflags);
 
+    if (getenv("DEBUG"))
+      fprintf(stderr, "command=%s, flags=%s, allflags=%s\n",
+        command, flags, allflags);
+
     if (!*command) break;
     if (bit != 3) {
       fprintf(stderr, "\nError in %s (duplicate command?)\n", command);
@@ -182,8 +186,7 @@
           if (flist) flist = flist->next;
         }
       } else if (aflist->command) {
-        if (flist && (!aflist->command || *aflist->command == *flist->command))
-        {
+        if (flist && (!flist->command || *aflist->command == *flist->command)) {
           if (aflist->command)
             sprintf(out, "#define FLAG_%c (1<<%d)\n", *aflist->command, bit);
           flist = flist->next;