aboutsummaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
authorAurélien Aptel <aurelien.aptel@gmail.com>2010-11-30 22:55:44 +0100
committerAurélien Aptel <aurelien.aptel@gmail.com>2010-11-30 22:55:44 +0100
commit5dd76fab8b4772adb10a0ba37c7bce8d3ca06b7c (patch)
treec2e0b837ea9437f8ac9c2f5a5e0aeaf4b6ae3a7f /st.c
parent191e59e4389cc0d235c14be5a53554267a81c0a6 (diff)
downloadst-5dd76fab8b4772adb10a0ba37c7bce8d3ca06b7c.tar.gz
st-5dd76fab8b4772adb10a0ba37c7bce8d3ca06b7c.tar.bz2
change -e behaviour and update man page.
Diffstat (limited to 'st.c')
-rw-r--r--st.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/st.c b/st.c
index d43c30c..2be6772 100644
--- a/st.c
+++ b/st.c
@@ -247,7 +247,7 @@ static CSIEscape escseq;
static int cmdfd;
static pid_t pid;
static Selection sel;
-static char *opt_cmd = NULL;
+static char **opt_cmd = NULL;
static char *opt_title = NULL;
static char *opt_class = NULL;
@@ -547,15 +547,12 @@ void
execsh(void) {
char **args;
char *envshell = getenv("SHELL");
- DEFAULT(envshell, "sh");
- if(opt_cmd)
- args = (char*[]){"sh", "-c", opt_cmd, NULL};
- else
- args = (char*[]){envshell, "-i", NULL};
-
+ DEFAULT(envshell, "sh");
putenv("TERM="TNAME);
+ args = opt_cmd ? opt_cmd : (char*[]){envshell, "-i", NULL};
execvp(args[0], args);
+ exit(EXIT_FAILURE);
}
void
@@ -1855,12 +1852,15 @@ main(int argc, char *argv[]) {
if(++i < argc) opt_class = argv[i];
break;
case 'e':
- if(++i < argc) opt_cmd = argv[i];
+ if(++i < argc) opt_cmd = &argv[i];
break;
case 'v':
default:
die(USAGE);
}
+ /* -e eats every remaining arguments */
+ if(opt_cmd)
+ break;
}
setlocale(LC_CTYPE, "");
tnew(80, 24);