summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/cmd-break-pane.c4
-rw-r--r--usr.bin/tmux/cmd-command-prompt.c4
-rw-r--r--usr.bin/tmux/cmd-confirm-before.c4
-rw-r--r--usr.bin/tmux/cmd-detach-client.c4
-rw-r--r--usr.bin/tmux/cmd-display-message.c6
-rw-r--r--usr.bin/tmux/cmd-display-panes.c4
-rw-r--r--usr.bin/tmux/cmd-lock-server.c4
-rw-r--r--usr.bin/tmux/cmd-new-window.c4
-rw-r--r--usr.bin/tmux/cmd-pipe-pane.c4
-rw-r--r--usr.bin/tmux/cmd-refresh-client.c4
-rw-r--r--usr.bin/tmux/cmd-show-messages.c4
-rw-r--r--usr.bin/tmux/cmd-split-window.c4
-rw-r--r--usr.bin/tmux/cmd-suspend-client.c4
-rw-r--r--usr.bin/tmux/cmd-switch-client.c4
-rw-r--r--usr.bin/tmux/cmd.c14
-rw-r--r--usr.bin/tmux/tmux.h4
16 files changed, 39 insertions, 37 deletions
diff --git a/usr.bin/tmux/cmd-break-pane.c b/usr.bin/tmux/cmd-break-pane.c
index df87ad3d714..1a7cabfbe32 100644
--- a/usr.bin/tmux/cmd-break-pane.c
+++ b/usr.bin/tmux/cmd-break-pane.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-break-pane.c,v 1.18 2013/03/22 15:55:22 nicm Exp $ */
+/* $OpenBSD: cmd-break-pane.c,v 1.19 2013/03/24 09:27:19 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -97,7 +97,7 @@ cmd_break_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
template = BREAK_PANE_TEMPLATE;
ft = format_create();
- if ((c = cmd_find_client(ctx, NULL)) != NULL)
+ if ((c = cmd_find_client(ctx, NULL, 1)) != NULL)
format_client(ft, c);
format_session(ft, s);
format_winlink(ft, s, wl);
diff --git a/usr.bin/tmux/cmd-command-prompt.c b/usr.bin/tmux/cmd-command-prompt.c
index 44e100997e0..2bff1208e0f 100644
--- a/usr.bin/tmux/cmd-command-prompt.c
+++ b/usr.bin/tmux/cmd-command-prompt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-command-prompt.c,v 1.24 2013/03/22 15:54:29 nicm Exp $ */
+/* $OpenBSD: cmd-command-prompt.c,v 1.25 2013/03/24 09:27:19 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -94,7 +94,7 @@ cmd_command_prompt_exec(struct cmd *self, struct cmd_ctx *ctx)
char *prompt, *ptr, *input = NULL;
size_t n;
- if ((c = cmd_find_client(ctx, args_get(args, 't'))) == NULL)
+ if ((c = cmd_find_client(ctx, args_get(args, 't'), 0)) == NULL)
return (CMD_RETURN_ERROR);
if (c->prompt_string != NULL)
diff --git a/usr.bin/tmux/cmd-confirm-before.c b/usr.bin/tmux/cmd-confirm-before.c
index d4fa92569cb..c5181b8082d 100644
--- a/usr.bin/tmux/cmd-confirm-before.c
+++ b/usr.bin/tmux/cmd-confirm-before.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-confirm-before.c,v 1.17 2013/03/22 15:54:29 nicm Exp $ */
+/* $OpenBSD: cmd-confirm-before.c,v 1.18 2013/03/24 09:27:19 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -79,7 +79,7 @@ cmd_confirm_before_exec(struct cmd *self, struct cmd_ctx *ctx)
return (CMD_RETURN_ERROR);
}
- if ((c = cmd_find_client(ctx, args_get(args, 't'))) == NULL)
+ if ((c = cmd_find_client(ctx, args_get(args, 't'), 0)) == NULL)
return (CMD_RETURN_ERROR);
if ((prompt = args_get(args, 'p')) != NULL)
diff --git a/usr.bin/tmux/cmd-detach-client.c b/usr.bin/tmux/cmd-detach-client.c
index 3a67a07ad33..d3d1a32fbda 100644
--- a/usr.bin/tmux/cmd-detach-client.c
+++ b/usr.bin/tmux/cmd-detach-client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-detach-client.c,v 1.11 2012/07/11 07:10:15 nicm Exp $ */
+/* $OpenBSD: cmd-detach-client.c,v 1.12 2013/03/24 09:27:19 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -61,7 +61,7 @@ cmd_detach_client_exec(struct cmd *self, struct cmd_ctx *ctx)
server_write_client(c, msgtype, NULL, 0);
}
} else {
- c = cmd_find_client(ctx, args_get(args, 't'));
+ c = cmd_find_client(ctx, args_get(args, 't'), 0);
if (c == NULL)
return (CMD_RETURN_ERROR);
diff --git a/usr.bin/tmux/cmd-display-message.c b/usr.bin/tmux/cmd-display-message.c
index 5ba7deedf58..30b3f42c2a6 100644
--- a/usr.bin/tmux/cmd-display-message.c
+++ b/usr.bin/tmux/cmd-display-message.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-display-message.c,v 1.18 2013/03/24 09:26:34 nicm Exp $ */
+/* $OpenBSD: cmd-display-message.c,v 1.19 2013/03/24 09:27:19 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -55,8 +55,6 @@ cmd_display_message_exec(struct cmd *self, struct cmd_ctx *ctx)
time_t t;
size_t len;
- c = cmd_find_client(ctx, args_get(args, 'c'));
-
if (args_has(args, 't')) {
wl = cmd_find_pane(ctx, args_get(args, 't'), &s, &wp);
if (wl == NULL)
@@ -79,7 +77,7 @@ cmd_display_message_exec(struct cmd *self, struct cmd_ctx *ctx)
template = DISPLAY_MESSAGE_TEMPLATE;
ft = format_create();
- if (c != NULL)
+ if ((c = cmd_find_client(ctx, args_get(args, 'c'), 1)) != NULL)
format_client(ft, c);
format_session(ft, s);
format_winlink(ft, s, wl);
diff --git a/usr.bin/tmux/cmd-display-panes.c b/usr.bin/tmux/cmd-display-panes.c
index 9983eaacd1f..abbcd501ab2 100644
--- a/usr.bin/tmux/cmd-display-panes.c
+++ b/usr.bin/tmux/cmd-display-panes.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-display-panes.c,v 1.4 2012/07/11 07:10:15 nicm Exp $ */
+/* $OpenBSD: cmd-display-panes.c,v 1.5 2013/03/24 09:27:19 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -42,7 +42,7 @@ cmd_display_panes_exec(struct cmd *self, struct cmd_ctx *ctx)
struct args *args = self->args;
struct client *c;
- if ((c = cmd_find_client(ctx, args_get(args, 't'))) == NULL)
+ if ((c = cmd_find_client(ctx, args_get(args, 't'), 0)) == NULL)
return (CMD_RETURN_ERROR);
server_set_identify(c);
diff --git a/usr.bin/tmux/cmd-lock-server.c b/usr.bin/tmux/cmd-lock-server.c
index f899b974efe..3ddbfd5956d 100644
--- a/usr.bin/tmux/cmd-lock-server.c
+++ b/usr.bin/tmux/cmd-lock-server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-lock-server.c,v 1.12 2013/03/22 10:31:22 nicm Exp $ */
+/* $OpenBSD: cmd-lock-server.c,v 1.13 2013/03/24 09:27:19 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -74,7 +74,7 @@ cmd_lock_server_exec(struct cmd *self, unused struct cmd_ctx *ctx)
return (CMD_RETURN_ERROR);
server_lock_session(s);
} else {
- if ((c = cmd_find_client(ctx, args_get(args, 't'))) == NULL)
+ if ((c = cmd_find_client(ctx, args_get(args, 't'), 0)) == NULL)
return (CMD_RETURN_ERROR);
server_lock_client(c);
}
diff --git a/usr.bin/tmux/cmd-new-window.c b/usr.bin/tmux/cmd-new-window.c
index 29d430d3b81..3d4a26acf7b 100644
--- a/usr.bin/tmux/cmd-new-window.c
+++ b/usr.bin/tmux/cmd-new-window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-new-window.c,v 1.29 2012/12/09 23:17:35 nicm Exp $ */
+/* $OpenBSD: cmd-new-window.c,v 1.30 2013/03/24 09:27:20 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -126,7 +126,7 @@ cmd_new_window_exec(struct cmd *self, struct cmd_ctx *ctx)
template = NEW_WINDOW_TEMPLATE;
ft = format_create();
- if ((c = cmd_find_client(ctx, NULL)) != NULL)
+ if ((c = cmd_find_client(ctx, NULL, 1)) != NULL)
format_client(ft, c);
format_session(ft, s);
format_winlink(ft, s, wl);
diff --git a/usr.bin/tmux/cmd-pipe-pane.c b/usr.bin/tmux/cmd-pipe-pane.c
index 1078f233d18..217a02a5cdb 100644
--- a/usr.bin/tmux/cmd-pipe-pane.c
+++ b/usr.bin/tmux/cmd-pipe-pane.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-pipe-pane.c,v 1.23 2013/03/22 10:31:22 nicm Exp $ */
+/* $OpenBSD: cmd-pipe-pane.c,v 1.24 2013/03/24 09:27:20 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -57,7 +57,7 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
if (cmd_find_pane(ctx, args_get(args, 't'), NULL, &wp) == NULL)
return (CMD_RETURN_ERROR);
- c = cmd_find_client(ctx, NULL);
+ c = cmd_find_client(ctx, NULL, 1);
/* Destroy the old pipe. */
old_fd = wp->pipe_fd;
diff --git a/usr.bin/tmux/cmd-refresh-client.c b/usr.bin/tmux/cmd-refresh-client.c
index 57f985e3086..3a3c4bfec7c 100644
--- a/usr.bin/tmux/cmd-refresh-client.c
+++ b/usr.bin/tmux/cmd-refresh-client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-refresh-client.c,v 1.8 2013/03/21 16:49:37 nicm Exp $ */
+/* $OpenBSD: cmd-refresh-client.c,v 1.9 2013/03/24 09:27:20 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -44,7 +44,7 @@ cmd_refresh_client_exec(struct cmd *self, struct cmd_ctx *ctx)
const char *size;
u_int w, h;
- if ((c = cmd_find_client(ctx, args_get(args, 't'))) == NULL)
+ if ((c = cmd_find_client(ctx, args_get(args, 't'), 0)) == NULL)
return (CMD_RETURN_ERROR);
if (args_has(args, 'C')) {
diff --git a/usr.bin/tmux/cmd-show-messages.c b/usr.bin/tmux/cmd-show-messages.c
index 38b3277e7e1..6f9cd3521ea 100644
--- a/usr.bin/tmux/cmd-show-messages.c
+++ b/usr.bin/tmux/cmd-show-messages.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-show-messages.c,v 1.4 2012/07/11 07:10:15 nicm Exp $ */
+/* $OpenBSD: cmd-show-messages.c,v 1.5 2013/03/24 09:27:20 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -48,7 +48,7 @@ cmd_show_messages_exec(struct cmd *self, struct cmd_ctx *ctx)
char *tim;
u_int i;
- if ((c = cmd_find_client(ctx, args_get(args, 't'))) == NULL)
+ if ((c = cmd_find_client(ctx, args_get(args, 't'), 0)) == NULL)
return (CMD_RETURN_ERROR);
for (i = 0; i < ARRAY_LENGTH(&c->message_log); i++) {
diff --git a/usr.bin/tmux/cmd-split-window.c b/usr.bin/tmux/cmd-split-window.c
index b492e30767f..26810dc03d4 100644
--- a/usr.bin/tmux/cmd-split-window.c
+++ b/usr.bin/tmux/cmd-split-window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-split-window.c,v 1.38 2013/03/24 09:21:27 nicm Exp $ */
+/* $OpenBSD: cmd-split-window.c,v 1.39 2013/03/24 09:27:20 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -152,7 +152,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx)
template = SPLIT_WINDOW_TEMPLATE;
ft = format_create();
- if ((c = cmd_find_client(ctx, NULL)) != NULL)
+ if ((c = cmd_find_client(ctx, NULL, 1)) != NULL)
format_client(ft, c);
format_session(ft, s);
format_winlink(ft, s, wl);
diff --git a/usr.bin/tmux/cmd-suspend-client.c b/usr.bin/tmux/cmd-suspend-client.c
index 57ba537c283..1641558cd2d 100644
--- a/usr.bin/tmux/cmd-suspend-client.c
+++ b/usr.bin/tmux/cmd-suspend-client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-suspend-client.c,v 1.7 2012/07/11 07:10:15 nicm Exp $ */
+/* $OpenBSD: cmd-suspend-client.c,v 1.8 2013/03/24 09:27:20 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -45,7 +45,7 @@ cmd_suspend_client_exec(struct cmd *self, struct cmd_ctx *ctx)
struct args *args = self->args;
struct client *c;
- if ((c = cmd_find_client(ctx, args_get(args, 't'))) == NULL)
+ if ((c = cmd_find_client(ctx, args_get(args, 't'), 0)) == NULL)
return (CMD_RETURN_ERROR);
tty_stop_tty(&c->tty);
diff --git a/usr.bin/tmux/cmd-switch-client.c b/usr.bin/tmux/cmd-switch-client.c
index 2a1e07ba74f..f015c508f45 100644
--- a/usr.bin/tmux/cmd-switch-client.c
+++ b/usr.bin/tmux/cmd-switch-client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-switch-client.c,v 1.15 2012/07/11 07:10:15 nicm Exp $ */
+/* $OpenBSD: cmd-switch-client.c,v 1.16 2013/03/24 09:27:20 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -64,7 +64,7 @@ cmd_switch_client_exec(struct cmd *self, struct cmd_ctx *ctx)
struct client *c;
struct session *s;
- if ((c = cmd_find_client(ctx, args_get(args, 'c'))) == NULL)
+ if ((c = cmd_find_client(ctx, args_get(args, 'c'), 0)) == NULL)
return (CMD_RETURN_ERROR);
if (args_has(args, 'r')) {
diff --git a/usr.bin/tmux/cmd.c b/usr.bin/tmux/cmd.c
index fa921129db7..fa400c8bb33 100644
--- a/usr.bin/tmux/cmd.c
+++ b/usr.bin/tmux/cmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd.c,v 1.78 2013/03/22 15:54:29 nicm Exp $ */
+/* $OpenBSD: cmd.c,v 1.79 2013/03/24 09:27:20 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -517,15 +517,19 @@ cmd_choose_client(struct clients *cc)
/* Find the target client or report an error and return NULL. */
struct client *
-cmd_find_client(struct cmd_ctx *ctx, const char *arg)
+cmd_find_client(struct cmd_ctx *ctx, const char *arg, int quiet)
{
struct client *c;
char *tmparg;
size_t arglen;
/* A NULL argument means the current client. */
- if (arg == NULL)
- return (cmd_current_client(ctx));
+ if (arg == NULL) {
+ c = cmd_current_client(ctx);
+ if (c == NULL && !quiet)
+ ctx->error(ctx, "no clients");
+ return (c);
+ }
tmparg = xstrdup(arg);
/* Trim a single trailing colon if any. */
@@ -537,7 +541,7 @@ cmd_find_client(struct cmd_ctx *ctx, const char *arg)
c = cmd_lookup_client(tmparg);
/* If no client found, report an error. */
- if (c == NULL)
+ if (c == NULL && !quiet)
ctx->error(ctx, "client not found: %s", tmparg);
free(tmparg);
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index 3f69da4fd13..7cace64adb8 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.394 2013/03/24 09:25:04 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.395 2013/03/24 09:27:20 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -1732,7 +1732,7 @@ struct cmd *cmd_parse(int, char **, char **);
size_t cmd_print(struct cmd *, char *, size_t);
struct session *cmd_current_session(struct cmd_ctx *, int);
struct client *cmd_current_client(struct cmd_ctx *);
-struct client *cmd_find_client(struct cmd_ctx *, const char *);
+struct client *cmd_find_client(struct cmd_ctx *, const char *, int);
struct session *cmd_find_session(struct cmd_ctx *, const char *, int);
struct winlink *cmd_find_window(
struct cmd_ctx *, const char *, struct session **);