/* MI Command Set - environment commands.
- Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2007, 2008, 2009
+ Free Software Foundation, Inc.
Contributed by Red Hat Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
#include "inferior.h"
/* Print working directory. */
-enum mi_cmd_result
+void
mi_cmd_env_pwd (char *command, char **argv, int argc)
{
if (argc > 0)
- error ("mi_cmd_env_pwd: No arguments required");
+ error (_("mi_cmd_env_pwd: No arguments required"));
if (mi_version (uiout) < 2)
{
env_execute_cli_command ("pwd", NULL);
- return MI_CMD_DONE;
+ return;
}
/* Otherwise the mi level is 2 or higher. */
- getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
+ if (! getcwd (gdb_dirbuf, sizeof (gdb_dirbuf)))
+ error (_("mi_cmd_env_pwd: error finding name of working directory: %s"),
+ safe_strerror (errno));
+
ui_out_field_string (uiout, "cwd", gdb_dirbuf);
-
- return MI_CMD_DONE;
}
/* Change working directory. */
-enum mi_cmd_result
+void
mi_cmd_env_cd (char *command, char **argv, int argc)
{
if (argc == 0 || argc > 1)
- error ("mi_cmd_env_cd: Usage DIRECTORY");
+ error (_("mi_cmd_env_cd: Usage DIRECTORY"));
env_execute_cli_command ("cd", argv[0]);
-
- return MI_CMD_DONE;
}
static void
}
/* Add one or more directories to start of executable search path. */
-enum mi_cmd_result
+void
mi_cmd_env_path (char *command, char **argv, int argc)
{
char *exec_path;
static struct mi_opt opts[] =
{
{"r", RESET_OPT, 0},
- 0
+ { 0, 0, 0 }
};
dont_repeat ();
{
for (i = argc - 1; i >= 0; --i)
env_execute_cli_command ("path", argv[i]);
- return MI_CMD_DONE;
+ return;
}
/* Otherwise the mi level is 2 or higher. */
xfree (exec_path);
env = get_in_environ (inferior_environ, path_var_name);
ui_out_field_string (uiout, "path", env);
-
- return MI_CMD_DONE;
}
/* Add zero or more directories to the front of the source path. */
-enum mi_cmd_result
+void
mi_cmd_env_dir (char *command, char **argv, int argc)
{
int i;
static struct mi_opt opts[] =
{
{"r", RESET_OPT, 0},
- 0
+ { 0, 0, 0 }
};
dont_repeat ();
{
for (i = argc - 1; i >= 0; --i)
env_execute_cli_command ("dir", argv[i]);
- return MI_CMD_DONE;
+ return;
}
/* Otherwise mi level is 2 or higher. */
ui_out_field_string (uiout, "source-path", source_path);
forget_cached_source_info ();
+}
+
+/* Set the inferior terminal device name. */
+void
+mi_cmd_inferior_tty_set (char *command, char **argv, int argc)
+{
+ set_inferior_io_terminal (argv[0]);
+}
+
+/* Print the inferior terminal device name */
+void
+mi_cmd_inferior_tty_show (char *command, char **argv, int argc)
+{
+ const char *inferior_io_terminal = get_inferior_io_terminal ();
+
+ if ( !mi_valid_noargs ("mi_cmd_inferior_tty_show", argc, argv))
+ error (_("mi_cmd_inferior_tty_show: Usage: No args"));
- return MI_CMD_DONE;
+ if (inferior_io_terminal)
+ ui_out_field_string (uiout, "inferior_tty_terminal", inferior_io_terminal);
}
void