Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 220695
Collapse All | Expand All

(-)texinfo-4.12-orig/install-info/install-info.c (-14 / +24 lines)
Lines 1449-1463 Link Here
1449
{
1449
{
1450
  char *endptr;
1450
  char *endptr;
1451
1451
1452
  /* on the first line, the description starts after the first period. */
1452
  /* on the first line, the description starts after the first ". ";
1453
     that's a period and space -- our heuristic to handle item names like
1454
     "config.status", and node names like "config.status Invocation".
1455
     Also accept period-tab and period-newline.  */
1453
  char *ptr = strchr (entry, '.');
1456
  char *ptr = strchr (entry, '.');
1457
  while (ptr && ptr[1] != ' ' && ptr[1] != '\t' && ptr[1] != '\n') {
1458
    ptr = strchr (ptr + 1, '.');
1459
  }
1460
  
1454
  /* Maybe there's no period, and no description */
1461
  /* Maybe there's no period, and no description */
1455
  if (!ptr)
1462
  if (!ptr)
1456
    {
1463
    {
1457
      size_t length = strlen (entry);
1464
      size_t length = strlen (entry);
1458
      if (length == 0)
1465
      if (length == 0)
1459
        return;
1466
        return;
1460
      *name = strdup (ptr);
1467
      *name = strdup (entry);
1461
      *name_len = length + 1;
1468
      *name_len = length + 1;
1462
      return;
1469
      return;
1463
    }
1470
    }
Lines 1598-1611 Link Here
1598
          /* Insert NAME into the right place in ENTRY->TEXT. */
1605
          /* Insert NAME into the right place in ENTRY->TEXT. */
1599
          char *info, *rest, *text;
1606
          char *info, *rest, *text;
1600
          size_t name_len = strlen (name);
1607
          size_t name_len = strlen (name);
1601
          char *ptr = strstr (entry->text, ": ().");
1608
          char *ptr = strstr (entry->text, ": (). ");
1602
          if (!ptr)
1609
          if (!ptr)
1603
            return;
1610
            return;
1604
          ptr[0] = '\0';
1611
          ptr[0] = '\0';
1605
          rest = ptr += sizeof (": ().");
1612
          rest = ptr += strlen (": (). ");
1606
1613
1607
          info = xmalloc (name_len +  6);
1614
          info = xmalloc (name_len + 7);
1608
          snprintf (info, name_len + 6, ": (%s).", name);
1615
          snprintf (info, name_len + 7, ": (%s). ", name);
1609
          text = concat (entry->text, info, rest);
1616
          text = concat (entry->text, info, rest);
1610
          free (info);
1617
          free (info);
1611
          if (entry->text)
1618
          if (entry->text)
Lines 1672-1679 Link Here
1672
        {
1679
        {
1673
          char *text;
1680
          char *text;
1674
          int add_nl = 1;
1681
          int add_nl = 1;
1675
          if (entry->text)
1682
          if (strlen (desc) > 1)
1676
            if (entry->text[entry->text_len - 1] == '\n')
1683
            if (desc[strlen (desc) - 1] == '\n')
1677
              add_nl = 0;
1684
              add_nl = 0;
1678
          /* Append DESC onto ENTRY->TEXT. */
1685
          /* Append DESC onto ENTRY->TEXT. */
1679
          text = concat (entry->text == NULL ? "" : entry->text, desc,
1686
          text = concat (entry->text == NULL ? "" : entry->text, desc,
Lines 1910-1917 Link Here
1910
                  nl[0] = '\0';
1917
                  nl[0] = '\0';
1911
              }
1918
              }
1912
            /* Concat the description onto the current entry, adding a 
1919
            /* Concat the description onto the current entry, adding a 
1913
               newline if we need one. */
1920
               newline if we need one.  Prepend a space if we have no
1914
            next->text = concat (next->text == NULL ? "" : next->text, optarg, 
1921
               previous text, since eventually we will be adding the
1922
               "* foo ()." and we want to end up with a ". " for parsing.  */
1923
            next->text = concat (next->text ? next->text : " ",
1924
                                 optarg, 
1915
                                 optarg[length - 1] == '\n' ? "" : "\n");
1925
                                 optarg[length - 1] == '\n' ? "" : "\n");
1916
            next->text_len = strlen (next->text);
1926
            next->text_len = strlen (next->text);
1917
          }
1927
          }
Lines 1958-1977 Link Here
1958
            size_t length;
1968
            size_t length;
1959
            if (optarg[0] != '*')
1969
            if (optarg[0] != '*')
1960
              {
1970
              {
1961
                /* Make enough space for "* foo: ().\n". */
1971
                /* Make enough space for "* foo: (). ". */
1962
                length = strlen (optarg) + 9;
1972
                length = strlen (optarg) + 9;
1963
                next->text = xmalloc (length);
1973
                next->text = xmalloc (length);
1964
                snprintf (next->text, length, "* %s: ().\n", optarg);
1974
                snprintf (next->text, length, "* %s: (). ", optarg);
1965
                next->missing_basename = 1;
1975
                next->missing_basename = 1;
1966
                /* The basename will be inserted in between the parentheses
1976
                /* The basename will be inserted in between the parentheses
1967
                   at a later time.  See add_missing_basenames. */
1977
                   at a later time.  See add_missing_basenames. */
1968
              }
1978
              }
1969
            else
1979
            else
1970
              {
1980
              {
1971
                /* Make enough space for "foo\n". */
1981
                /* Make enough space for "foo ". */
1972
                length = strlen (optarg) + 2;
1982
                length = strlen (optarg) + 2;
1973
                next->text = xmalloc (length);
1983
                next->text = xmalloc (length);
1974
                snprintf (next->text, length, "%s\n", optarg);
1984
                snprintf (next->text, length, "%s ", optarg);
1975
                next->missing_basename = 0;
1985
                next->missing_basename = 0;
1976
                /* FIXME: check for info entry correctness in TEXT. 
1986
                /* FIXME: check for info entry correctness in TEXT. 
1977
                   e.g. `* Aaa: (bbb).' */
1987
                   e.g. `* Aaa: (bbb).' */

Return to bug 220695