diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cfa341c74b4..c2c3aa948e4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2000-04-03 Felix Lee + + * fixinc/server.c (find_shell): New function. Avoid $SHELL. + (run_shell): Use it. + 2000-04-03 Jonathan Larmour * Makefile.in (stmp-int-hdrs): Make include subdir here... diff --git a/gcc/fixinc/server.c b/gcc/fixinc/server.c index 676df8cd0f6..5d737ac70ac 100644 --- a/gcc/fixinc/server.c +++ b/gcc/fixinc/server.c @@ -235,6 +235,28 @@ server_setup () p_cur_dir = getcwd ((char *) NULL, MAXPATHLEN + 1); } +/* + * find_shell + * + * Locate a shell suitable for use. For various reasons + * (like the use of "trap" in server_setup(), it must be a + * Bourne-like shell. + * + * Most of the time, /bin/sh is preferred, but sometimes + * it's quite broken (like on Ultrix). autoconf lets you + * override with $CONFIG_SHELL, so we do the same. + */ + +static char * +find_shell () +{ + char * shell = getenv ("CONFIG_SHELL"); + if (shell) + return shell; + + return "/bin/sh"; +} + /* * run_shell @@ -266,6 +288,8 @@ run_shell (pz_cmd) THEN try to start it. */ if (server_id == NULLPROCESS) { + def_args[0] = find_shell (); + server_id = proc2_fopen (&server_pair, def_args); if (server_id > 0) server_setup ();