[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[7032] info_get_menu_entry_by_label case-insensitive
From: |
Gavin D. Smith |
Subject: |
[7032] info_get_menu_entry_by_label case-insensitive |
Date: |
Sat, 27 Feb 2016 10:28:05 +0000 |
Revision: 7032
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7032
Author: gavin
Date: 2016-02-27 10:26:28 +0000 (Sat, 27 Feb 2016)
Log Message:
-----------
info_get_menu_entry_by_label case-insensitive
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/info-utils.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2016-02-25 18:53:54 UTC (rev 7031)
+++ trunk/ChangeLog 2016-02-27 10:26:28 UTC (rev 7032)
@@ -1,3 +1,10 @@
+2016-02-27 Gavin Smith <address@hidden>
+
+ * info/info-utils.c (info_get_menu_entry_by_label): Always check
+ case-insensitively, so that manpages are not preferred to a
+ case-insensitive dir match when invoking. Problem reported by
+ Vincent Lefevre.
+
2016-02-24 Vincent Bela\xEFche <address@hidden>
* util/texi2dvi (filter_files): Ensure that this function does not
Modified: trunk/info/info-utils.c
===================================================================
--- trunk/info/info-utils.c 2016-02-25 18:53:54 UTC (rev 7031)
+++ trunk/info/info-utils.c 2016-02-27 10:26:28 UTC (rev 7032)
@@ -215,46 +215,33 @@
/* Get the entry associated with LABEL in the menu of NODE. Return a
pointer to the ENTRY if found, or null. Return value should not
- be freed by caller. */
+ be freed by caller. If SLOPPY, allow initial matches, like
+ "Buffers" for a LABEL "buffer". */
REFERENCE *
info_get_menu_entry_by_label (NODE *node, char *label, int sloppy)
{
register int i;
+ int best_guess = -1;
REFERENCE *entry;
REFERENCE **references = node->references;
if (!references)
return 0;
- /* First look for an exact match. */
for (i = 0; (entry = references[i]); i++)
{
- if (REFERENCE_MENU_ITEM != entry->type) continue;
- if (strcmp (label, entry->label) == 0)
- return entry;
+ if (entry->type != REFERENCE_MENU_ITEM)
+ continue;
+ if (mbscasecmp (label, entry->label) == 0)
+ return entry; /* Exact, case-insensitive match. */
+ else if (sloppy && best_guess == -1
+ && (mbsncasecmp (entry->label, label, strlen (label)) == 0))
+ best_guess = i;
}
- /* If the item wasn't found, search the list sloppily. Perhaps this
- user typed "buffer" when they really meant "Buffers". */
- if (sloppy)
- {
- int i;
- int best_guess = -1;
+ if (sloppy && best_guess != -1)
+ return references[best_guess];
- for (i = 0; (entry = references[i]); i++)
- {
- if (REFERENCE_MENU_ITEM != entry->type) continue;
- if (mbscasecmp (label, entry->label) == 0)
- return entry; /* Exact, case-insensitive match. */
- else if (best_guess == -1
- && (mbsncasecmp (entry->label, label, strlen (label)) == 0))
- best_guess = i;
- }
-
- if (!entry && best_guess != -1)
- return references[best_guess];
- }
-
return 0;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [7032] info_get_menu_entry_by_label case-insensitive,
Gavin D. Smith <=