2006-03-09 Andrew Stubbs * cli/cli-script.c (execute_user_command): Set instream to -1, not 0. (read_command_lines): Check instream before calling the prompt hook. * utils.c: Include top.h. (query): Check instream before calling the query hook. Index: src/gdb/cli/cli-script.c =================================================================== --- src.orig/gdb/cli/cli-script.c 2006-02-20 18:19:58.000000000 +0000 +++ src/gdb/cli/cli-script.c 2006-03-09 15:21:40.000000000 +0000 @@ -268,10 +268,11 @@ execute_user_command (struct cmd_list_el old_chain = make_cleanup (do_restore_user_call_depth, &user_call_depth); - /* Set the instream to 0, indicating execution of a - user-defined function. */ + /* Set the instream to -1, indicating execution of a + user-defined function. Don't use 0 any more, because this is + the same as NULL, which is the instream value used by insight. */ old_chain = make_cleanup (do_restore_instream_cleanup, instream); - instream = (FILE *) 0; + instream = (FILE *) -1; while (cmdlines) { ret = execute_control_command (cmdlines); @@ -920,7 +921,7 @@ read_command_lines (char *prompt_arg, in enum misc_command_type val; control_level = 0; - if (deprecated_readline_begin_hook) + if ((instream == stdin || instream == NULL) && deprecated_readline_begin_hook) { /* Note - intentional to merge messages with no newline */ (*deprecated_readline_begin_hook) ("%s %s\n", prompt_arg, END_MESSAGE); Index: src/gdb/utils.c =================================================================== --- src.orig/gdb/utils.c 2006-02-20 18:12:38.000000000 +0000 +++ src/gdb/utils.c 2006-03-09 15:17:43.000000000 +0000 @@ -54,6 +54,7 @@ #include "filenames.h" #include "symfile.h" #include "gdb_obstack.h" +#include "top.h" #include "inferior.h" /* for signed_pointer_to_address */ @@ -1141,7 +1142,7 @@ query (const char *ctlstr, ...) int ans2; int retval; - if (deprecated_query_hook) + if ((instream == stdin || instream == NULL) && deprecated_query_hook) { va_start (args, ctlstr); return deprecated_query_hook (ctlstr, args);