|
|
#include <getopt.h> | #include <getopt.h> |
| |
static char *progname = "install-info"; | static char *progname = "install-info"; |
|
/* Added for compatibility with FreeBSD texinfo */ |
|
static char *default_section = NULL; |
| |
struct spec_entry; | struct spec_entry; |
struct spec_section; | struct spec_section; |
|
|
/* This table defines all the long-named options, says whether they | /* This table defines all the long-named options, says whether they |
use an argument, and maps them into equivalent single-letter options. */ | use an argument, and maps them into equivalent single-letter options. */ |
| |
|
/* defentry and defsection added for compatibility with FreeBSD texinfo */ |
|
|
struct option longopts[] = | struct option longopts[] = |
{ | { |
{ "delete", no_argument, NULL, 'r' }, | { "delete", no_argument, NULL, 'r' }, |
|
{ "defentry", required_argument, NULL, 'E' }, |
|
{ "defsection", required_argument, NULL, 'S' }, |
{ "dir-file", required_argument, NULL, 'd' }, | { "dir-file", required_argument, NULL, 'd' }, |
{ "entry", required_argument, NULL, 'e' }, | { "entry", required_argument, NULL, 'e' }, |
{ "help", no_argument, NULL, 'h' }, | { "help", no_argument, NULL, 'h' }, |
|
|
xexit (1); | xexit (1); |
} | } |
| |
|
/* defentry and defsection added for compatibility with FreeBSD's texinfo */ |
void | void |
print_help (void) | print_help (void) |
{ | { |
|
|
Options:\n\ | Options:\n\ |
--delete delete existing entries for INFO-FILE from DIR-FILE;\n\ | --delete delete existing entries for INFO-FILE from DIR-FILE;\n\ |
don't insert any new entries.\n\ | don't insert any new entries.\n\ |
--dir-file=NAME specify file name of Info directory file.\n\ |
--defentry=TEXT same as --entry, but only use TEXT if an entry is not\n\ |
|
present in INFO-FILE.\n\ |
|
--desection=SEC same as --section, but only use TEXT if an entry is not\n\ |
|
present in INFO-FILE.\n\ |
|
--dir-file=NAME specify file name of Info directory file.\n\ |
This is equivalent to using the DIR-FILE argument.\n\ | This is equivalent to using the DIR-FILE argument.\n\ |
--entry=TEXT insert TEXT as an Info directory entry.\n\ | --entry=TEXT insert TEXT as an Info directory entry.\n\ |
TEXT should have the form of an Info menu item line\n\ | TEXT should have the form of an Info menu item line\n\ |
|
|
struct spec_entry *entries_to_add = NULL; | struct spec_entry *entries_to_add = NULL; |
int n_entries_to_add = 0; | int n_entries_to_add = 0; |
| |
|
/* Added for compatibility w/ original texinfo in FBSD */ |
|
struct spec_entry *default_entries_to_add = NULL; |
|
int n_default_entries_to_add = 0; |
|
|
/* Record the old text of the dir file, as plain characters, | /* Record the old text of the dir file, as plain characters, |
as lines, and as nodes. */ | as lines, and as nodes. */ |
char *dir_data; | char *dir_data; |
|
|
dirfile = concat (optarg, "", "/dir"); | dirfile = concat (optarg, "", "/dir"); |
break; | break; |
| |
|
case 'E': |
case 'e': | case 'e': |
{ | { |
struct spec_entry *next | struct spec_entry *next |
|
|
next->next = entries_to_add; | next->next = entries_to_add; |
entries_to_add = next; | entries_to_add = next; |
n_entries_to_add++; | n_entries_to_add++; |
} |
|
|
/* Added for compatibility with FreeBSD's texinfo */ |
|
if (opt == 'e') |
|
{ |
|
next->next = entries_to_add; |
|
entries_to_add = next; |
|
n_entries_to_add++; |
|
} |
|
else |
|
{ |
|
next->next = default_entries_to_add; |
|
default_entries_to_add = next; |
|
n_default_entries_to_add++; |
|
} |
|
} |
break; | break; |
| |
case 'h': | case 'h': |
|
|
} | } |
break; | break; |
| |
case 'V': |
/* Added for compatibility with FreeBSD's texinfo */ |
|
case 'S': |
|
default_section = optarg; |
|
break; |
|
|
|
case 'V': |
printf ("install-info (GNU %s) %s\n", PACKAGE, VERSION); | printf ("install-info (GNU %s) %s\n", PACKAGE, VERSION); |
puts (""); | puts (""); |
puts ("Copyright (C) 2004 Free Software Foundation, Inc."); | puts ("Copyright (C) 2004 Free Software Foundation, Inc."); |
|
|
{ | { |
input_sections = (struct spec_section *) | input_sections = (struct spec_section *) |
xmalloc (sizeof (struct spec_section)); | xmalloc (sizeof (struct spec_section)); |
input_sections->name = "Miscellaneous"; |
/* Modified for compatibility with FreeBSD's texinfo */ |
|
input_sections->name = |
|
default_section ? default_section : "Miscellaneous"; |
input_sections->next = NULL; | input_sections->next = NULL; |
input_sections->missing = 1; | input_sections->missing = 1; |
} | } |