Switch to texinfo 4.8, which is needed for a lot of new texi files.
[dragonfly.git] / gnu / usr.bin / texinfo / install-info / patches / install-info.c.patch
1 $DragonFly: src/gnu/usr.bin/texinfo/install-info/patches/install-info.c.patch,v 1.1 2005/08/28 12:25:05 asmodai Exp $
2
3 --- install-info.c      2005-08-28 12:43:06.000000000 +0200
4 +++ install-info.c      2005-05-23 12:50:48.000000000 +0200
5 @@ -1,3 +1,4 @@
6 +/* $FreeBSD: src/contrib/texinfo/util/install-info.c,v 1.16 2005/05/23 10:50:48 ru Exp $ */
7  /* install-info -- create Info directory entry(ies) for an Info file.
8     $Id: install-info.c,v 1.12 2004/04/11 17:56:47 karl Exp $
9  
10 @@ -22,6 +23,7 @@
11  #include <getopt.h>
12  
13  static char *progname = "install-info";
14 +static char *default_section = NULL;
15  
16  struct spec_entry;
17  struct spec_section;
18 @@ -120,6 +122,8 @@
19  struct option longopts[] =
20  {
21    { "delete",    no_argument, NULL, 'r' },
22 +  { "defentry",  required_argument, NULL, 'E' },
23 +  { "defsection", required_argument, NULL, 'S' },
24    { "dir-file",  required_argument, NULL, 'd' },
25    { "entry",     required_argument, NULL, 'e' },
26    { "help",      no_argument, NULL, 'h' },
27 @@ -439,6 +443,10 @@
28  Options:\n\
29   --delete          delete existing entries for INFO-FILE from DIR-FILE;\n\
30                       don't insert any new entries.\n\
31 + --defentry=TEXT   like --entry, but only use TEXT if an entry\n\
32 +                     is not present in INFO-FILE.\n\
33 + --defsection=TEXT like --section, but only use TEXT if a section\n\
34 +                     is not present in INFO-FILE.\n\
35   --dir-file=NAME   specify file name of Info directory file.\n\
36                       This is equivalent to using the DIR-FILE argument.\n\
37   --entry=TEXT      insert TEXT as an Info directory entry.\n\
38 @@ -900,7 +908,8 @@
39                       specified.  Default to section "Miscellaneous".  */
40                    *sections = (struct spec_section *)
41                      xmalloc (sizeof (struct spec_section));
42 -                  (*sections)->name = "Miscellaneous";
43 +                  (*sections)->name =
44 +                   default_section ? default_section : "Miscellaneous";
45                    (*sections)->next = 0;
46                    (*sections)->missing = 1;
47                    head = *sections;
48 @@ -1142,6 +1151,8 @@
49    struct spec_section *input_sections = NULL;
50    struct spec_entry *entries_to_add = NULL;
51    int n_entries_to_add = 0;
52 +  struct spec_entry *default_entries_to_add = NULL;
53 +  int n_default_entries_to_add = 0;
54  
55    /* Record the old text of the dir file, as plain characters,
56       as lines, and as nodes.  */
57 @@ -1205,6 +1216,7 @@
58            dirfile = concat (optarg, "", "/dir");
59            break;
60  
61 +       case 'E':
62          case 'e':
63            {
64              struct spec_entry *next
65 @@ -1219,9 +1231,18 @@
66              next->text_len = olen;
67              next->entry_sections = NULL;
68              next->entry_sections_tail = NULL;
69 -            next->next = entries_to_add;
70 -            entries_to_add = next;
71 -            n_entries_to_add++;
72 +           if (opt == 'e')
73 +             {
74 +               next->next = entries_to_add;
75 +               entries_to_add = next;
76 +               n_entries_to_add++;
77 +             }
78 +           else
79 +             {
80 +               next->next = default_entries_to_add;
81 +               default_entries_to_add = next;
82 +               n_default_entries_to_add++;
83 +             }
84            }
85            break;
86  
87 @@ -1259,6 +1280,10 @@
88            }
89            break;
90  
91 +       case 'S':
92 +         default_section = optarg;
93 +         break;
94 +
95          case 'V':
96            printf ("install-info (GNU %s) %s\n", PACKAGE, VERSION);
97            puts ("");
98 @@ -1301,6 +1326,11 @@
99                     &input_sections, &entries_to_add);
100    if (i > n_entries_to_add)
101      n_entries_to_add = i;
102 +  else if (n_entries_to_add == 0)
103 +    {
104 +      entries_to_add = default_entries_to_add;
105 +      n_entries_to_add = n_default_entries_to_add;
106 +    }
107  
108    if (!delete_flag)
109      {
110 @@ -1332,7 +1362,8 @@
111              {
112                input_sections = (struct spec_section *)
113                  xmalloc (sizeof (struct spec_section));
114 -              input_sections->name = "Miscellaneous";
115 +              input_sections->name =
116 +               default_section ? default_section : "Miscellaneous";
117                input_sections->next = NULL;
118                input_sections->missing = 1;
119              }
120 @@ -1423,9 +1454,14 @@
121                                                  dir_lines[i].start,
122                                                  dir_lines[i].size)
123                              && !dir_lines[i].delete)
124 -                          fatal (_("menu item `%s' already exists, for file `%s'"),
125 +                         {
126 +                           if (quiet_flag)
127 +                             dir_lines[i].delete = 1;
128 +                           else
129 +                             fatal (_("menu item `%s' already exists, for file `%s'"),
130                                   extract_menu_item_name (entry->text),
131                                   extract_menu_file_name (dir_lines[i].start));
132 +                         }
133                          if (dir_lines[i].start[0] == '*'
134                              && menu_line_lessp (entry->text, entry->text_len,
135                                                  dir_lines[i].start,