Revision: 2627
          http://tmux.svn.sourceforge.net/tmux/?rev=2627&view=rev
Author:   tcunha
Date:     2011-10-31 13:55:10 +0000 (Mon, 31 Oct 2011)
Log Message:
-----------
Sync OpenBSD patchset 972:

Didn't really think the else behaviour through - requiring argv to
contain "else" is silly so just omit that, also some manpage
tweaks. From Tiago Cunha.

Modified Paths:
--------------
    trunk/cmd-if-shell.c
    trunk/tmux.1

Modified: trunk/cmd-if-shell.c
===================================================================
--- trunk/cmd-if-shell.c        2011-10-31 13:54:28 UTC (rev 2626)
+++ trunk/cmd-if-shell.c        2011-10-31 13:55:10 UTC (rev 2627)
@@ -25,10 +25,9 @@
 #include "tmux.h"
 
 /*
- * Executes a tmux command if a shell command returns true.
+ * Executes a tmux command if a shell command returns true or false.
  */
 
-int    cmd_if_shell_check(struct args *);
 int    cmd_if_shell_exec(struct cmd *, struct cmd_ctx *);
 
 void   cmd_if_shell_callback(struct job *);
@@ -36,11 +35,11 @@
 
 const struct cmd_entry cmd_if_shell_entry = {
        "if-shell", "if",
-       "", 2, 4,
-       "shell-command command [else command]",
+       "", 2, 3,
+       "shell-command command [command]",
        0,
        NULL,
-       cmd_if_shell_check,
+       NULL,
        cmd_if_shell_exec
 };
 
@@ -51,16 +50,6 @@
 };
 
 int
-cmd_if_shell_check(struct args *args)
-{
-       if (args->argc == 3)
-               return (-1);
-       if (args->argc == 4 && strcmp(args->argv[2], "else") != 0)
-               return (-1);
-       return (0);
-}
-
-int
 cmd_if_shell_exec(struct cmd *self, struct cmd_ctx *ctx)
 {
        struct args                     *args = self->args;
@@ -69,8 +58,8 @@
 
        cdata = xmalloc(sizeof *cdata);
        cdata->cmd_if = xstrdup(args->argv[1]);
-       if (args->argc == 4)
-               cdata->cmd_else = xstrdup(args->argv[3]);
+       if (args->argc == 3)
+               cdata->cmd_else = xstrdup(args->argv[2]);
        else
                cdata->cmd_else = NULL;
        memcpy(&cdata->ctx, ctx, sizeof cdata->ctx);
@@ -91,8 +80,7 @@
        struct cmd_if_shell_data        *cdata = job->data;
        struct cmd_ctx                  *ctx = &cdata->ctx;
        struct cmd_list                 *cmdlist;
-       char                            *cmd;
-       char                            *cause;
+       char                            *cause, *cmd;
 
        if (!WIFEXITED(job->status) || WEXITSTATUS(job->status) != 0) {
                cmd = cdata->cmd_else;

Modified: trunk/tmux.1
===================================================================
--- trunk/tmux.1        2011-10-31 13:54:28 UTC (rev 2626)
+++ trunk/tmux.1        2011-10-31 13:55:10 UTC (rev 2627)
@@ -14,7 +14,7 @@
 .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd $Mdocdate: October 23 2011 $
+.Dd $Mdocdate: October 27 2011 $
 .Dt TMUX 1
 .Os
 .Sh NAME
@@ -2975,13 +2975,15 @@
 .Bl -tag -width Ds
 .It Ic clock-mode Op Fl t Ar target-pane
 Display a large clock.
-.It Ic if-shell Ar shell-command command
+.It Ic if-shell Ar shell-command command Op Ar command
 .D1 (alias: Ic if )
-Execute
+Execute the first
 .Ar command
 if
 .Ar shell-command
-returns success.
+returns success or the second
+.Ar command
+otherwise.
 .It Ic lock-server
 .D1 (alias: Ic lock )
 Lock each client individually by running the command specified by the

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Get your Android app more play: Bring it to the BlackBerry PlayBook 
in minutes. BlackBerry App World™ now supports Android™ Apps 
for the BlackBerry® PlayBook™. Discover just how easy and simple 
it is! http://p.sf.net/sfu/android-dev2dev
_______________________________________________
tmux-cvs mailing list
tmux-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-cvs

Reply via email to