[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[5504] error message on startup
From: |
Gavin D. Smith |
Subject: |
[5504] error message on startup |
Date: |
Thu, 01 May 2014 21:51:19 +0000 |
Revision: 5504
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5504
Author: gavin
Date: 2014-05-01 21:51:19 +0000 (Thu, 01 May 2014)
Log Message:
-----------
error message on startup
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/filesys.c
trunk/info/info.c
trunk/info/info.h
trunk/info/session.c
trunk/info/session.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2014-05-01 20:54:41 UTC (rev 5503)
+++ trunk/ChangeLog 2014-05-01 21:51:19 UTC (rev 5504)
@@ -1,5 +1,14 @@
2014-05-01 Gavin Smith <address@hidden>
+ * info/info.c (get_initial_file, add_initial_nodes)
+ (show_error_node)
+ * info/session.c (begin_multiple_window_info_session)
+ (info_follow_menus): Use char * to store error message, and only
+ build NODE if necessary.
+
+ (info_find_matching_files): Declared static.
+2014-05-01 Gavin Smith <address@hidden>
+
* info/session.c (begin_multiple_window_info_session): Call
initialize_info_session and display startup message or error. Caller
updated.
Modified: trunk/info/filesys.c
===================================================================
--- trunk/info/filesys.c 2014-05-01 20:54:41 UTC (rev 5503)
+++ trunk/info/filesys.c 2014-05-01 21:51:19 UTC (rev 5504)
@@ -564,6 +564,8 @@
static char *errmsg_buf = NULL;
static int errmsg_buf_size = 0;
+/* Return string for ERROR_NUM when opening file. Return value to be freed
+ by caller. */
char *
filesys_error_string (char *filename, int error_num)
{
Modified: trunk/info/info.c
===================================================================
--- trunk/info/info.c 2014-05-01 20:54:41 UTC (rev 5503)
+++ trunk/info/info.c 2014-05-01 21:51:19 UTC (rev 5504)
@@ -170,7 +170,7 @@
/* Get the initial Info file, either by following menus from "(dir)Top",
or what the user specifed with values in filename. */
static char *
-get_initial_file (char *filename, int *argc, char ***argv, NODE **error_node)
+get_initial_file (char *filename, int *argc, char ***argv, char **error)
{
char *initial_file = 0; /* First file loaded by Info. */
@@ -201,9 +201,8 @@
(*argc)--;
}
else
- *error_node = format_message_node (_("No menu item `%s' in node
`%s'."),
- (*argv)[0],
- "(dir)Top");
+ asprintf (error, _("No menu item `%s' in node `%s'."),
+ (*argv)[0], "(dir)Top");
}
/* Otherwise, we want the dir node. The only node to be displayed
or output will be "Top". */
@@ -217,14 +216,7 @@
initial_file = info_find_fullpath (filename, 0);
if (!initial_file && filesys_error_number)
- {
- char *error_string;
-
- error_string = filesys_error_string
- (filename, filesys_error_number);
- *error_node = format_message_node ("%s", error_string);
- free (error_string);
- }
+ *error = filesys_error_string (filename, filesys_error_number);
}
/* Fall back to loading man page. */
@@ -254,7 +246,8 @@
/* Expand list of nodes to be loaded. */
static void
-add_initial_nodes (FILE_BUFFER *initial_file, int argc, char **argv, NODE
**error_node)
+add_initial_nodes (FILE_BUFFER *initial_file, int argc, char **argv,
+ char **error)
{
NODE *initial_node;
char *node_via_menus;
@@ -306,7 +299,7 @@
NODE *initial_node;
initial_node = info_get_node_of_file_buffer (initial_file, "Top");
- node_via_menus = info_follow_menus (initial_node, argv, error_node, 1);
+ node_via_menus = info_follow_menus (initial_node, argv, error, 1);
if (node_via_menus)
add_pointer_to_array (node_via_menus, user_nodenames_index,
user_nodenames, user_nodenames_slots, 10);
@@ -328,7 +321,8 @@
{
if (!strcmp (argv[0], (*index_ptr)->label))
{
- /* TODO: Clear error_node */
+ free (*error); *error = 0;
+
add_pointer_to_array ((*index_ptr)->nodename,
user_nodenames_index, user_nodenames,
user_nodenames_slots, 10);
@@ -344,7 +338,7 @@
NODE *initial_node;
initial_node = info_get_node_of_file_buffer (initial_file, "Top");
- node_via_menus = info_follow_menus (initial_node, argv, error_node, 0);
+ node_via_menus = info_follow_menus (initial_node, argv, error, 0);
if (node_via_menus)
add_pointer_to_array (node_via_menus, user_nodenames_index,
user_nodenames, user_nodenames_slots, 10);
@@ -374,7 +368,7 @@
return p;
}
-REFERENCE **
+static REFERENCE **
info_find_matching_files (char *filename)
{
size_t argc = 0;
@@ -405,7 +399,7 @@
return argv;
}
-
+
static int
all_files (char *filename, int argc, char **argv)
{
@@ -550,7 +544,7 @@
char *init_file = 0; /* Name of init file specified. */
char *initial_file = 0; /* File to start session with. */
FILE_BUFFER *initial_fb = 0; /* File to start session with. */
- NODE *error_node = 0; /* Error message to display in mini-buffer. */
+ char *error = 0; /* Error message to display in mini-buffer. */
#ifdef HAVE_SETLOCALE
/* Set locale via LC_ALL. */
@@ -775,7 +769,7 @@
if (all_matches_p)
return all_files (user_filename, argc, argv);
- initial_file = get_initial_file (user_filename, &argc, &argv, &error_node);
+ initial_file = get_initial_file (user_filename, &argc, &argv, &error);
/* --where */
if (print_where_p)
@@ -820,14 +814,14 @@
else if (initial_file && strcmp (MANPAGE_FILE_BUFFER_NAME, initial_file))
{
initial_fb = info_load_file (initial_file, 1);
- add_initial_nodes (initial_fb, argc, argv, &error_node);
+ add_initial_nodes (initial_fb, argc, argv, &error);
}
/* --output */
if (user_output_filename)
{
- if (error_node)
- show_error_node (error_node);
+ if (error)
+ info_error (error);
if (!initial_fb) return 0;
/* FIXME: Was two separate functions, dump_node_to_file as well.
Check behaviour is the same. */
@@ -836,15 +830,15 @@
return 0;
}
- if (user_filename && error_node)
+ if (user_filename && error)
{
- show_error_node (error_node);
+ info_error (error);
return 1;
}
/* Initialize the Info session. */
begin_multiple_window_info_session (initial_file, user_nodenames,
- error_node);
+ error);
info_session ();
return 0;
}
@@ -977,24 +971,25 @@
}
void
-show_error_node (NODE *node)
+show_error_node (char *error)
{
if (info_error_rings_bell_p)
terminal_ring_bell ();
if (!info_windows_initialized_p)
{
- if (node->contents[node->nodelen - 1] == '\n')
- node->contents[node->nodelen - 1] = 0;
- info_error ("%s", node->contents);
+ info_error ("%s", error);
}
else if (!echo_area_is_active)
{
+ NODE *error_node;
+
+ error_node = format_message_node ("%s", error);
free_echo_area ();
- window_set_node_of_window (the_echo_area, node);
+ window_set_node_of_window (the_echo_area, error_node);
display_update_one_window (the_echo_area);
}
else
- inform_in_echo_area (node->contents);
+ inform_in_echo_area (error);
}
Modified: trunk/info/info.h
===================================================================
--- trunk/info/info.h 2014-05-01 20:54:41 UTC (rev 5503)
+++ trunk/info/info.h 2014-05-01 21:51:19 UTC (rev 5504)
@@ -176,6 +176,6 @@
/* Found in m-x.c. */
extern char *read_function_name (const char *prompt, WINDOW *window);
-extern void show_error_node (NODE *node);
+extern void show_error_node (char *error_msg);
#endif /* !INFO_H */
Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c 2014-05-01 20:54:41 UTC (rev 5503)
+++ trunk/info/session.c 2014-05-01 21:51:19 UTC (rev 5504)
@@ -88,10 +88,10 @@
/* Begin an info session finding the nodes specified by FILENAME and NODENAMES.
For each loaded node, create a new window. Always split the largest of the
- available windows. Display error in ERROR_NODE if there is one. */
+ available windows. Display ERROR in echo area if non-null. */
void
begin_multiple_window_info_session (char *filename, char **nodenames,
- NODE *error_node)
+ char *error)
{
register int i;
WINDOW *window = 0;
@@ -99,10 +99,10 @@
initialize_info_session ();
- if (!error_node)
+ if (!error)
display_startup_message ();
else
- show_error_node (error_node);
+ show_error_node (error);
/* Load dir node as a back-up. */
if (!filename || !nodenames || !nodenames[0])
@@ -2797,18 +2797,18 @@
/* Follow the menu list in MENUS (list of strings terminated by a NULL
entry) from INITIAL_NODE. If there is an error, place a message
- in ERR_NODE. STRICT says whether to accept incomplete strings as
+ in ERROR. STRICT says whether to accept incomplete strings as
menu entries, and whether to return the node so far if we can't
continue at any point (that might be INITIAL_NODE itself), or to
return null. */
char *
-info_follow_menus (NODE *initial_node, char **menus, NODE **err_node,
+info_follow_menus (NODE *initial_node, char **menus, char **error,
int strict)
{
NODE *node = NULL;
- if (err_node)
- *err_node = NULL;
+ if (error)
+ *error = NULL;
for (; *menus; menus++)
{
@@ -2821,9 +2821,9 @@
if (!initial_node->references)
{
- if (err_node)
- *err_node = format_message_node (_("No menu in node `%s'."),
- node_printed_rep (initial_node));
+ if (error)
+ asprintf (error, _("No menu in node `%s'."),
+ node_printed_rep (initial_node));
debug (3, ("no menu found"));
free (initial_node);
return strict ? 0 : initial_node->nodename;
@@ -2856,10 +2856,10 @@
/* If we still failed to find the reference: */
if (!entry)
{
- if (err_node)
- *err_node = format_message_node (_("No menu item `%s' in node
`%s'."),
- arg,
- node_printed_rep (initial_node));
+ if (error)
+ asprintf (error, _("No menu item `%s' in node `%s'."),
+ arg,
+ node_printed_rep (initial_node));
debug (3, ("no entry found"));
free (initial_node);
return strict ? 0 : initial_node->nodename;
@@ -2873,11 +2873,11 @@
if (!node)
{
debug (3, ("no matching node found"));
- if (err_node)
- *err_node = format_message_node (
- _("Unable to find node referenced by `%s' in `%s'."),
- entry->label,
- node_printed_rep (initial_node));
+ if (error)
+ asprintf (error,
+ _("Unable to find node referenced by `%s' in `%s'."),
+ entry->label,
+ node_printed_rep (initial_node));
free (initial_node);
return strict ? 0 : initial_node->nodename;
}
@@ -2941,7 +2941,7 @@
if (*line)
{
- NODE *err_node;
+ char *error = 0;
NODE *dir_node = info_get_node (NULL, NULL, PARSE_NODE_DFLT);
char **nodes = split_list_of_nodenames (line);
char *node = NULL;
@@ -2962,11 +2962,11 @@
if (!dir_node)
info_error (msg_cant_find_node, "Top");
else
- node = info_follow_menus (dir_node, nodes, &err_node, 0);
+ node = info_follow_menus (dir_node, nodes, &error, 0);
free (nodes);
- if (err_node)
- show_error_node (err_node);
+ if (error)
+ show_error_node (error);
else
{
NODE *n;
Modified: trunk/info/session.h
===================================================================
--- trunk/info/session.h 2014-05-01 20:54:41 UTC (rev 5503)
+++ trunk/info/session.h 2014-05-01 21:51:19 UTC (rev 5504)
@@ -124,7 +124,7 @@
/* Starting an info session. */
extern void begin_multiple_window_info_session (char *filename,
- char **nodenames, NODE *error_node);
+ char **nodenames, char *error_msg);
extern void info_session (void);
extern void initialize_terminal_and_keymaps (char *init_file);
extern void initialize_info_session (void);
@@ -203,7 +203,7 @@
extern void info_view_file (WINDOW *window, int count, unsigned char key);
extern void info_menu_sequence (WINDOW *window, int count, unsigned char key);
extern char *info_follow_menus (NODE *initial_node, char **menus,
- NODE **err_node, int strict);
+ char **error_msg, int strict);
extern void info_man (WINDOW *window, int count, unsigned char key);
extern void list_visited_nodes (WINDOW *window, int count, unsigned char key);
extern void select_visited_node (WINDOW *window, int count, unsigned char key);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [5504] error message on startup,
Gavin D. Smith <=