texinfo-commits
[Top][All Lists]
Advanced

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

[5873] simplication of info invocation


From: Gavin D. Smith
Subject: [5873] simplication of info invocation
Date: Tue, 14 Oct 2014 16:12:33 +0000

Revision: 5873
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5873
Author:   gavin
Date:     2014-10-14 16:12:31 +0000 (Tue, 14 Oct 2014)
Log Message:
-----------
simplication of info invocation

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/info.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2014-10-13 19:09:50 UTC (rev 5872)
+++ trunk/ChangeLog     2014-10-14 16:12:31 UTC (rev 5873)
@@ -1,3 +1,12 @@
+2014-10-14  Gavin Smith  <address@hidden>
+
+       * info.c (get_initial_file) <file name lookup>,
+       (main) <--file>, <'(file)node' as first argument>: Add a node to 
+       ref_list from the file we found.
+       (add_initial_nodes): Don't fall back to a "Top" node as it 
+       should already be in ref_list.  If any "--node" argument given, 
+       discard the first element of ref_list.
+
 2014-10-13  Gavin Smith  <address@hidden>
 
        * info/info.c (main) <--all not used>: Check if the first 

Modified: trunk/info/info.c
===================================================================
--- trunk/info/info.c   2014-10-13 19:09:50 UTC (rev 5872)
+++ trunk/info/info.c   2014-10-14 16:12:31 UTC (rev 5873)
@@ -214,6 +214,10 @@
       initial_file = info_find_fullpath ((*argv)[0], 0);
       if (initial_file)
         {
+          add_pointer_to_array
+            (info_new_reference (xstrdup ((*argv)[0]),
+                                 xstrdup ("Top")),
+             ref_index, ref_list, ref_slots, 2);
           (*argv)++; /* Advance past first remaining argument. */
           (*argc)--;
           return;
@@ -279,9 +283,10 @@
     {
       int i;
 
-      if (ref_index > 0)
+      /* If any --node arguments were given, the node in ref_list[0] is only 
+         used to set initial_file. */
+      if (user_nodenames_index > 0 && ref_index > 0)
         {
-          /* Discard a dir entry that was found. */
           info_reference_free (ref_list[0]);
           ref_index = 0;
         }
@@ -433,13 +438,6 @@
         }
     }
 
-  /* Default is "Top" if there were no other nodes. */
-  if (ref_index == 0 && initial_file)
-    {
-      add_pointer_to_array (info_new_reference (initial_file->fullpath, "Top"),
-        ref_index, ref_list, ref_slots, 2);
-    }
-
   return;
 }
 
@@ -826,6 +824,11 @@
           initial_file = info_find_fullpath (user_filename, 0);
           if (!initial_file && filesys_error_number)
             error = filesys_error_string (user_filename, filesys_error_number);
+          else
+            add_pointer_to_array
+              (info_new_reference (xstrdup (initial_file),
+                                   xstrdup ("Top")),
+               ref_index, ref_list, ref_slots, 2);
           goto skip_get_initial_file;
         }
 
@@ -839,9 +842,12 @@
           info_parse_node (argv[0]);
           if (info_parsed_filename)
             {
-              add_pointer_to_array (argv[0],
-                                    user_nodenames_index, user_nodenames,
-                                    user_nodenames_slots, 10);
+              add_pointer_to_array
+                (info_new_reference (xstrdup (info_parsed_filename),
+                                     info_parsed_nodename
+                                       ? xstrdup (info_parsed_nodename)
+                                       : 0),
+                 ref_index, ref_list, ref_slots, 2);
               memmove (argv, argv + 1, argc-- * sizeof (char *));
               goto skip_get_initial_file;
             }




reply via email to

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