Don't die when run non-interactively. DOH.

This commit is contained in:
Nicholas Marriott 2009-01-18 19:10:08 +00:00
parent d1a5fde3d0
commit 95b14341dd
3 changed files with 18 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $Id: cmd-choose-session.c,v 1.4 2009-01-18 17:20:52 nicm Exp $ */ /* $Id: cmd-choose-session.c,v 1.5 2009-01-18 19:10:08 nicm Exp $ */
/* /*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@ -54,8 +54,10 @@ cmd_choose_session_exec(struct cmd *self, struct cmd_ctx *ctx)
struct session *s; struct session *s;
u_int i, idx, cur; u_int i, idx, cur;
if (ctx->curclient == NULL) if (ctx->curclient == NULL) {
ctx->error(ctx, "must be run interactively");
return; return;
}
if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL) if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
return; return;

View File

@ -1,4 +1,4 @@
/* $Id: cmd-choose-window.c,v 1.5 2009-01-18 17:20:52 nicm Exp $ */ /* $Id: cmd-choose-window.c,v 1.6 2009-01-18 19:10:08 nicm Exp $ */
/* /*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@ -50,13 +50,16 @@ cmd_choose_window_exec(struct cmd *self, struct cmd_ctx *ctx)
{ {
struct cmd_target_data *data = self->data; struct cmd_target_data *data = self->data;
struct cmd_choose_window_data *cdata; struct cmd_choose_window_data *cdata;
struct session *s = ctx->curclient->session; struct session *s;
struct winlink *wl, *wm; struct winlink *wl, *wm;
struct window *w; struct window *w;
u_int idx, cur; u_int idx, cur;
if (ctx->curclient == NULL) if (ctx->curclient == NULL) {
ctx->error(ctx, "must be run interactively");
return; return;
}
s = ctx->curclient->session;
if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL) if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
return; return;

View File

@ -1,4 +1,4 @@
/* $Id: cmd-find-window.c,v 1.1 2009-01-18 17:20:52 nicm Exp $ */ /* $Id: cmd-find-window.c,v 1.2 2009-01-18 19:10:08 nicm Exp $ */
/* /*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@ -32,8 +32,8 @@ void cmd_find_window_callback(void *, int);
char *cmd_find_window_search(struct window_pane *, const char *); char *cmd_find_window_search(struct window_pane *, const char *);
const struct cmd_entry cmd_find_window_entry = { const struct cmd_entry cmd_find_window_entry = {
"find-window", NULL, "find-window", "findw",
CMD_TARGET_WINDOW_USAGE, CMD_TARGET_WINDOW_USAGE " match-string",
CMD_ARG1, CMD_ARG1,
cmd_target_init, cmd_target_init,
cmd_target_parse, cmd_target_parse,
@ -53,7 +53,7 @@ cmd_find_window_exec(struct cmd *self, struct cmd_ctx *ctx)
{ {
struct cmd_target_data *data = self->data; struct cmd_target_data *data = self->data;
struct cmd_find_window_data *cdata; struct cmd_find_window_data *cdata;
struct session *s = ctx->curclient->session; struct session *s;
struct winlink *wl, *wm; struct winlink *wl, *wm;
struct window *w; struct window *w;
struct window_pane *wp; struct window_pane *wp;
@ -62,8 +62,11 @@ cmd_find_window_exec(struct cmd *self, struct cmd_ctx *ctx)
char *sres, *sctx; char *sres, *sctx;
u_int i; u_int i;
if (ctx->curclient == NULL) if (ctx->curclient == NULL) {
ctx->error(ctx, "must be run interactively");
return; return;
}
s = ctx->curclient->session;
if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL) if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
return; return;