bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Regression in 4.12: install-info inserts spurious whitespace


From: Karl Berry
Subject: Re: Regression in 4.12: install-info inserts spurious whitespace
Date: Tue, 13 May 2008 12:41:41 -0500

    * config.                                       status: 
                                                      (autoconf)config.status 
Invocation. Recreating configurations.

Thanks again for the report.  I installed this patch in CVS and it
passes all (now) 52 tests.

(The basic idea is to use ". " instead of just "." to separate the node
name from the description, so we can handle config.status.  Sigh.)

I plan to make another release shortly for this and Sergey's major Info
improvements.

Thanks,
k


--- install-info.c      30 Apr 2008 22:17:08 -0000      1.11
+++ install-info.c      12 May 2008 18:47:29 -0000
@@ -1451,4 +1451,10 @@ split_entry (char *entry, char **name, s
 
-  /* on the first line, the description starts after the first period. */
+  /* on the first line, the description starts after the first ". ";
+     that's a period and space -- our heuristic to handle item names like
+     "config.status", and node names like "config.status Invocation".  */
   char *ptr = strchr (entry, '.');
+  while (ptr && ptr[1] != ' ' && ptr[1] != '\t') {
+    ptr = strchr (ptr + 1, '.');
+  }
+  
   /* Maybe there's no period, and no description */
@@ -1476,3 +1482,2 @@ split_entry (char *entry, char **name, s
     {
-
       /* Eat up the whitespace after the name, and at the start of a line. */
@@ -1600,3 +1605,3 @@ add_missing_basenames (struct spec_entry
           size_t name_len = strlen (name);
-          char *ptr = strstr (entry->text, ": ().");
+          char *ptr = strstr (entry->text, ": (). ");
           if (!ptr)
@@ -1604,6 +1609,6 @@ add_missing_basenames (struct spec_entry
           ptr[0] = '\0';
-          rest = ptr += sizeof (": ().");
+          rest = ptr += strlen (": (). ");
 
-          info = xmalloc (name_len +  6);
-          snprintf (info, name_len + 6, ": (%s).", name);
+          info = xmalloc (name_len + 7);
+          snprintf (info, name_len + 7, ": (%s). ", name);
           text = concat (entry->text, info, rest);
@@ -1674,4 +1679,4 @@ add_missing_descriptions (struct spec_en
           int add_nl = 1;
-          if (entry->text)
-            if (entry->text[entry->text_len - 1] == '\n')
+          if (strlen (desc) > 1)
+            if (desc[strlen (desc) - 1] == '\n')
               add_nl = 0;
@@ -1912,4 +1917,7 @@ main (int argc, char *argv[])
             /* Concat the description onto the current entry, adding a 
-               newline if we need one. */
-            next->text = concat (next->text == NULL ? "" : next->text, optarg, 
+               newline if we need one.  Prepend a space if we have no
+               previous text, since eventually we will be adding the
+               "* foo ()." and we want to end up with a ". " for parsing.  */
+            next->text = concat (next->text ? next->text : " ",
+                                 optarg, 
                                  optarg[length - 1] == '\n' ? "" : "\n");
@@ -1960,6 +1968,6 @@ main (int argc, char *argv[])
               {
-                /* Make enough space for "* foo: ().\n". */
+                /* Make enough space for "* foo: (). ". */
                 length = strlen (optarg) + 9;
                 next->text = xmalloc (length);
-                snprintf (next->text, length, "* %s: ().\n", optarg);
+                snprintf (next->text, length, "* %s: (). ", optarg);
                 next->missing_basename = 1;
@@ -1970,6 +1978,6 @@ main (int argc, char *argv[])
               {
-                /* Make enough space for "foo\n". */
+                /* Make enough space for "foo ". */
                 length = strlen (optarg) + 2;
                 next->text = xmalloc (length);
-                snprintf (next->text, length, "%s\n", optarg);
+                snprintf (next->text, length, "%s ", optarg);
                 next->missing_basename = 0;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]