texinfo-commits
[Top][All Lists]
Advanced

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

[5531] slash in command-line argument


From: Gavin D. Smith
Subject: [5531] slash in command-line argument
Date: Wed, 07 May 2014 23:41:49 +0000

Revision: 5531
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5531
Author:   gavin
Date:     2014-05-07 23:41:49 +0000 (Wed, 07 May 2014)
Log Message:
-----------
slash in command-line argument

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/Makefile.am
    trunk/info/info.c
    trunk/info/session.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2014-05-07 22:46:07 UTC (rev 5530)
+++ trunk/ChangeLog     2014-05-07 23:41:49 UTC (rev 5531)
@@ -1,3 +1,11 @@
+2014-05-08  Gavin Smith  <address@hidden>
+
+       * info/info.c (main): If slash in first non-option argument,
+       interpret as if it had been passed with --file.
+       * info/session.c (info_select_reference): Null check for label
+       field of REFERENCE.
+       * info/t/relative-path.sh: New test.
+
 2014-05-07  Gavin Smith  <address@hidden>
 
        * info/filesys.c (filesys_error_string): Correct comment about

Modified: trunk/info/Makefile.am
===================================================================
--- trunk/info/Makefile.am      2014-05-07 22:46:07 UTC (rev 5530)
+++ trunk/info/Makefile.am      2014-05-07 23:41:49 UTC (rev 5531)
@@ -95,6 +95,7 @@
        t/file-nodes.sh \
        t/no-file.sh \
        t/split.sh \
+       t/relative-path.sh \
        t/dir.sh \
        t/dir-file.sh \
        t/dir-nondir.sh \

Modified: trunk/info/info.c
===================================================================
--- trunk/info/info.c   2014-05-07 22:46:07 UTC (rev 5530)
+++ trunk/info/info.c   2014-05-07 23:41:49 UTC (rev 5531)
@@ -777,14 +777,24 @@
       exit (EXIT_SUCCESS);
     }
 
+  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] && strchr (argv[0], '/'))
+    {
+      user_filename = 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);
 
-  argc -= optind;
-  argv += optind;
-  
   /* Load custom key mappings and variable settings */
   initialize_terminal_and_keymaps (init_file);
 

Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c        2014-05-07 22:46:07 UTC (rev 5530)
+++ trunk/info/session.c        2014-05-07 23:41:49 UTC (rev 5531)
@@ -1764,7 +1764,8 @@
       if (info_recent_file_error)
         file_system_error = xstrdup (info_recent_file_error);
 
-      if (entry->nodename && (strcmp (entry->nodename, entry->label) == 0))
+      if (entry->nodename
+          && entry->label && (strcmp (entry->nodename, entry->label) == 0))
         {
           node = info_get_node (entry->label, "Top", PARSE_NODE_DFLT);
           if (!node && info_recent_file_error)




reply via email to

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