Restore rev 1.2 and 1.3 after they got spammed and backed out in rev 1.7
and 1.8 as those features are used by the ports tree. (RELENG_3 candidate)
This commit is contained in:
parent
90fc20cae7
commit
2d99258bc3
@ -294,6 +294,10 @@ Install INFO-FILE in the Info directory file DIR-FILE.\n\
|
|||||||
Options:\n\
|
Options:\n\
|
||||||
--delete Delete existing entries in INFO-FILE;\n\
|
--delete Delete existing entries in INFO-FILE;\n\
|
||||||
don't insert any new entries.\n\
|
don't insert any new entries.\n\
|
||||||
|
--defentry=TEXT Like --entry, but only use TEXT if an entry\n\
|
||||||
|
is not present in INFO-FILE.\n\
|
||||||
|
--defsection=TEXT Like --section, but only use TEXT if a section\n\
|
||||||
|
is not present in INFO-FILE.\n\
|
||||||
--dir-file=NAME Specify file name of Info directory 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\
|
||||||
@ -302,6 +306,7 @@ Options:\n\
|
|||||||
If you specify more than one entry, they are all added.\n\
|
If you specify more than one entry, they are all added.\n\
|
||||||
If you don't specify any entries, they are determined\n\
|
If you don't specify any entries, they are determined\n\
|
||||||
from information in the Info file itself.\n\
|
from information in the Info file itself.\n\
|
||||||
|
--forceentry=TEXT Like --entry, but ignore any entry in INFO-FILE.\n\
|
||||||
--help Display this help and exit.\n\
|
--help Display this help and exit.\n\
|
||||||
--info-file=FILE Specify Info file to install in the directory.\n\
|
--info-file=FILE Specify Info file to install in the directory.\n\
|
||||||
This is equivalent to using the INFO-FILE argument.\n\
|
This is equivalent to using the INFO-FILE argument.\n\
|
||||||
@ -376,8 +381,11 @@ File: dir,\tNode: Top,\tThis is the top of the INFO tree\n\
|
|||||||
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' },
|
||||||
|
{ "forceentry", required_argument, NULL, 'f' },
|
||||||
{ "help", no_argument, NULL, 'h' },
|
{ "help", no_argument, NULL, 'h' },
|
||||||
{ "info-dir", required_argument, NULL, 'D' },
|
{ "info-dir", required_argument, NULL, 'D' },
|
||||||
{ "info-file", required_argument, NULL, 'i' },
|
{ "info-file", required_argument, NULL, 'i' },
|
||||||
@ -430,6 +438,11 @@ main (argc, argv)
|
|||||||
int prefix_length;
|
int prefix_length;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
/* Nonzero means only use if not present in info file. */
|
||||||
|
int entry_default = 0;
|
||||||
|
int entry_force = 0;
|
||||||
|
int section_default = 0;
|
||||||
|
|
||||||
progname = argv[0];
|
progname = argv[0];
|
||||||
|
|
||||||
#ifdef HAVE_SETLOCALE
|
#ifdef HAVE_SETLOCALE
|
||||||
@ -478,6 +491,17 @@ main (argc, argv)
|
|||||||
dirfile = concat (optarg, "", "/dir");
|
dirfile = concat (optarg, "", "/dir");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'f':
|
||||||
|
entry_force = 1;
|
||||||
|
if (!optarg[0])
|
||||||
|
{
|
||||||
|
fprintf (stderr, "%s: Must provide entry name.\n", progname);
|
||||||
|
suggest_asking_for_help ();
|
||||||
|
}
|
||||||
|
case 'E':
|
||||||
|
entry_default = 1;
|
||||||
|
if (!optarg[0])
|
||||||
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
{
|
{
|
||||||
struct spec_entry *next
|
struct spec_entry *next
|
||||||
@ -514,6 +538,10 @@ main (argc, argv)
|
|||||||
delete_flag = 1;
|
delete_flag = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'S':
|
||||||
|
section_default = 1;
|
||||||
|
if (!optarg[0])
|
||||||
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
{
|
{
|
||||||
struct spec_section *next
|
struct spec_section *next
|
||||||
@ -539,6 +567,9 @@ For more information about these matters, see the files named COPYING.\n"),
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (entry_force)
|
||||||
|
entry_default = 0;
|
||||||
|
|
||||||
/* Interpret the non-option arguments as file names. */
|
/* Interpret the non-option arguments as file names. */
|
||||||
for (; optind < argc; ++optind)
|
for (; optind < argc; ++optind)
|
||||||
{
|
{
|
||||||
@ -562,7 +593,7 @@ For more information about these matters, see the files named COPYING.\n"),
|
|||||||
|
|
||||||
/* Parse the input file to find the section names it specifies. */
|
/* Parse the input file to find the section names it specifies. */
|
||||||
|
|
||||||
if (input_sections == 0)
|
if (input_sections == 0 || section_default)
|
||||||
{
|
{
|
||||||
prefix_length = strlen ("INFO-DIR-SECTION ");
|
prefix_length = strlen ("INFO-DIR-SECTION ");
|
||||||
for (i = 0; i < input_nlines; i++)
|
for (i = 0; i < input_nlines; i++)
|
||||||
@ -572,6 +603,13 @@ For more information about these matters, see the files named COPYING.\n"),
|
|||||||
{
|
{
|
||||||
struct spec_section *next
|
struct spec_section *next
|
||||||
= (struct spec_section *) xmalloc (sizeof (struct spec_section));
|
= (struct spec_section *) xmalloc (sizeof (struct spec_section));
|
||||||
|
|
||||||
|
if (section_default)
|
||||||
|
{
|
||||||
|
input_sections = NULL; /* This leaks. */
|
||||||
|
section_default = 0;
|
||||||
|
}
|
||||||
|
|
||||||
next->name = copy_string (input_lines[i].start + prefix_length,
|
next->name = copy_string (input_lines[i].start + prefix_length,
|
||||||
input_lines[i].size - prefix_length);
|
input_lines[i].size - prefix_length);
|
||||||
next->next = input_sections;
|
next->next = input_sections;
|
||||||
@ -595,7 +633,7 @@ For more information about these matters, see the files named COPYING.\n"),
|
|||||||
and put them on entries_to_add. But not if entries
|
and put them on entries_to_add. But not if entries
|
||||||
were specified explicitly with command options. */
|
were specified explicitly with command options. */
|
||||||
|
|
||||||
if (entries_to_add == 0)
|
if ( !entry_force && (entries_to_add == 0 || entry_default) )
|
||||||
{
|
{
|
||||||
char *start_of_this_entry = 0;
|
char *start_of_this_entry = 0;
|
||||||
for (i = 0; i < input_nlines; i++)
|
for (i = 0; i < input_nlines; i++)
|
||||||
@ -616,6 +654,13 @@ For more information about these matters, see the files named COPYING.\n"),
|
|||||||
{
|
{
|
||||||
struct spec_entry *next
|
struct spec_entry *next
|
||||||
= (struct spec_entry *) xmalloc (sizeof (struct spec_entry));
|
= (struct spec_entry *) xmalloc (sizeof (struct spec_entry));
|
||||||
|
|
||||||
|
if (entry_default)
|
||||||
|
{
|
||||||
|
entries_to_add = NULL;
|
||||||
|
entry_default = 0;
|
||||||
|
}
|
||||||
|
|
||||||
next->text = copy_string (start_of_this_entry,
|
next->text = copy_string (start_of_this_entry,
|
||||||
input_lines[i].start - start_of_this_entry);
|
input_lines[i].start - start_of_this_entry);
|
||||||
next->next = entries_to_add;
|
next->next = entries_to_add;
|
||||||
|
Loading…
Reference in New Issue
Block a user