=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/Attic/cmd-list.c,v retrieving revision 1.2 retrieving revision 1.3 diff -c -r1.2 -r1.3 *** src/usr.bin/tmux/Attic/cmd-list.c 2009/07/26 12:58:44 1.2 --- src/usr.bin/tmux/Attic/cmd-list.c 2010/01/30 19:08:47 1.3 *************** *** 1,4 **** ! /* $OpenBSD: cmd-list.c,v 1.2 2009/07/26 12:58:44 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: cmd-list.c,v 1.3 2010/01/30 19:08:47 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott *************** *** 77,89 **** cmd_list_exec(struct cmd_list *cmdlist, struct cmd_ctx *ctx) { struct cmd *cmd; ! int n; TAILQ_FOREACH(cmd, cmdlist, qentry) { ! if ((n = cmd_exec(cmd, ctx)) != 0) ! return (n); } ! return (0); } void --- 77,108 ---- cmd_list_exec(struct cmd_list *cmdlist, struct cmd_ctx *ctx) { struct cmd *cmd; ! int n, retval; + retval = 0; TAILQ_FOREACH(cmd, cmdlist, qentry) { ! if ((n = cmd_exec(cmd, ctx)) == -1) ! return (-1); ! ! /* ! * A 1 return value means the command client is being attached ! * (sent MSG_READY). ! */ ! if (n == 1) { ! retval = 1; ! ! /* ! * The command client has been attached, so mangle the ! * context to treat any following commands as if they ! * were called from inside. ! */ ! if (ctx->curclient == NULL) { ! ctx->curclient = ctx->cmdclient; ! ctx->cmdclient = NULL; ! } ! } } ! return (retval); } void