diff options
author | Thomas Adam <thomas@xteddy.org> | 2017-01-15 22:01:11 +0000 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2017-01-15 22:01:11 +0000 |
commit | c9fcb76651cd6685ad33b845bcd0a21771964d37 (patch) | |
tree | ca1d2d48cb016473c7bb0d31367faa0a00c107a9 /tmux.c | |
parent | 4f077fe62c4768d479f22f2a46a91f2154eccb01 (diff) | |
parent | 30548461439f02ed8327f96748035685a1a26ace (diff) | |
download | rtmux-c9fcb76651cd6685ad33b845bcd0a21771964d37.tar.gz rtmux-c9fcb76651cd6685ad33b845bcd0a21771964d37.tar.bz2 rtmux-c9fcb76651cd6685ad33b845bcd0a21771964d37.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'tmux.c')
-rw-r--r-- | tmux.c | 30 |
1 files changed, 20 insertions, 10 deletions
@@ -187,9 +187,11 @@ find_home(void) int main(int argc, char **argv) { - char *path, *label, **var, tmp[PATH_MAX], *shellcmd = NULL; - const char *s; - int opt, flags, keys; + char *path, *label, tmp[PATH_MAX]; + char *shellcmd = NULL, **var; + const char *s, *shell; + int opt, flags, keys; + const struct options_table_entry *oe; if (setlocale(LC_CTYPE, "en_US.UTF-8") == NULL) { if (setlocale(LC_CTYPE, "") == NULL) @@ -295,15 +297,23 @@ main(int argc, char **argv) environ_set(global_environ, "PWD", "%s", tmp); global_options = options_create(NULL); - options_table_populate_tree(OPTIONS_TABLE_SERVER, global_options); - global_s_options = options_create(NULL); - options_table_populate_tree(OPTIONS_TABLE_SESSION, global_s_options); - options_set_string(global_s_options, "default-shell", 0, "%s", - getshell()); - global_w_options = options_create(NULL); - options_table_populate_tree(OPTIONS_TABLE_WINDOW, global_w_options); + for (oe = options_table; oe->name != NULL; oe++) { + if (oe->scope == OPTIONS_TABLE_SERVER) + options_default(global_options, oe); + if (oe->scope == OPTIONS_TABLE_SESSION) + options_default(global_s_options, oe); + if (oe->scope == OPTIONS_TABLE_WINDOW) + options_default(global_w_options, oe); + } + + /* + * The default shell comes from SHELL or from the user's passwd entry + * if available. + */ + shell = getshell(); + options_set_string(global_s_options, "default-shell", 0, "%s", shell); /* Override keys to vi if VISUAL or EDITOR are set. */ if ((s = getenv("VISUAL")) != NULL || (s = getenv("EDITOR")) != NULL) { |