* mi/mi-cmd-stack.c (list_args_or_locals): Workaround
[deliverable/binutils-gdb.git] / gdb / mi / mi-cmd-env.c
index b6e7fd7da1dfa93d7710c83e5bb505fa40b5137a..cbc9bdb7ce0aa91095ea6527cdd5f57827c17ae6 100644 (file)
@@ -1,6 +1,7 @@
 /* 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.
 
@@ -8,7 +9,7 @@
 
    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,
@@ -17,9 +18,7 @@
    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"
@@ -66,7 +65,7 @@ env_execute_cli_command (const char *cmd, const char *args)
 
 
 /* Print working directory.  */
-enum mi_cmd_result
+void
 mi_cmd_env_pwd (char *command, char **argv, int argc)
 {
   if (argc > 0)
@@ -75,27 +74,26 @@ mi_cmd_env_pwd (char *command, char **argv, int argc)
   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"));
           
   env_execute_cli_command ("cd", argv[0]);
-
-  return MI_CMD_DONE;
 }
 
 static void
@@ -110,7 +108,7 @@ env_mod_path (char *dirname, char **which_path)
 }
 
 /* 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;
@@ -126,7 +124,7 @@ mi_cmd_env_path (char *command, char **argv, int argc)
   static struct mi_opt opts[] =
   {
     {"r", RESET_OPT, 0},
-    0
+    { 0, 0, 0 }
   };
 
   dont_repeat ();
@@ -135,7 +133,7 @@ mi_cmd_env_path (char *command, char **argv, int argc)
     {
       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.  */
@@ -179,12 +177,10 @@ mi_cmd_env_path (char *command, char **argv, int argc)
   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;
@@ -198,7 +194,7 @@ mi_cmd_env_dir (char *command, char **argv, int argc)
   static struct mi_opt opts[] =
   {
     {"r", RESET_OPT, 0},
-    0
+    { 0, 0, 0 }
   };
 
   dont_repeat ();
@@ -207,7 +203,7 @@ mi_cmd_env_dir (char *command, char **argv, int argc)
     {
       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.  */
@@ -240,21 +236,17 @@ mi_cmd_env_dir (char *command, char **argv, int argc)
 
   ui_out_field_string (uiout, "source-path", source_path);
   forget_cached_source_info ();
-
-  return MI_CMD_DONE;
 }
 
 /* Set the inferior terminal device name.  */
-enum mi_cmd_result
+void
 mi_cmd_inferior_tty_set (char *command, char **argv, int argc)
 {
   set_inferior_io_terminal (argv[0]);
-
-  return MI_CMD_DONE;
 }
 
 /* Print the inferior terminal device name  */
-enum mi_cmd_result
+void
 mi_cmd_inferior_tty_show (char *command, char **argv, int argc)
 {
   const char *inferior_io_terminal = get_inferior_io_terminal ();
@@ -264,8 +256,6 @@ mi_cmd_inferior_tty_show (char *command, char **argv, int argc)
 
   if (inferior_io_terminal)
     ui_out_field_string (uiout, "inferior_tty_terminal", inferior_io_terminal);
-
-  return MI_CMD_DONE;
 }
 
 void 
This page took 0.030868 seconds and 4 git commands to generate.