=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-new-session.c,v retrieving revision 1.44 retrieving revision 1.45 diff -c -r1.44 -r1.45 *** src/usr.bin/tmux/cmd-new-session.c 2012/07/10 11:53:01 1.44 --- src/usr.bin/tmux/cmd-new-session.c 2012/07/11 07:10:15 1.45 *************** *** 1,4 **** ! /* $OpenBSD: cmd-new-session.c,v 1.44 2012/07/10 11:53:01 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: cmd-new-session.c,v 1.45 2012/07/11 07:10:15 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 30,37 **** * Create a new session and attach to the current terminal unless -d is given. */ ! int cmd_new_session_check(struct args *); ! int cmd_new_session_exec(struct cmd *, struct cmd_ctx *); const struct cmd_entry cmd_new_session_entry = { "new-session", "new", --- 30,37 ---- * Create a new session and attach to the current terminal unless -d is given. */ ! enum cmd_retval cmd_new_session_check(struct args *); ! enum cmd_retval cmd_new_session_exec(struct cmd *, struct cmd_ctx *); const struct cmd_entry cmd_new_session_entry = { "new-session", "new", *************** *** 44,58 **** cmd_new_session_exec }; ! int cmd_new_session_check(struct args *args) { if (args_has(args, 't') && (args->argc != 0 || args_has(args, 'n'))) ! return (-1); ! return (0); } ! int cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx) { struct args *args = self->args; --- 44,58 ---- cmd_new_session_exec }; ! enum cmd_retval cmd_new_session_check(struct args *args) { if (args_has(args, 't') && (args->argc != 0 || args_has(args, 'n'))) ! return (CMD_RETURN_ERROR); ! return (CMD_RETURN_NORMAL); } ! enum cmd_retval cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx) { struct args *args = self->args; *************** *** 71,81 **** if (newname != NULL) { if (!session_check_name(newname)) { ctx->error(ctx, "bad session name: %s", newname); ! return (-1); } if (session_find(newname) != NULL) { ctx->error(ctx, "duplicate session: %s", newname); ! return (-1); } } --- 71,81 ---- if (newname != NULL) { if (!session_check_name(newname)) { ctx->error(ctx, "bad session name: %s", newname); ! return (CMD_RETURN_ERROR); } if (session_find(newname) != NULL) { ctx->error(ctx, "duplicate session: %s", newname); ! return (CMD_RETURN_ERROR); } } *************** *** 83,89 **** if (target != NULL) { groupwith = cmd_find_session(ctx, target, 0); if (groupwith == NULL) ! return (-1); } else groupwith = NULL; --- 83,89 ---- if (target != NULL) { groupwith = cmd_find_session(ctx, target, 0); if (groupwith == NULL) ! return (CMD_RETURN_ERROR); } else groupwith = NULL; *************** *** 131,137 **** if (server_client_open(ctx->cmdclient, NULL, &cause) != 0) { ctx->error(ctx, "open terminal failed: %s", cause); free(cause); ! return (-1); } } --- 131,137 ---- if (server_client_open(ctx->cmdclient, NULL, &cause) != 0) { ctx->error(ctx, "open terminal failed: %s", cause); free(cause); ! return (CMD_RETURN_ERROR); } } *************** *** 163,169 **** args_get(args, 'x'), 1, USHRT_MAX, &errstr); if (errstr != NULL) { ctx->error(ctx, "width %s", errstr); ! return (-1); } } if (args_has(args, 'y')) { --- 163,169 ---- args_get(args, 'x'), 1, USHRT_MAX, &errstr); if (errstr != NULL) { ctx->error(ctx, "width %s", errstr); ! return (CMD_RETURN_ERROR); } } if (args_has(args, 'y')) { *************** *** 171,177 **** args_get(args, 'y'), 1, USHRT_MAX, &errstr); if (errstr != NULL) { ctx->error(ctx, "height %s", errstr); ! return (-1); } } } --- 171,177 ---- args_get(args, 'y'), 1, USHRT_MAX, &errstr); if (errstr != NULL) { ctx->error(ctx, "height %s", errstr); ! return (CMD_RETURN_ERROR); } } } *************** *** 202,208 **** if (s == NULL) { ctx->error(ctx, "create session failed: %s", cause); free(cause); ! return (-1); } environ_free(&env); --- 202,208 ---- if (s == NULL) { ctx->error(ctx, "create session failed: %s", cause); free(cause); ! return (CMD_RETURN_ERROR); } environ_free(&env); *************** *** 269,273 **** ARRAY_FREE(&cfg_causes); } ! return (!detached); /* 1 means don't tell command client to exit */ } --- 269,273 ---- ARRAY_FREE(&cfg_causes); } ! return (detached ? CMD_RETURN_NORMAL : CMD_RETURN_ATTACH); }