texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: Fix 'info (manual)slash/in/node'


From: Gavin D. Smith
Subject: branch master updated: Fix 'info (manual)slash/in/node'
Date: Sun, 29 Jan 2023 07:15:35 -0500

This is an automated email from the git hooks/post-receive script.

gavin pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new c12865a0b2 Fix 'info (manual)slash/in/node'
c12865a0b2 is described below

commit c12865a0b24f7be3cda60872a49f4049d19c8f5f
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sun Jan 29 12:15:20 2023 +0000

    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.
---
 ChangeLog   | 14 ++++++++++++++
 info/info.c | 39 +++++++++++++++++++++------------------
 2 files changed, 35 insertions(+), 18 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e532093d3e..81c5b32802 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-01-27  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/ParserNonXS.pm (_next_text),
diff --git a/info/info.c b/info/info.c
index 26713f3e03..0fcc8ec64d 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 @@ get_initial_file (int *argc, char ***argv, char **error)
 {
   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 @@ get_initial_file (int *argc, char ***argv, char **error)
                                                         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 @@ There is NO WARRANTY, to the extent permitted by law.\n"),
 
   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 @@ There is NO WARRANTY, to the extent permitted by law.\n"),
   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 @@ There is NO WARRANTY, to the extent permitted by law.\n"),
 
       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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]