diff options
Diffstat (limited to '')
| -rw-r--r-- | config.def.h | 3 | ||||
| -rw-r--r-- | st.1 | 3 | ||||
| -rw-r--r-- | st.c | 16 | ||||
| -rw-r--r-- | st.h | 1 |
4 files changed, 15 insertions, 8 deletions
diff --git a/config.def.h b/config.def.h index 546edda..dfcbda9 100644 --- a/config.def.h +++ b/config.def.h | |||
| @@ -11,13 +11,14 @@ static int borderpx = 2; | |||
| 11 | /* | 11 | /* |
| 12 | * What program is execed by st depends of these precedence rules: | 12 | * What program is execed by st depends of these precedence rules: |
| 13 | * 1: program passed with -e | 13 | * 1: program passed with -e |
| 14 | * 2: utmp option | 14 | * 2: scroll and/or utmp |
| 15 | * 3: SHELL environment variable | 15 | * 3: SHELL environment variable |
| 16 | * 4: value of shell in /etc/passwd | 16 | * 4: value of shell in /etc/passwd |
| 17 | * 5: value of shell in config.h | 17 | * 5: value of shell in config.h |
| 18 | */ | 18 | */ |
| 19 | static char *shell = "/bin/sh"; | 19 | static char *shell = "/bin/sh"; |
| 20 | char *utmp = NULL; | 20 | char *utmp = NULL; |
| 21 | char *scroll = NULL; | ||
| 21 | char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400"; | 22 | char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400"; |
| 22 | 23 | ||
| 23 | /* identification sequence returned in DA and DECID */ | 24 | /* identification sequence returned in DA and DECID */ |
| @@ -170,7 +170,8 @@ See the LICENSE file for the terms of redistribution. | |||
| 170 | .SH SEE ALSO | 170 | .SH SEE ALSO |
| 171 | .BR tabbed (1), | 171 | .BR tabbed (1), |
| 172 | .BR utmp (1), | 172 | .BR utmp (1), |
| 173 | .BR stty (1) | 173 | .BR stty (1), |
| 174 | .BR scroll (1) | ||
| 174 | .SH BUGS | 175 | .SH BUGS |
| 175 | See the TODO file in the distribution. | 176 | See the TODO file in the distribution. |
| 176 | 177 | ||
| @@ -664,7 +664,7 @@ die(const char *errstr, ...) | |||
| 664 | void | 664 | void |
| 665 | execsh(char *cmd, char **args) | 665 | execsh(char *cmd, char **args) |
| 666 | { | 666 | { |
| 667 | char *sh, *prog; | 667 | char *sh, *prog, *arg; |
| 668 | const struct passwd *pw; | 668 | const struct passwd *pw; |
| 669 | 669 | ||
| 670 | errno = 0; | 670 | errno = 0; |
| @@ -678,13 +678,17 @@ execsh(char *cmd, char **args) | |||
| 678 | if ((sh = getenv("SHELL")) == NULL) | 678 | if ((sh = getenv("SHELL")) == NULL) |
| 679 | sh = (pw->pw_shell[0]) ? pw->pw_shell : cmd; | 679 | sh = (pw->pw_shell[0]) ? pw->pw_shell : cmd; |
| 680 | 680 | ||
| 681 | if (args) | 681 | if (args) { |
| 682 | prog = args[0]; | 682 | prog = args[0]; |
| 683 | else if (utmp) | 683 | arg = NULL; |
| 684 | prog = utmp; | 684 | } else if (scroll || utmp) { |
| 685 | else | 685 | prog = scroll ? scroll : utmp; |
| 686 | arg = scroll ? utmp : NULL; | ||
| 687 | } else { | ||
| 686 | prog = sh; | 688 | prog = sh; |
| 687 | DEFAULT(args, ((char *[]) {prog, NULL})); | 689 | arg = NULL; |
| 690 | } | ||
| 691 | DEFAULT(args, ((char *[]) {prog, arg, NULL})); | ||
| 688 | 692 | ||
| 689 | unsetenv("COLUMNS"); | 693 | unsetenv("COLUMNS"); |
| 690 | unsetenv("LINES"); | 694 | unsetenv("LINES"); |
| @@ -113,6 +113,7 @@ char *xstrdup(char *); | |||
| 113 | 113 | ||
| 114 | /* config.h globals */ | 114 | /* config.h globals */ |
| 115 | extern char *utmp; | 115 | extern char *utmp; |
| 116 | extern char *scroll; | ||
| 116 | extern char *stty_args; | 117 | extern char *stty_args; |
| 117 | extern char *vtiden; | 118 | extern char *vtiden; |
| 118 | extern wchar_t *worddelimiters; | 119 | extern wchar_t *worddelimiters; |
