Unify shell-finding logic
authorTom Tromey <tom@tromey.com>
Fri, 14 Sep 2018 16:35:45 +0000 (10:35 -0600)
committerTom Tromey <tom@tromey.com>
Sat, 27 Oct 2018 17:58:40 +0000 (11:58 -0600)
commit974e68446388769f023c6c9bfb1e67ed75199618
tree49cb772e05b3d9157addbfea699624a0f293e969
parentc8ee3f04a66141d5fa930cd77bc53ac0bc17de32
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.
gdb/ChangeLog
gdb/cli/cli-cmds.c
gdb/common/pathstuff.c
gdb/common/pathstuff.h
gdb/nat/fork-inferior.c
gdb/procfs.c
gdb/windows-nat.c