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 $
3 --- install-info.c 2005-08-28 12:43:06.000000000 +0200
4 +++ install-info.c 2005-05-23 12:50:48.000000000 +0200
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 $
13 static char *progname = "install-info";
14 +static char *default_section = NULL;
19 struct option longopts[] =
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' },
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\
39 specified. Default to section "Miscellaneous". */
40 *sections = (struct spec_section *)
41 xmalloc (sizeof (struct spec_section));
42 - (*sections)->name = "Miscellaneous";
44 + default_section ? default_section : "Miscellaneous";
45 (*sections)->next = 0;
46 (*sections)->missing = 1;
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;
55 /* Record the old text of the dir file, as plain characters,
56 as lines, and as nodes. */
58 dirfile = concat (optarg, "", "/dir");
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;
74 + next->next = entries_to_add;
75 + entries_to_add = next;
80 + next->next = default_entries_to_add;
81 + default_entries_to_add = next;
82 + n_default_entries_to_add++;
87 @@ -1259,6 +1280,10 @@
92 + default_section = optarg;
96 printf ("install-info (GNU %s) %s\n", PACKAGE, VERSION);
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)
104 + entries_to_add = default_entries_to_add;
105 + n_entries_to_add = n_default_entries_to_add;
110 @@ -1332,7 +1362,8 @@
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;
120 @@ -1423,9 +1454,14 @@
123 && !dir_lines[i].delete)
124 - fatal (_("menu item `%s' already exists, for file `%s'"),
127 + dir_lines[i].delete = 1;
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));
133 if (dir_lines[i].start[0] == '*'
134 && menu_line_lessp (entry->text, entry->text_len,