/* MI Command Set - environment commands.
- Copyright (C) 2002-2017 Free Software Foundation, Inc.
+ Copyright (C) 2002-2019 Free Software Foundation, Inc.
Contributed by Red Hat Inc.
#include "mi-getopt.h"
#include "symtab.h"
#include "target.h"
-#include "environ.h"
+#include "common/environ.h"
#include "command.h"
#include "ui-out.h"
#include "top.h"
#include <sys/stat.h>
-
-static void env_mod_path (char *dirname, char **which_path);
-
-extern void _initialize_mi_cmd_env (void);
+#include "source.h"
static const char path_var_name[] = "PATH";
static char *orig_path = NULL;
/* Otherwise the mi level is 2 or higher. */
- if (! getcwd (gdb_dirbuf, sizeof (gdb_dirbuf)))
+ gdb::unique_xmalloc_ptr<char> cwd (getcwd (NULL, 0));
+ if (cwd == NULL)
error (_("-environment-pwd: error finding name of working directory: %s"),
safe_strerror (errno));
-
- uiout->field_string ("cwd", gdb_dirbuf);
+
+ uiout->field_string ("cwd", cwd.get ());
}
/* Change working directory. */
}
static void
-env_mod_path (char *dirname, char **which_path)
+env_mod_path (const char *dirname, char **which_path)
{
if (dirname == 0 || dirname[0] == '\0')
return;