[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[5920] save last non-option argument for name of invocation program
From: |
Gavin D. Smith |
Subject: |
[5920] save last non-option argument for name of invocation program |
Date: |
Sun, 09 Nov 2014 12:28:42 +0000 |
Revision: 5920
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5920
Author: gavin
Date: 2014-11-09 12:28:41 +0000 (Sun, 09 Nov 2014)
Log Message:
-----------
save last non-option argument for name of invocation program
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/info.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2014-11-09 10:30:29 UTC (rev 5919)
+++ trunk/ChangeLog 2014-11-09 12:28:41 UTC (rev 5920)
@@ -5,6 +5,9 @@
(info_intuit_options_node): If passed Top node, call it to get a
new node to start at. Return value to be freed by caller. All
callers updated.
+ * info/info.c (main, add_initial_nodes)
+ (invocation_program_name): For --show-options, save last
+ non-option argument to use as the name of the program.
2014-11-08 Gavin Smith <address@hidden>
Modified: trunk/info/info.c
===================================================================
--- trunk/info/info.c 2014-11-09 10:30:29 UTC (rev 5919)
+++ trunk/info/info.c 2014-11-09 12:28:41 UTC (rev 5920)
@@ -47,6 +47,8 @@
session at that node. */
static int goto_invocation_p = 0;
+static char *invocation_program_name = 0;
+
/* Variable containing the string to search for when index_search_p is
non-zero. */
static char *index_search_string = NULL;
@@ -316,7 +318,6 @@
NODE *top_node;
REFERENCE *invoc_ref = 0;
- char **p = argv;
char *program;
if (ref_index == 0)
@@ -325,16 +326,8 @@
exit (1);
}
- /* If they said "info --show-options foo bar baz",
- the last of the arguments is the program whose
- options they want to see. */
- p = argv;
- if (*p)
- {
- while (p[1])
- p++;
- program = xstrdup (*p);
- }
+ if (invocation_program_name)
+ program = xstrdup (invocation_program_name);
else if (ref_list[0] && ref_list[0]->filename)
/* If there's no command-line arguments to
supply the program name, use the Info file
@@ -806,6 +799,20 @@
}
else
{
+ if (goto_invocation_p)
+ {
+ /* If they said "info --show-options foo bar baz",
+ the last of the arguments is the program whose
+ options they want to see. */
+ char **p = argv;
+ if (*p)
+ {
+ while (p[1])
+ p++;
+ invocation_program_name = *p;
+ }
+ }
+
/* User used "--file". */
if (user_filename)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [5920] save last non-option argument for name of invocation program,
Gavin D. Smith <=