Hi I think if possible the unfinished command thing should not be log_warnx but should an error and be added to the causes.
Also this needs to go somewhere in the manpage. Cheers On Fri, Aug 12, 2011 at 04:00:17PM +0200, Julius Plenz wrote: > Hi! > > Since tmux supports chaining commands via \; already, I find it a pity > tmux cannot handle any sort of line continuation as far as I can see. > > The patch below implements this feature: lines ending with a single > backslash will trigger the next line to be read in also. Thus, it's > possible to split up big commands over several lines, like this: > > # paste latest cutbuffer to sprunge > bind P run-shell \ > "tmux set-b $(tmux sa - | curl -F 'sprunge=<-' http://sprunge.us) && \ > tmux display-message 'sprunge: upload sucessful!'" > > If there's something fishy with the patch, please tell me and I'll > correct it. > > Julius > > > diff --git i/cfg.c w/cfg.c > index b69e29f..542fb14 100644 > --- i/cfg.c > +++ w/cfg.c > @@ -92,15 +92,25 @@ 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) { > if (cause == NULL) > continue; > @@ -135,8 +145,10 @@ load_cfg(const char *path, struct cmd_ctx *ctxin, struct > causelist *causes) > xfree(cfg_cause); > } > } > - if (line != NULL) > + if (line != NULL) { > xfree(line); > + log_warnx("unfinished command at end of file: %s", path); > + } > fclose(f); > > return (retval); > > > ------------------------------------------------------------------------------ > 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-dev2dev > _______________________________________________ > tmux-users mailing list > tmux-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/tmux-users ------------------------------------------------------------------------------ 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