aboutsummaryrefslogtreecommitdiff
path: root/gdb/command.c
diff options
context:
space:
mode:
authorThomas Lord <lord@cygnus>1993-11-01 22:25:23 +0000
committerThomas Lord <lord@cygnus>1993-11-01 22:25:23 +0000
commit199b2450f62ad6ffbe56ec34fc447716b811579d (patch)
tree07400f3981865f129b912a51b85e69b7b8d1ee22 /gdb/command.c
parentb3c0fc577b17083c8bdc3ed5cffc4ca50aefaa5e (diff)
downloadgdb-199b2450f62ad6ffbe56ec34fc447716b811579d.zip
gdb-199b2450f62ad6ffbe56ec34fc447716b811579d.tar.gz
gdb-199b2450f62ad6ffbe56ec34fc447716b811579d.tar.bz2
Change the stream argument to _filtered to GDB_FILE *.
Change all references to stdout/stderr to gdb_stdout/gdb_stderr. Replace all calls to stdio output functions with calls to corresponding _unfiltered functions (`fprintf_unfiltered') Replaced calls to fopen for output to gdb_fopen. Added sufficient goo to utils.c and defs.h to make the above work. The net effect is that stdio output functions are only directly used in utils.c. Elsewhere, the _unfiltered and _filtered functions and GDB_FILE type are used. In the near future, GDB_FILE will stop being equivalant to FILE. The semantics of some commands has changed in a very subtle way: called in the right context, they may cause new occurences of prompt_for_continue() behavior. The testsuite doesn't notice anything like this, though. Please respect this change by not reintroducing stdio output dependencies in the main body of gdb code. All output from commands should go to a GDB_FILE. Target-specific code can still use stdio directly to communicate with targets.
Diffstat (limited to 'gdb/command.c')
-rw-r--r--gdb/command.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/gdb/command.c b/gdb/command.c
index abc2d84..de8bd2a 100644
--- a/gdb/command.c
+++ b/gdb/command.c
@@ -31,7 +31,7 @@ static void
show_user PARAMS ((char *, int));
static void
-show_user_1 PARAMS ((struct cmd_list_element *, FILE *));
+show_user_1 PARAMS ((struct cmd_list_element *, GDB_FILE *));
static void
make_command PARAMS ((char *, int));
@@ -43,7 +43,7 @@ static int
parse_binary_operation PARAMS ((char *));
static void
-print_doc_line PARAMS ((FILE *, char *));
+print_doc_line PARAMS ((GDB_FILE *, char *));
/* Add element named NAME.
CLASS is the top level category into which commands are broken down
@@ -247,7 +247,7 @@ add_show_from_set (setcmd, list)
&& setcmd->doc[2] == 't' && setcmd->doc[3] == ' ')
showcmd->doc = concat ("Show ", setcmd->doc + 4, NULL);
else
- fprintf (stderr, "GDB internal error: Bad docstring for set command\n");
+ fprintf_unfiltered (gdb_stderr, "GDB internal error: Bad docstring for set command\n");
showcmd->next = *list;
*list = showcmd;
@@ -303,7 +303,7 @@ delete_cmd (name, list)
void
help_cmd (command, stream)
char *command;
- FILE *stream;
+ GDB_FILE *stream;
{
struct cmd_list_element *c;
extern struct cmd_list_element *cmdlist;
@@ -368,7 +368,7 @@ help_list (list, cmdtype, class, stream)
struct cmd_list_element *list;
char *cmdtype;
enum command_class class;
- FILE *stream;
+ GDB_FILE *stream;
{
int len;
char *cmdtype1, *cmdtype2;
@@ -409,7 +409,7 @@ Command name abbreviations are allowed if unambiguous.\n",
/* Print only the first line of STR on STREAM. */
static void
print_doc_line (stream, str)
- FILE *stream;
+ GDB_FILE *stream;
char *str;
{
static char *line_buffer = 0;
@@ -460,7 +460,7 @@ help_cmd_list (list, class, prefix, recurse, stream)
enum command_class class;
char *prefix;
int recurse;
- FILE *stream;
+ GDB_FILE *stream;
{
register struct cmd_list_element *c;
@@ -1111,52 +1111,52 @@ do_setshow_command (arg, from_tty, c)
else if (c->type == show_cmd)
{
/* Print doc minus "show" at start. */
- print_doc_line (stdout, c->doc + 5);
+ print_doc_line (gdb_stdout, c->doc + 5);
- fputs_filtered (" is ", stdout);
+ fputs_filtered (" is ", gdb_stdout);
wrap_here (" ");
switch (c->var_type)
{
case var_string:
{
unsigned char *p;
- fputs_filtered ("\"", stdout);
+ fputs_filtered ("\"", gdb_stdout);
for (p = *(unsigned char **) c->var; *p != '\0'; p++)
- gdb_printchar (*p, stdout, '"');
- fputs_filtered ("\"", stdout);
+ gdb_printchar (*p, gdb_stdout, '"');
+ fputs_filtered ("\"", gdb_stdout);
}
break;
case var_string_noescape:
case var_filename:
- fputs_filtered ("\"", stdout);
- fputs_filtered (*(char **) c->var, stdout);
- fputs_filtered ("\"", stdout);
+ fputs_filtered ("\"", gdb_stdout);
+ fputs_filtered (*(char **) c->var, gdb_stdout);
+ fputs_filtered ("\"", gdb_stdout);
break;
case var_boolean:
- fputs_filtered (*(int *) c->var ? "on" : "off", stdout);
+ fputs_filtered (*(int *) c->var ? "on" : "off", gdb_stdout);
break;
case var_uinteger:
if (*(unsigned int *) c->var == UINT_MAX) {
- fputs_filtered ("unlimited", stdout);
+ fputs_filtered ("unlimited", gdb_stdout);
break;
}
/* else fall through */
case var_zinteger:
- fprintf_filtered (stdout, "%u", *(unsigned int *) c->var);
+ fprintf_filtered (gdb_stdout, "%u", *(unsigned int *) c->var);
break;
case var_integer:
if (*(int *) c->var == INT_MAX)
{
- fputs_filtered ("unlimited", stdout);
+ fputs_filtered ("unlimited", gdb_stdout);
}
else
- fprintf_filtered (stdout, "%d", *(int *) c->var);
+ fprintf_filtered (gdb_stdout, "%d", *(int *) c->var);
break;
default:
error ("gdb internal error: bad var_type in do_setshow_command");
}
- fputs_filtered (".\n", stdout);
+ fputs_filtered (".\n", gdb_stdout);
}
else
error ("gdb internal error: bad cmd_type in do_setshow_command");
@@ -1178,9 +1178,9 @@ cmd_show_list (list, from_tty, prefix)
cmd_show_list (*list->prefixlist, from_tty, list->prefixname + 5);
if (list->type == show_cmd)
{
- fputs_filtered (prefix, stdout);
- fputs_filtered (list->name, stdout);
- fputs_filtered (": ", stdout);
+ fputs_filtered (prefix, gdb_stdout);
+ fputs_filtered (list->name, gdb_stdout);
+ fputs_filtered (": ", gdb_stdout);
do_setshow_command ((char *)NULL, from_tty, list);
}
}
@@ -1216,7 +1216,7 @@ shell_escape (arg, from_tty)
else
execl (user_shell, p, "-c", arg, 0);
- fprintf (stderr, "Exec of shell failed\n");
+ fprintf_unfiltered (gdb_stderr, "Exec of shell failed\n");
exit (0);
}
@@ -1250,7 +1250,7 @@ make_command (arg, from_tty)
static void
show_user_1 (c, stream)
struct cmd_list_element *c;
- FILE *stream;
+ GDB_FILE *stream;
{
register struct command_line *cmdlines;
@@ -1283,14 +1283,14 @@ show_user (args, from_tty)
c = lookup_cmd (&args, cmdlist, "", 0, 1);
if (c->class != class_user)
error ("Not a user command.");
- show_user_1 (c, stdout);
+ show_user_1 (c, gdb_stdout);
}
else
{
for (c = cmdlist; c; c = c->next)
{
if (c->class == class_user)
- show_user_1 (c, stdout);
+ show_user_1 (c, gdb_stdout);
}
}
}