[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[5909] new install-info option --defsection (and no-op --defentry)
From: |
karl |
Subject: |
[5909] new install-info option --defsection (and no-op --defentry) |
Date: |
Thu, 06 Nov 2014 17:11:08 +0000 |
Revision: 5909
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5909
Author: karl
Date: 2014-11-06 17:10:58 +0000 (Thu, 06 Nov 2014)
Log Message:
-----------
new install-info option --defsection (and no-op --defentry)
Modified Paths:
--------------
trunk/ChangeLog
trunk/NEWS
trunk/install-info/install-info.c
trunk/install-info/tests/Makefile.am
trunk/install-info/tests/defs.in
Added Paths:
-----------
trunk/install-info/tests/ii-0055-expected-dir-file
trunk/install-info/tests/ii-0055-input-dir-file
trunk/install-info/tests/ii-0055-input-info-file
trunk/install-info/tests/ii-0055-test
trunk/install-info/tests/ii-0056-expected-dir-file
trunk/install-info/tests/ii-0056-input-dir-file
trunk/install-info/tests/ii-0056-input-info-file
trunk/install-info/tests/ii-0056-test
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2014-11-04 18:04:40 UTC (rev 5908)
+++ trunk/ChangeLog 2014-11-06 17:10:58 UTC (rev 5909)
@@ -1,5 +1,19 @@
2014-11-04 Karl Berry <address@hidden>
+ * install-info/tests/Makefile.am (TESTS, EXTRA_DIST):
+ new tests 55, 56 for --defsection; plus the new files.
+ Turns out --defentry was a no-op, so omit it from help string
+ but leave code in case someone wants it.
+ * NEWS: mention new option.
+
+2014-11-04 Pietro Cerutti <address@hidden>
+
+ * install-info/install-info.c: new options --defentry and
+ --defsection (written for BSD). Retrieved from
+
http://svnweb.freebsd.org/ports/head/print/texinfo/files/patch-install-info_install-info.c
+
+2014-11-04 Karl Berry <address@hidden>
+
* doc/texinfo.texi: no leading @ characters in command index.
2014-10-03 Gavin Smith <address@hidden>
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2014-11-04 18:04:40 UTC (rev 5908)
+++ trunk/NEWS 2014-11-06 17:10:58 UTC (rev 5909)
@@ -58,6 +58,8 @@
* install-info:
. handle compressed input file names containing spaces.
. exit successfully if --remove is given and the dir file does not exist.
+ . new option --defsection, to be used instead of "Miscellaneous" when
+ a section is not present in the Info file.
* texi2dvi:
. look for the environment variable THUMBPDF_CMD instead of THUMBPDF,
Modified: trunk/install-info/install-info.c
===================================================================
--- trunk/install-info/install-info.c 2014-11-04 18:04:40 UTC (rev 5908)
+++ trunk/install-info/install-info.c 2014-11-06 17:10:58 UTC (rev 5909)
@@ -26,6 +26,7 @@
#define TAB_WIDTH 8
static char *progname = "install-info";
+static char *default_section = NULL;
struct spec_entry;
struct spec_section;
@@ -146,6 +147,8 @@
{ "calign", required_argument, NULL, 'C'},
{ "debug", no_argument, NULL, 'g' },
{ "delete", no_argument, NULL, 'r' },
+ { "defentry", required_argument, NULL, 'E' },
+ { "defsection", required_argument, NULL, 'S' },
{ "dir-file", required_argument, NULL, 'd' },
{ "entry", required_argument, NULL, 'e' },
{ "name", required_argument, NULL, 't' },
@@ -553,6 +556,8 @@
--debug report what is being done.\n\
--delete delete existing entries for INFO-FILE from DIR-FILE;\n\
don't insert any new entries.\n\
+ --defsection=TEXT like --section, but only use TEXT if no sections\n\
+ are present in INFO-FILE (replacing
\"Miscellaneous\").\n\
--description=TEXT the description of the entry is TEXT; used with\n\
the --name option to become synonymous with the\n\
--entry option.\n\
@@ -595,7 +600,10 @@
If you specify more than one section, all the entries\n\
are added in each of the sections.\n\
If you don't specify any sections, they are determined\n\
- from information in the Info file itself.\n\
+ from information in the Info file itself;\n\
+ if nothing is available there, the --defsection\n\
+ value is used; if that is not specified, the\n\
+ final default is \"Miscellaneous\".\n\
--section R SEC equivalent to --regex=R --section=SEC --add-once."));
puts (_("\
@@ -1887,6 +1895,8 @@
struct spec_entry *entries_to_add = NULL;
struct spec_entry *entries_to_add_from_file = NULL;
int n_entries_to_add = 0;
+ 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,
as lines, and as nodes. */
@@ -2077,6 +2087,7 @@
}
break;
+ case 'E':
case 'e':
{
struct spec_entry *next
@@ -2091,12 +2102,27 @@
next->text_len = olen;
next->entry_sections = NULL;
next->entry_sections_tail = NULL;
- next->next = entries_to_add;
next->missing_name = 0;
next->missing_basename = 0;
next->missing_description = 0;
- entries_to_add = next;
- n_entries_to_add++;
+ if (opt == 'e')
+ {
+ next->next = entries_to_add;
+ entries_to_add = next;
+ n_entries_to_add++;
+ }
+ else
+ {
+ /* Although this list is maintained, nothing is ever
+ done with it. So it seems no one cares about the
+ feature. The intended --help string was:
+ --defentry=TEXT like --entry, but only use TEXT if an entry\n\
+ is not present in INFO-FILE.\n\
+ in case anyone ever wants to finish it. */
+ next->next = default_entries_to_add;
+ default_entries_to_add = next;
+ n_default_entries_to_add++;
+ }
}
break;
@@ -2163,6 +2189,10 @@
}
break;
+ case 'S':
+ default_section = optarg;
+ break;
+
case 's':
{
struct spec_section *next
@@ -2370,12 +2400,14 @@
reformat_new_entries (entries_to_add, calign, align, maxwidth);
}
- /* If we got no sections, default to "Miscellaneous". */
+ /* If we got no sections, use the --defsection value if it was
+ given, else "Miscellaneous". */
if (input_sections == NULL)
{
input_sections = (struct spec_section *)
xmalloc (sizeof (struct spec_section));
- input_sections->name = "Miscellaneous";
+ input_sections->name = default_section ? default_section
+ : "Miscellaneous";
input_sections->next = NULL;
input_sections->missing = 1;
}
Modified: trunk/install-info/tests/Makefile.am
===================================================================
--- trunk/install-info/tests/Makefile.am 2014-11-04 18:04:40 UTC (rev
5908)
+++ trunk/install-info/tests/Makefile.am 2014-11-06 17:10:58 UTC (rev
5909)
@@ -21,7 +21,8 @@
ii-0036-test ii-0037-test ii-0038-test ii-0039-test ii-0040-test \
ii-0041-test ii-0042-test ii-0043-test ii-0044-test ii-0045-test \
ii-0046-test ii-0047-test ii-0048-test ii-0049-test ii-0050-test \
-ii-0051-test ii-0052-test ii-0053-test ii-0054-test
+ii-0051-test ii-0052-test ii-0053-test ii-0054-test ii-0055-test \
+ii-0056-test
noinst_SCRIPTS=$(TESTS)
@@ -238,5 +239,13 @@
ii-0054-input-dir-file \
ii-0054-input-info-file.gz \
ii-0054-expected-dir-file \
-ii-0054-test \
+ii-0055-test \
+ii-0055-input-dir-file \
+ii-0055-input-info-file \
+ii-0055-expected-dir-file \
+ii-0055-test \
+ii-0056-input-dir-file \
+ii-0056-input-info-file \
+ii-0056-expected-dir-file \
+ii-0056-test \
README
Modified: trunk/install-info/tests/defs.in
===================================================================
--- trunk/install-info/tests/defs.in 2014-11-04 18:04:40 UTC (rev 5908)
+++ trunk/install-info/tests/defs.in 2014-11-06 17:10:58 UTC (rev 5909)
@@ -1,7 +1,7 @@
# @configure_input@
# $Id$
#
-# Copyright 2008, 2012 Free Software Foundation, Inc.
+# Copyright 2008, 2012, 2013, 2014 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,8 @@
export SHELL
# unsetting an already-unset variable fails with BSD sh.
-CDPATH=; unset CDPATH
+CDPATH=
+unset CDPATH
# Ensure we are running from the right directory.
if test ! -f ./defs; then
@@ -39,11 +40,11 @@
fi
# Two variables we use in the test scripts:
address@hidden@
+top_builddir='@top_builddir@'
install_info=${top_builddir}/install-info/ginstall-info
export install_info
#
address@hidden@
+top_srcdir='@top_srcdir@'
testdir=${top_srcdir}/install-info/tests
export testdir
@@ -76,10 +77,10 @@
# (`test -x' is not enough, because it can also be true for directories.)
# We have to try this both for $1 and $1.exe.
#
- # Note: On Cygwin and DJGPP, `test -x' also looks for .exe. On Cygwin,
- # also `test -f' has this enhancement, but not on DJGPP. (Both are
- # design decisions, so there is little chance to make them consistent.)
- # Thusly, it seems to be difficult to make use of these enhancements.
+ # On Cygwin and DJGPP, `test -x' also looks for .exe. On Cygwin,
+ # also `test -f' has this enhancement, but not on DJGPP. Both are
+ # design decisions, so there is little chance to make them consistent.
+ # So we must check for .exe explicitly.
#
if { test -f "$dir/$1" && test -x "$dir/$1"; } \
|| { test -f "$dir/$1.exe" && test -x "$dir/$1.exe"; }; then
@@ -94,8 +95,8 @@
# Our mktemp substitute doesn't need all the features of real mktemp;
# our tests here only use it in the most simplistic way, to create a
# temp file. The autoconf manual suggests doing it in a temporary
-# directory (mode 700). ($RANDOM may expand to nothing, but that's ok.)
-# We do not even bother to expand the X's in the template ...
+# directory (mode 700), so do that. ($RANDOM may expand to nothing, but
+# that's ok.) We do not even bother to expand the X's in the template ...
mktemp ()
{
dir=$TMPDIR/iimktemp$$-$RANDOM
Added: trunk/install-info/tests/ii-0055-expected-dir-file
===================================================================
--- trunk/install-info/tests/ii-0055-expected-dir-file
(rev 0)
+++ trunk/install-info/tests/ii-0055-expected-dir-file 2014-11-06 17:10:58 UTC
(rev 5909)
@@ -0,0 +1,26 @@
+This is the directory file `dir' a.k.a. `DIR', which contains the
+ topmost node of the Info hierarchy.
+
+
+File: dir, Node: Top, This is the top of the INFO tree.
+
+This is the Info main menu (aka directory node).
+A few useful Info commands:
+
+ `q' quits;
+ `?' lists all Info commands;
+ `h' starts the Info tutorial;
+ `mTexinfo RET' visits the Texinfo manual, etc.
+
+* Menu:
+
+Animals
+* Aardvark: (aardvark). Medium-sized African mammal.
+* Baboon: (baboon). A monkey from Africa.
+* Chameleon: (chameleon). A lizard from Africa.
+* Deer: (deer). Ruminent antlered mammal.
+* Emu: (emu). A flightless bird from Australia.
+* Fisher: (fisher). A marten from North America.
+
+Antlered Animals
+* Gnu: (gnu). Wildebeest native to Africa.
Added: trunk/install-info/tests/ii-0055-input-dir-file
===================================================================
--- trunk/install-info/tests/ii-0055-input-dir-file
(rev 0)
+++ trunk/install-info/tests/ii-0055-input-dir-file 2014-11-06 17:10:58 UTC
(rev 5909)
@@ -0,0 +1,23 @@
+This is the directory file `dir' a.k.a. `DIR', which contains the
+ topmost node of the Info hierarchy.
+
+
+File: dir, Node: Top, This is the top of the INFO tree.
+
+This is the Info main menu (aka directory node).
+A few useful Info commands:
+
+ `q' quits;
+ `?' lists all Info commands;
+ `h' starts the Info tutorial;
+ `mTexinfo RET' visits the Texinfo manual, etc.
+
+* Menu:
+
+Animals
+* Aardvark: (aardvark). Medium-sized African mammal.
+* Baboon: (baboon). A monkey from Africa.
+* Chameleon: (chameleon). A lizard from Africa.
+* Deer: (deer). Ruminent antlered mammal.
+* Emu: (emu). A flightless bird from Australia.
+* Fisher: (fisher). A marten from North America.
Added: trunk/install-info/tests/ii-0055-input-info-file
===================================================================
--- trunk/install-info/tests/ii-0055-input-info-file
(rev 0)
+++ trunk/install-info/tests/ii-0055-input-info-file 2014-11-06 17:10:58 UTC
(rev 5909)
@@ -0,0 +1,7 @@
+
+File: gnu, Node: Top, Next: Top, Up: (dir)
+
+Gnu
+***
+
+The wildebeest (plural, wildebeest or wildebeests), also called the gnu
(pronounced /ˈnuː/ or /ˈnjuː/), is an antelope of the genus Connochaetes. It is
a hooved (ungulate) mammal. (Taken from wikepedia.)
Added: trunk/install-info/tests/ii-0055-test
===================================================================
--- trunk/install-info/tests/ii-0055-test (rev 0)
+++ trunk/install-info/tests/ii-0055-test 2014-11-06 17:10:58 UTC (rev
5909)
@@ -0,0 +1,28 @@
+#!/bin/sh -x
+# This file is free software; as a special exception the author gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+. ./defs || exit 1
+
+# test of --defsection, when its value is used.
+testnum=0055
+
+outputdirfile=`mktemp ii$testnum-XXXXXXXX`
+cp ${testdir}/ii-$testnum-input-dir-file $outputdirfile || exit 1
+
+${install_info} \
+ --defsection="Antlered Animals" \
+ --entry="* Gnu: (gnu). Wildebeest native to Africa." \
+ ${testdir}/ii-$testnum-input-info-file $outputdirfile \
+|| exit $?
+
+diff ${testdir}/ii-$testnum-expected-dir-file $outputdirfile
+retval=$?
+
+rm -f $outputdirfile
+exit $retval
Property changes on: trunk/install-info/tests/ii-0055-test
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/install-info/tests/ii-0056-expected-dir-file
===================================================================
--- trunk/install-info/tests/ii-0056-expected-dir-file
(rev 0)
+++ trunk/install-info/tests/ii-0056-expected-dir-file 2014-11-06 17:10:58 UTC
(rev 5909)
@@ -0,0 +1,18 @@
+This is the directory file `dir' a.k.a. `DIR', which contains the
+ topmost node of the Info hierarchy.
+
+
+File: dir, Node: Top, This is the top of the INFO tree.
+
+This is the Info main menu (aka directory node).
+A few useful Info commands:
+
+ `q' quits;
+ `?' lists all Info commands;
+ `h' starts the Info tutorial;
+ `mTexinfo RET' visits the Texinfo manual, etc.
+
+* Menu:
+
+Animals
+* Gnu: (gnu). Wildebeest native to Africa.
Added: trunk/install-info/tests/ii-0056-input-dir-file
===================================================================
--- trunk/install-info/tests/ii-0056-input-dir-file
(rev 0)
+++ trunk/install-info/tests/ii-0056-input-dir-file 2014-11-06 17:10:58 UTC
(rev 5909)
@@ -0,0 +1,23 @@
+This is the directory file `dir' a.k.a. `DIR', which contains the
+ topmost node of the Info hierarchy.
+
+
+File: dir, Node: Top, This is the top of the INFO tree.
+
+This is the Info main menu (aka directory node).
+A few useful Info commands:
+
+ `q' quits;
+ `?' lists all Info commands;
+ `h' starts the Info tutorial;
+ `mTexinfo RET' visits the Texinfo manual, etc.
+
+* Menu:
+
+Animals
+* Aardvark: (aardvark). Medium-sized African mammal.
+* Baboon: (baboon). A monkey from Africa.
+* Chameleon: (chameleon). A lizard from Africa.
+* Deer: (deer). Ruminent antlered mammal.
+* Emu: (emu). A flightless bird from Australia.
+* Fisher: (fisher). A marten from North America.
Added: trunk/install-info/tests/ii-0056-input-info-file
===================================================================
--- trunk/install-info/tests/ii-0056-input-info-file
(rev 0)
+++ trunk/install-info/tests/ii-0056-input-info-file 2014-11-06 17:10:58 UTC
(rev 5909)
@@ -0,0 +1,8 @@
+INFO-DIR-SECTION Animals
+
+File: gnu, Node: Top, Next: Top, Up: (dir)
+
+Gnu
+***
+
+The wildebeest (plural, wildebeest or wildebeests), also called the gnu
(pronounced /ˈnuː/ or /ˈnjuː/), is an antelope of the genus Connochaetes. It is
a hooved (ungulate) mammal. (Taken from wikepedia.)
Added: trunk/install-info/tests/ii-0056-test
===================================================================
--- trunk/install-info/tests/ii-0056-test (rev 0)
+++ trunk/install-info/tests/ii-0056-test 2014-11-06 17:10:58 UTC (rev
5909)
@@ -0,0 +1,28 @@
+#!/bin/sh -x
+# This file is free software; as a special exception the author gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+. ./defs || exit 1
+
+# test of --defsection, when its value is not used.
+testnum=0055
+
+outputdirfile=`mktemp ii$testnum-XXXXXXXX`
+cp ${testdir}/ii-$testnum-input-dir-file $outputdirfile || exit 1
+
+${install_info} \
+ --defsection="Antlered Animals" \
+ --entry="* Gnu: (gnu). Wildebeest native to Africa." \
+ ${testdir}/ii-$testnum-input-info-file $outputdirfile \
+|| exit $?
+
+diff ${testdir}/ii-$testnum-expected-dir-file $outputdirfile
+retval=$?
+
+rm -f $outputdirfile
+exit $retval
Property changes on: trunk/install-info/tests/ii-0056-test
___________________________________________________________________
Added: svn:executable
+ *
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [5909] new install-info option --defsection (and no-op --defentry),
karl <=