void free_command_lines ();
char *gdb_readline ();
char *command_line_input ();
+static void initialize_history ();
static void initialize_main ();
static void initialize_cmd_lists ();
static void init_signals ();
#define HAVE_SIGSETMASK !defined (USG)
#endif
-#if !HAVE_SIGSETMASK
+#if 0 == (HAVE_SIGSETMASK)
#define sigsetmask(n)
#endif
\f
}
free (cmdarg);
+ /* Read in the old history after all the command files have been read. */
+ initialize_history();
+
if (batch)
{
/* We have hit the end of the batch file. */
unsethistlist = (struct cmd_list_element *) 0;
}
+/* Init the history buffer. Note that we are called after the init file(s)
+ * have been read so that the user can change the history file via his
+ * .gdbinit file (for instance). The GDBHISTFILE environment variable
+ * overrides all of this.
+ */
+
static void
-initialize_main ()
+initialize_history()
{
- struct cmd_list_element *c;
-
char *tmpenv;
-
-#ifdef DEFAULT_PROMPT
- prompt = savestring (DEFAULT_PROMPT, strlen(DEFAULT_PROMPT));
-#else
- prompt = savestring ("(gdb) ", 6);
-#endif
- /* Set the important stuff up for command editing. */
- command_editing_p = 1;
- history_expansion_p = 0;
- write_history_p = 0;
-
if (tmpenv = getenv ("HISTSIZE"))
history_size = atoi (tmpenv);
- else
+ else if (!history_size)
history_size = 256;
stifle_history (history_size);
if (tmpenv = getenv ("GDBHISTFILE"))
history_filename = savestring (tmpenv, strlen(tmpenv));
- else
+ else if (!history_filename) {
/* We include the current directory so that if the user changes
directories the file written will be the same as the one
that was read. */
history_filename = concat (current_directory, "/.gdb_history", "");
-
+ }
read_history (history_filename);
+}
+static void
+initialize_main ()
+{
+ struct cmd_list_element *c;
+
+#ifdef DEFAULT_PROMPT
+ prompt = savestring (DEFAULT_PROMPT, strlen(DEFAULT_PROMPT));
+#else
+ prompt = savestring ("(gdb) ", 6);
+#endif
+
+ /* Set the important stuff up for command editing. */
+ command_editing_p = 1;
+ history_expansion_p = 0;
+ write_history_p = 0;
+
/* Setup important stuff for command line editing. */
rl_completion_entry_function = (int (*)()) symbol_completion_function;
rl_completer_word_break_characters = gdb_completer_word_break_characters;