Hi, Nicholas!

* Nicholas Marriott <nicholas.marri...@gmail.com> [2011-08-20 22:51]:
> I think if possible the unfinished command thing should not be
> log_warnx but should an error and be added to the causes.

Right. Also, I fixed a small memory leak.

> Also this needs to go somewhere in the manpage.

I added two examples in the man page.

Much appreciated,

Julius

-- 
Here's the new patch:

diff --git c/cfg.c i/cfg.c
index b69e29f..6927495 100644
--- c/cfg.c
+++ i/cfg.c
@@ -92,22 +92,34 @@ load_cfg(const char *path, struct cmd_ctx *ctxin, struct 
causelist *causes)
    retval = 0;
    while ((buf = fgetln(f, &len))) {
        if (buf[len - 1] == '\n')
-           buf[len - 1] = '\0';
-       else {
-           line = xrealloc(line, 1, len + 1);
-           memcpy(line, buf, len);
-           line[len] = '\0';
-           buf = line;
-       }
+           len--;
+
+       if(line != NULL)
+           line = xrealloc(line, 1, strlen(line) + len + 1);
+       else
+           line = xcalloc(1, len + 1);
+
+       /* append buffer to line */
+       strncat(line, buf, len);
+       buf = line;
        n++;
 
+       /* continuation: slurp in next line? */
+       if (buf[strlen(buf) - 1] == '\\') {
+           buf[strlen(buf) - 1] = '\0';
+           continue;
+       }
+       line = NULL;
+
        if (cmd_string_parse(buf, &cmdlist, &cause) != 0) {
+           xfree(buf);
            if (cause == NULL)
                continue;
            cfg_add_cause(causes, "%s: %u: %s", path, n, cause);
            xfree(cause);
            continue;
-       }
+       } else
+           xfree(buf);
        if (cmdlist == NULL)
            continue;
        cfg_cause = NULL;
@@ -135,8 +147,11 @@ load_cfg(const char *path, struct cmd_ctx *ctxin, struct 
causelist *causes)
            xfree(cfg_cause);
        }
    }
-   if (line != NULL)
+   if (line != NULL) {
+       xasprintf(&cause, "continuation via \\ until end of file");
+       cfg_add_cause(causes, "%s: %d: %s", path, n, cause);
        xfree(line);
+   }
    fclose(f);
 
    return (retval);
diff --git c/tmux.1 i/tmux.1
index 6de074e..c465375 100644
--- c/tmux.1
+++ i/tmux.1
@@ -495,7 +495,8 @@ $ tmux bind-key F1 set-window-option force-width 81
 Multiple commands may be specified together as part of a
 .Em command sequence .
 Each command should be separated by spaces and a semicolon;
-commands are executed sequentially from left to right.
+commands are executed sequentially from left to right;
+lines ending with a backslash continue until the next line.
 A literal semicolon may be included by escaping it with a backslash (for
 example, when specifying a command sequence to
 .Ic bind-key ) .
@@ -511,6 +512,9 @@ rename-session -tfirst newname
 set-window-option -t:0 monitor-activity on
 
 new-window ; split-window -d
+
+bind-key R source-file ~/.tmux.conf \e; \e
+  display-message "tmux: config reloaded"
 .Ed
 .Pp
 Or from
@@ -3004,6 +3008,8 @@ Creating new key bindings:
 bind-key b set-option status
 bind-key / command-prompt "split-window 'exec man %%'"
 bind-key S command-prompt "new-window -n %1 'ssh %1'"
+bind-key R source-file ~/.tmux.conf \e; \e
+  display-message "tmux: config reloaded"
 .Ed
 .Sh SEE ALSO
 .Xr pty 4


------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to