[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[6204] inexact match for --node
From: |
Gavin D. Smith |
Subject: |
[6204] inexact match for --node |
Date: |
Mon, 06 Apr 2015 13:47:45 +0000 |
Revision: 6204
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6204
Author: gavin
Date: 2015-04-06 13:47:43 +0000 (Mon, 06 Apr 2015)
Log Message:
-----------
inexact match for --node
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/info.c
trunk/info/nodes.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2015-04-06 09:54:46 UTC (rev 6203)
+++ trunk/ChangeLog 2015-04-06 13:47:43 UTC (rev 6204)
@@ -1,5 +1,13 @@
2015-04-06 Gavin Smith <address@hidden>
+ * info/info.c (add_initial_nodes) <--node>: Look through node
+ names of file for argument, and if not found look for a
+ case-insensitive initial match.
+ * info/nodes.c (info_get_node_of_file_buffer): Remove doubled
+ condition.
+
+2015-04-06 Gavin Smith <address@hidden>
+
* doc/texinfo.texi (Invoking install-info): Include ellipsis
within square brackets in synopsis. Report from Benno
Schulenberg.
Modified: trunk/info/info.c
===================================================================
--- trunk/info/info.c 2015-04-06 09:54:46 UTC (rev 6203)
+++ trunk/info/info.c 2015-04-06 13:47:43 UTC (rev 6204)
@@ -287,32 +287,91 @@
if (user_nodenames_index > 0 && ref_index > 0)
{
info_reference_free (ref_list[0]);
+ ref_list[0] = 0;
ref_index = 0;
}
for (i = 0; user_nodenames[i]; i++)
{
- char *node_filename;
+ char *node_filename = 0;
+ char *node_nodename = 0;
/* Parse node spec to support invoking
like info --node "(emacs)Buffers". */
info_parse_node (user_nodenames[i]);
if (info_parsed_filename)
- node_filename = info_parsed_filename;
+ {
+ node_filename = info_parsed_filename;
+ node_nodename = info_parsed_nodename;
+ }
else
{
+ FILE_BUFFER *file_buffer;
+ TAG *tag;
+ int j;
+
if (!initial_file)
{
+ free (*error);
asprintf (error, _("No file given for node '%s'."),
user_nodenames[i]);
continue;
}
+
+ /* Check for a node by this name, and if there isn't one
+ look for an inexact match. */
+
node_filename = initial_file;
+ node_nodename = 0;
+
+ file_buffer = info_find_file (node_filename);
+
+ /* First look for an exact match. */
+ for (j = 0; (tag = file_buffer->tags[j]); j++)
+ if (strcmp (user_nodenames[i], tag->nodename) == 0)
+ {
+ node_nodename = tag->nodename;
+ break;
+ }
+
+ if (!node_nodename)
+ {
+ int best_guess = -1;
+ int len = strlen (user_nodenames[i]);
+ for (j = 0; (tag = file_buffer->tags[j]); j++)
+ {
+ if (mbscasecmp (user_nodenames[i], tag->nodename) == 0)
+ {
+ /* Exact, case-insensitive match. */
+ node_nodename = tag->nodename;
+ best_guess = -1;
+ break;
+ }
+ else if (best_guess == -1
+ && (mbsncasecmp (user_nodenames[i],
+ tag->nodename, len) == 0))
+ /* Case-insensitive initial substring. */
+ best_guess = j;
+ }
+ if (best_guess != -1)
+ {
+ node_nodename = file_buffer->tags[best_guess]->nodename;
+ }
+ }
+
+ if (!node_nodename)
+ {
+ free (*error);
+ asprintf (error, _("Cannot find node '%s'."),
+ user_nodenames[i]);
+ continue;
+ }
}
- add_pointer_to_array
- (info_new_reference (node_filename, info_parsed_nodename),
- ref_index, ref_list, ref_slots, 2);
+ if (node_filename && node_nodename)
+ add_pointer_to_array
+ (info_new_reference (node_filename, node_nodename),
+ ref_index, ref_list, ref_slots, 2);
}
}
Modified: trunk/info/nodes.c
===================================================================
--- trunk/info/nodes.c 2015-04-06 09:54:46 UTC (rev 6203)
+++ trunk/info/nodes.c 2015-04-06 13:47:43 UTC (rev 6204)
@@ -1069,11 +1069,8 @@
node->nodelen = file_buffer->filesize;
node->body_start = 0;
}
- /* If this is the "main" info file, it might contain a tags table. Search
- the tags table for an entry which matches the node that we want. If
- there is a tags table, get the file which contains this node, but don't
- bother building a node list for it. */
- else if (file_buffer->tags)
+ /* Search the tags table for an entry which matches the node that we want. */
+ else
{
TAG *tag;
int i;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [6204] inexact match for --node,
Gavin D. Smith <=