aboutsummaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
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;
247static int cmdfd; 247static int cmdfd;
248static pid_t pid; 248static pid_t pid;
249static Selection sel; 249static Selection sel;
250static char *opt_cmd = NULL; 250static char **opt_cmd = NULL;
251static char *opt_title = NULL; 251static char *opt_title = NULL;
252static char *opt_class = NULL; 252static char *opt_class = NULL;
253 253
@@ -547,15 +547,12 @@ void
547execsh(void) { 547execsh(void) {
548 char **args; 548 char **args;
549 char *envshell = getenv("SHELL"); 549 char *envshell = getenv("SHELL");
550 DEFAULT(envshell, "sh");
551 550
552 if(opt_cmd) 551 DEFAULT(envshell, "sh");
553 args = (char*[]){"sh", "-c", opt_cmd, NULL};
554 else
555 args = (char*[]){envshell, "-i", NULL};
556
557 putenv("TERM="TNAME); 552 putenv("TERM="TNAME);
553 args = opt_cmd ? opt_cmd : (char*[]){envshell, "-i", NULL};
558 execvp(args[0], args); 554 execvp(args[0], args);
555 exit(EXIT_FAILURE);
559} 556}
560 557
561void 558void
@@ -1855,12 +1852,15 @@ main(int argc, char *argv[]) {
1855 if(++i < argc) opt_class = argv[i]; 1852 if(++i < argc) opt_class = argv[i];
1856 break; 1853 break;
1857 case 'e': 1854 case 'e':
1858 if(++i < argc) opt_cmd = argv[i]; 1855 if(++i < argc) opt_cmd = &argv[i];
1859 break; 1856 break;
1860 case 'v': 1857 case 'v':
1861 default: 1858 default:
1862 die(USAGE); 1859 die(USAGE);
1863 } 1860 }
1861 /* -e eats every remaining arguments */
1862 if(opt_cmd)
1863 break;
1864 } 1864 }
1865 setlocale(LC_CTYPE, ""); 1865 setlocale(LC_CTYPE, "");
1866 tnew(80, 24); 1866 tnew(80, 24);