Commit | Line | Data |
---|---|---|
445c5aba MW |
1 | Use $SHELL instead of hardcoding /bin/sh in ratpoison. |
2 | ||
3 | Patch by Mark H Weaver <mhw@netris.org>. | |
4 | ||
8cba71c7 ML |
5 | --- ratpoison/src/actions.c.orig 2014-09-14 16:46:08.000000000 +0200 |
6 | +++ ratpoison/src/actions.c 2015-08-06 15:00:54.951575260 +0200 | |
7 | @@ -228,12 +228,12 @@ | |
445c5aba MW |
8 | add_command ("escape", cmd_escape, 1, 1, 1, |
9 | "Key: ", arg_KEY); | |
10 | add_command ("exec", cmd_exec, 1, 1, 1, | |
11 | - "/bin/sh -c ", arg_SHELLCMD); | |
12 | + "$SHELL -c ", arg_SHELLCMD); | |
13 | add_command ("execa", cmd_execa, 1, 1, 1, | |
14 | - "/bin/sh -c ", arg_SHELLCMD); | |
15 | + "$SHELL -c ", arg_SHELLCMD); | |
16 | add_command ("execf", cmd_execf, 2, 2, 2, | |
17 | "frame to execute in:", arg_FRAME, | |
18 | - "/bin/sh -c ", arg_SHELLCMD); | |
19 | + "$SHELL -c ", arg_SHELLCMD); | |
20 | add_command ("fdump", cmd_fdump, 1, 0, 0, | |
21 | "", arg_NUMBER); | |
22 | add_command ("focus", cmd_next_frame, 0, 0, 0); | |
8cba71c7 | 23 | @@ -367,7 +367,7 @@ |
445c5aba MW |
24 | add_command ("unsetenv", cmd_unsetenv, 1, 1, 1, |
25 | "Variable: ", arg_STRING); | |
26 | add_command ("verbexec", cmd_verbexec, 1, 1, 1, | |
27 | - "/bin/sh -c ", arg_SHELLCMD); | |
28 | + "$SHELL -c ", arg_SHELLCMD); | |
29 | add_command ("version", cmd_version, 0, 0, 0); | |
30 | add_command ("vsplit", cmd_v_split, 1, 0, 0, | |
31 | "Split: ", arg_STRING); | |
8cba71c7 | 32 | @@ -2671,6 +2671,9 @@ |
445c5aba MW |
33 | pid = fork(); |
34 | if (pid == 0) | |
35 | { | |
36 | + char *shell_path; | |
37 | + char *shell_name; | |
38 | + | |
39 | /* Some process setup to make sure the spawned process runs | |
40 | in its own session. */ | |
41 | putenv(current_screen()->display_string); | |
8cba71c7 | 42 | @@ -2700,7 +2703,18 @@ |
445c5aba MW |
43 | /* raw means don't run it through sh. */ |
44 | if (raw) | |
8cba71c7 ML |
45 | execl (cmd, cmd, (char *)NULL); |
46 | - execl("/bin/sh", "sh", "-c", cmd, (char *)NULL); | |
445c5aba MW |
47 | + |
48 | + shell_path = getenv ("SHELL"); | |
49 | + if (shell_path == NULL) | |
50 | + shell_path = "/bin/sh"; | |
51 | + | |
52 | + shell_name = strrchr (shell_path, '/'); | |
53 | + if (shell_name == NULL) | |
54 | + shell_name = shell_path; | |
55 | + else | |
56 | + shell_name++; | |
57 | + | |
8cba71c7 | 58 | + execl(shell_path, shell_name, "-c", cmd, (char *)NULL); |
445c5aba MW |
59 | _exit(EXIT_FAILURE); |
60 | } | |
61 | ||
8cba71c7 ML |
62 | --- ratpoison/src/events.c.orig 2014-09-14 16:46:23.000000000 +0200 |
63 | +++ ratpoison/src/events.c 2015-08-06 15:02:17.287578780 +0200 | |
64 | @@ -919,7 +919,7 @@ | |
445c5aba MW |
65 | { |
66 | /* Report any child that didn't return 0. */ | |
67 | if (cur->status != 0) | |
68 | - marked_message_printf (0,0, "/bin/sh -c \"%s\" finished (%d)", | |
69 | + marked_message_printf (0,0, "$SHELL -c \"%s\" finished (%d)", | |
70 | cur->cmd, cur->status); | |
71 | list_del (&cur->node); | |
72 | free (cur->cmd); | |
8cba71c7 ML |
73 | --- ratpoison/src/messages.h.orig 2014-04-09 01:22:08.000000000 +0200 |
74 | +++ ratpoison/src/messages.h 2015-08-06 15:04:14.759583801 +0200 | |
75 | @@ -39,7 +39,7 @@ | |
445c5aba MW |
76 | |
77 | #define MESSAGE_PROMPT_SWITCH_TO_WINDOW "Switch to window: " | |
78 | #define MESSAGE_PROMPT_NEW_WINDOW_NAME "Set window's title to: " | |
79 | -#define MESSAGE_PROMPT_SHELL_COMMAND "/bin/sh -c " | |
80 | +#define MESSAGE_PROMPT_SHELL_COMMAND "$SHELL -c " | |
81 | #define MESSAGE_PROMPT_COMMAND ":" | |
82 | #define MESSAGE_PROMPT_SWITCH_WM "Switch to wm: " | |
83 | #define MESSAGE_PROMPT_XTERM_COMMAND MESSAGE_PROMPT_SHELL_COMMAND TERM_PROG " -e " |