aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-04-20 22:17:09 -0400
committerJesse Luehrs <doy@tozt.net>2014-04-20 22:17:09 -0400
commit996a1e445f3dc477ca49f4292b5d9a58a1096726 (patch)
treea6f934cde6cb2489458be5781f6db6f50cb39745
parentf269a4a324396423d97da783ad372cdbb275eb65 (diff)
downloadrunes-996a1e445f3dc477ca49f4292b5d9a58a1096726.tar.gz
runes-996a1e445f3dc477ca49f4292b5d9a58a1096726.zip
allow customizing the command to be run
-rw-r--r--config.c3
-rw-r--r--pty-unix.c13
-rw-r--r--term.h2
3 files changed, 13 insertions, 5 deletions
diff --git a/config.c b/config.c
index 0b75c63..d6dd8cd 100644
--- a/config.c
+++ b/config.c
@@ -194,6 +194,9 @@ static void runes_config_set(RunesTerm *t, char *key, char *val)
else if (!strcmp(key, "cols")) {
t->default_cols = runes_config_parse_uint(val);
}
+ else if (!strcmp(key, "command")) {
+ t->cmd = runes_config_parse_string(val);
+ }
else {
fprintf(stderr, "unknown option: '%s'\n", key);
}
diff --git a/pty-unix.c b/pty-unix.c
index 4a0d3fe..41f86bd 100644
--- a/pty-unix.c
+++ b/pty-unix.c
@@ -24,7 +24,7 @@ void runes_pty_backend_spawn_subprocess(RunesTerm *t)
pty->slave = -1;
}
else {
- char *shell;
+ char *cmd;
setsid();
ioctl(pty->slave, TIOCSCTTY, NULL);
@@ -37,9 +37,12 @@ void runes_pty_backend_spawn_subprocess(RunesTerm *t)
close(pty->slave);
- shell = getenv("SHELL");
- if (!shell) {
- shell = "/bin/sh";
+ cmd = t->cmd;
+ if (!cmd) {
+ cmd = getenv("SHELL");
+ }
+ if (!cmd) {
+ cmd = "/bin/sh";
}
/* XXX should use a different TERM value eventually, but for right now
@@ -48,7 +51,7 @@ void runes_pty_backend_spawn_subprocess(RunesTerm *t)
unsetenv("LINES");
unsetenv("COLUMNS");
- execl(shell, shell, (char *)NULL);
+ execl(cmd, cmd, (char *)NULL);
}
}
diff --git a/term.h b/term.h
index 737b352..c2c0b53 100644
--- a/term.h
+++ b/term.h
@@ -36,6 +36,8 @@ struct runes_term {
int default_rows;
int default_cols;
+ char *cmd;
+
char *font_name;
PangoLayout *layout;