Fix 'info (manual)slash/in/node'
* info/info.c (main, get_initial_file): Move code checking for
slash in argument to get_initial_file, and don't check for argument
as a file if it begins with '('.
(main): Move code adding user provided directory to INFOPATH
after call to get_initial_code.
(get_initial_file): Decrement argc as intended.
Arash Esbati <arash@gnu.org> reported that
"info '(latex2e)\indent & \noindent'" didn't work on Msys2.
diff --git a/ChangeLog b/ChangeLog
index 7ba611b..b39ddc4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2023-01-29 Gavin Smith <gavinsmith0123@gmail.com>
+
+ Fix 'info (manual)slash/in/node'
+
+ * info/info.c (main, get_initial_file): Move code checking for
+ slash in argument to get_initial_file, and don't check for argument
+ as a file if it begins with '('.
+ (main): Move code adding user provided directory to INFOPATH
+ after call to get_initial_code.
+ (get_initial_file): Decrement argc as intended.
+
+ Arash Esbati <arash@gnu.org> reported that
+ "info '(latex2e)\indent & \noindent'" didn't work on Msys2.
+
2023-03-26 Gavin Smith <gavinsmith0123@gmail.com>
7.0.3 release
diff --git a/info/info.c b/info/info.c
index e6f2d68..8ca4a17 100644
--- a/info/info.c
+++ b/info/info.c
@@ -1,6 +1,6 @@
/* info.c -- Display nodes of Info files in multiple windows.
- Copyright 1993-2022 Free Software Foundation, Inc.
+ Copyright 1993-2023 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
@@ -174,6 +174,19 @@
{
REFERENCE *entry;
+ /* If --file was not used and there is a slash in the first non-option
+ argument (e.g. "info subdir/file.info"), do not search the dir files
+ for a matching entry. */
+ if (!user_filename
+ && (*argv)[0]
+ && HAS_SLASH ((*argv)[0])
+ && (*argv)[0][0] != '(') /* don't treat "(manual)node" as a filename */
+ {
+ user_filename = xstrdup ((*argv)[0]);
+ (*argv)++; /* Advance past first remaining argument. */
+ (*argc)--;
+ }
+
/* User used "--file". */
if (user_filename)
{
@@ -226,7 +239,7 @@
info_parsed_nodename),
ref_index, ref_list, ref_slots, 2);
/* Remove this argument from the argument list. */
- memmove (*argv, *argv + 1, *argc-- * sizeof (char *));
+ memmove (*argv, *argv + 1, (*argc)-- * sizeof (char *));
return;
}
}
@@ -873,21 +886,6 @@
argc -= optind;
argv += optind;
-
- /* If --file was not used and there is a slash in the first non-option
- argument (e.g. "info subdir/file.info"), do not search the dir files
- for a matching entry. */
- if (!user_filename && argv[0] && HAS_SLASH (argv[0]))
- {
- user_filename = xstrdup (argv[0]);
- argv++; /* Advance past first remaining argument. */
- argc--;
- }
-
- /* If the user specified a particular filename, add the path of that
- file to the contents of INFOPATH. */
- if (user_filename)
- add_file_directory_to_path (user_filename);
/* Load custom key mappings and variable settings */
initialize_terminal_and_keymaps (init_file);
@@ -922,9 +920,9 @@
add_pointer_to_array (0, ref_index, ref_list, ref_slots, 2);
ref_index--;
+ /* --all */
if (all_matches_p && !index_search_p)
{
- /* --all */
if (!user_filename && argv[0])
{
user_filename = xstrdup (argv[0]);
@@ -969,6 +967,11 @@
get_initial_file (&argc, &argv, &error);
+ /* If the user specified a particular filename, add the path of that file
+ to the contents of INFOPATH, for '--variable follow-strategy=path'. */
+ if (user_filename)
+ add_file_directory_to_path (user_filename);
+
/* If the user specified `--index-search=STRING --all', create
and display the menu of results. */
if (index_search_p && all_matches_p && initial_file)