* utils.c (query): Change syntax of query annotations to be

consistent with other input annotations.
This commit is contained in:
Jim Kingdon 1994-04-28 15:48:15 +00:00
parent 9b58556978
commit d8742f4673
2 changed files with 42 additions and 5 deletions

View File

@ -1,3 +1,8 @@
Thu Apr 28 08:40:56 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
* utils.c (query): Change syntax of query annotations to be
consistent with other input annotations.
Thu Apr 28 01:20:39 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) Thu Apr 28 01:20:39 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
* mdebugread.c (psymtab_to_symtab_1): Do not call sort_blocks * mdebugread.c (psymtab_to_symtab_1): Do not call sort_blocks

View File

@ -37,6 +37,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "expression.h" #include "expression.h"
#include "language.h" #include "language.h"
#include "readline.h"
/* readline defines this. */
#undef savestring
/* Prototypes for local functions */ /* Prototypes for local functions */
#if defined (NO_MMALLOC) || defined (NO_MMALLOC_CHECK) #if defined (NO_MMALLOC) || defined (NO_MMALLOC_CHECK)
@ -793,6 +798,7 @@ query (va_alist)
char *ctlstr; char *ctlstr;
register int answer; register int answer;
register int ans2; register int ans2;
int retval;
/* Automatically answer "yes" if input is not from a terminal. */ /* Automatically answer "yes" if input is not from a terminal. */
if (!input_from_terminal_p ()) if (!input_from_terminal_p ())
@ -802,16 +808,27 @@ query (va_alist)
{ {
wrap_here (""); /* Flush any buffered output */ wrap_here (""); /* Flush any buffered output */
gdb_flush (gdb_stdout); gdb_flush (gdb_stdout);
if (annotation_level > 1)
printf_filtered ("\n\032\032pre-query\n");
va_start (args); va_start (args);
ctlstr = va_arg (args, char *); ctlstr = va_arg (args, char *);
vfprintf_filtered (gdb_stdout, ctlstr, args); vfprintf_filtered (gdb_stdout, ctlstr, args);
va_end (args); va_end (args);
printf_filtered ("(y or n) "); printf_filtered ("(y or n) ");
if (annotation_level > 1)
printf_filtered ("\n\032\032query\n");
gdb_flush (gdb_stdout); gdb_flush (gdb_stdout);
answer = fgetc (stdin); answer = fgetc (stdin);
clearerr (stdin); /* in case of C-d */ clearerr (stdin); /* in case of C-d */
if (answer == EOF) /* C-d */ if (answer == EOF) /* C-d */
return 1; {
retval = 1;
break;
}
if (answer != '\n') /* Eat rest of input line, to EOF or newline */ if (answer != '\n') /* Eat rest of input line, to EOF or newline */
do do
{ {
@ -822,11 +839,21 @@ query (va_alist)
if (answer >= 'a') if (answer >= 'a')
answer -= 040; answer -= 040;
if (answer == 'Y') if (answer == 'Y')
return 1; {
retval = 1;
break;
}
if (answer == 'N') if (answer == 'N')
return 0; {
retval = 0;
break;
}
printf_filtered ("Please answer y or n.\n"); printf_filtered ("Please answer y or n.\n");
} }
if (annotation_level > 1)
printf_filtered ("\n\032\032post-query\n");
return retval;
} }
@ -1018,6 +1045,12 @@ static void
prompt_for_continue () prompt_for_continue ()
{ {
char *ignore; char *ignore;
char cont_prompt[120];
strcpy (cont_prompt,
"---Type <return> to continue, or q <return> to quit---");
if (annotation_level > 1)
strcat (cont_prompt, "\n\032\032prompt-for-continue\n");
/* We must do this *before* we call gdb_readline, else it will eventually /* We must do this *before* we call gdb_readline, else it will eventually
call us -- thinking that we're trying to print beyond the end of the call us -- thinking that we're trying to print beyond the end of the
@ -1035,8 +1068,7 @@ prompt_for_continue ()
/* Call readline, not gdb_readline, because GO32 readline handles control-C /* Call readline, not gdb_readline, because GO32 readline handles control-C
whereas control-C to gdb_readline will cause the user to get dumped whereas control-C to gdb_readline will cause the user to get dumped
out to DOS. */ out to DOS. */
ignore = ignore = readline (cont_prompt);
readline ("---Type <return> to continue, or q <return> to quit---");
if (ignore) if (ignore)
{ {
char *p = ignore; char *p = ignore;