aboutsummaryrefslogtreecommitdiff
path: root/gdb/common/pathstuff.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-09-14 10:35:45 -0600
committerTom Tromey <tom@tromey.com>2018-10-27 11:58:40 -0600
commit974e68446388769f023c6c9bfb1e67ed75199618 (patch)
tree49cb772e05b3d9157addbfea699624a0f293e969 /gdb/common/pathstuff.h
parentc8ee3f04a66141d5fa930cd77bc53ac0bc17de32 (diff)
downloadgdb-974e68446388769f023c6c9bfb1e67ed75199618.zip
gdb-974e68446388769f023c6c9bfb1e67ed75199618.tar.gz
gdb-974e68446388769f023c6c9bfb1e67ed75199618.tar.bz2
Unify shell-finding logic
I noticed several places in gdb that were using getenv("SHELL") and then falling back to "/bin/sh" if it returned NULL. This unifies these into a single function. gdb/ChangeLog 2018-10-27 Tom Tromey <tom@tromey.com> * procfs.c (procfs_target::create_inferior): Use get_shell. * cli/cli-cmds.c (shell_escape): Use get_shell. * windows-nat.c (windows_nat_target::create_inferior): Use get_shell. * common/pathstuff.c (get_shell): New function. * nat/fork-inferior.c (SHELL_FILE, get_startup_shell): Remove. (fork_inferior): Use get_shell. * common/pathstuff.h (get_shell): Declare.
Diffstat (limited to 'gdb/common/pathstuff.h')
-rw-r--r--gdb/common/pathstuff.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/gdb/common/pathstuff.h b/gdb/common/pathstuff.h
index a43b963..0a8caea 100644
--- a/gdb/common/pathstuff.h
+++ b/gdb/common/pathstuff.h
@@ -64,4 +64,9 @@ extern bool contains_dir_separator (const char *path);
extern std::string get_standard_cache_dir ();
+/* Return the file name of the user's shell. Normally this comes from
+ the SHELL environment variable. */
+
+extern const char *get_shell ();
+
#endif /* PATHSTUFF_H */