use SHELL environment variable (thx Thomas Adam)
authorAurélien Aptel <aurelien.aptel@gmail.com>
Mon, 26 Apr 2010 17:20:53 +0000 (19:20 +0200)
committerAurélien Aptel <aurelien.aptel@gmail.com>
Mon, 26 Apr 2010 17:20:53 +0000 (19:20 +0200)
config.h
st.c

index 185b3ff..0b0b36d 100644 (file)
--- a/config.h
+++ b/config.h
@@ -1,4 +1,3 @@
-#define SHELL "/bin/bash"
 #define TAB    8
 
 #define FONT "6x13"
diff --git a/st.c b/st.c
index deb1610..ee79a33 100755 (executable)
--- a/st.c
+++ b/st.c
@@ -208,9 +208,12 @@ die(const char *errstr, ...) {
 
 void
 execsh(void) {
-       char *args[3] = {SHELL, "-i", NULL};
+       char *shell = getenv("SHELL");
+       if(!shell)
+               shell = "/bin/sh";
+       char *args[3] = {shell, "-i", NULL};
        putenv("TERM=" TNAME);
-       execvp(SHELL, args);
+       execvp(shell, args);
 }
 
 void
@@ -844,7 +847,6 @@ tputtab(void) {
 
 void
 tputc(char c) {
-       /* dump(c); */
        if(term.esc & ESC_START) {
                if(term.esc & ESC_CSI) {
                        escseq.buf[escseq.len++] = c;
@@ -1277,7 +1279,7 @@ run(void) {
                }
                if(FD_ISSET(cmdfd, &rfd)) {
                        ttyread();
-                       draw(SCREEN_UPDATE);
+                       draw(SCREEN_UPDATE); 
                }
                while(XPending(xw.dis)) {
                        XNextEvent(xw.dis, &ev);