diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2008-06-02 21:08:36 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2008-06-02 21:08:36 +0000 |
commit | a26f58c7c394f81c523da597f85f69d3fc8bc8ad (patch) | |
tree | 869e58ba4df84531d550002ccb2a856ed5db2577 /cfg.c | |
parent | f6b86402c7fd1f4af0e4d163f22e4b9f71b2e538 (diff) | |
download | rtmux-a26f58c7c394f81c523da597f85f69d3fc8bc8ad.tar.gz rtmux-a26f58c7c394f81c523da597f85f69d3fc8bc8ad.tar.bz2 rtmux-a26f58c7c394f81c523da597f85f69d3fc8bc8ad.zip |
Last bits of basic configuration file. By default in ~/.tmux.conf or specified with -f. Just a list of tmux commands executed when the server is started and before and any session/window is created.
Diffstat (limited to 'cfg.c')
-rw-r--r-- | cfg.c | 25 |
1 files changed, 13 insertions, 12 deletions
@@ -1,4 +1,4 @@ -/* $Id: cfg.c,v 1.3 2008-06-02 18:55:53 nicm Exp $ */ +/* $Id: cfg.c,v 1.4 2008-06-02 21:08:36 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -73,7 +73,7 @@ load_cfg(const char *path, char **causep) buf = NULL; len = 0; - line = 1; + line = 0; while ((ch = getc(f)) != EOF) { switch (ch) { case '#': @@ -98,17 +98,18 @@ load_cfg(const char *path, char **causep) case EOF: case ' ': case '\t': - if (len == 0) - break; - buf[len] = '\0'; - - argv = xrealloc(argv, argc + 1, sizeof (char *)); - argv[argc++] = buf; + if (len != 0) { + buf[len] = '\0'; - buf = NULL; - len = 0; + argv = xrealloc( + argv, argc + 1, sizeof (char *)); + argv[argc++] = buf; + + buf = NULL; + len = 0; + } - if (ch != '\n' && ch != EOF) + if ((ch != '\n' && ch != EOF) || argc == 0) break; line++; @@ -123,7 +124,7 @@ load_cfg(const char *path, char **causep) ctx.print = cfg_print; ctx.cmdclient = NULL; - ctx.flags = CMD_KEY; + ctx.flags = 0; cfg_cause = NULL; cmd_exec(cmd, &ctx); |