version 1.8, 2011/01/04 00:42:46 |
version 1.9, 2011/03/29 19:30:16 |
|
|
|
|
const struct cmd_entry cmd_display_message_entry = { |
const struct cmd_entry cmd_display_message_entry = { |
"display-message", "display", |
"display-message", "display", |
"pt:", 0, 1, |
"c:pt:", 0, 1, |
"[-p] " CMD_TARGET_CLIENT_USAGE " [message]", |
"[-p] [-c target-client] [-t target-pane] [message]", |
0, |
0, |
NULL, |
NULL, |
NULL, |
NULL, |
|
|
{ |
{ |
struct args *args = self->args; |
struct args *args = self->args; |
struct client *c; |
struct client *c; |
|
struct session *s; |
|
struct winlink *wl; |
|
struct window_pane *wp; |
const char *template; |
const char *template; |
char *msg; |
char *msg; |
|
|
if ((c = cmd_find_client(ctx, args_get(args, 't'))) == NULL) |
if ((c = cmd_find_client(ctx, args_get(args, 'c'))) == NULL) |
return (-1); |
return (-1); |
|
|
|
if (args_has(args, 't') != NULL) { |
|
wl = cmd_find_pane(ctx, args_get(args, 't'), &s, &wp); |
|
if (wl == NULL) |
|
return (-1); |
|
} else { |
|
s = NULL; |
|
wl = NULL; |
|
wp = NULL; |
|
} |
|
|
if (args->argc == 0) |
if (args->argc == 0) |
template = "[#S] #I:#W, current pane #P - (%H:%M %d-%b-%y)"; |
template = "[#S] #I:#W, current pane #P - (%H:%M %d-%b-%y)"; |
else |
else |
template = args->argv[0]; |
template = args->argv[0]; |
|
|
msg = status_replace(c, NULL, template, time(NULL), 0); |
msg = status_replace(c, s, wl, wp, template, time(NULL), 0); |
if (args_has(self->args, 'p')) |
if (args_has(self->args, 'p')) |
ctx->print(ctx, "%s", msg); |
ctx->print(ctx, "%s", msg); |
else |
else |