summaryrefslogtreecommitdiffstats
path: root/cmd-has-session.c
diff options
context:
space:
mode:
authornicm <nicm>2008-06-02 21:08:36 +0000
committernicm <nicm>2008-06-02 21:08:36 +0000
commitb5ae4fba0fdc5edb3e81be98b528243a745aff4a (patch)
tree1172209f7c1de7634f34be5f9087fe2b7d1fd4cd /cmd-has-session.c
parent195f66e80d4be7f31587217ae28351e1ba53b995 (diff)
downloadtmux-old-b5ae4fba0fdc5edb3e81be98b528243a745aff4a.tar.gz
tmux-old-b5ae4fba0fdc5edb3e81be98b528243a745aff4a.tar.bz2
tmux-old-b5ae4fba0fdc5edb3e81be98b528243a745aff4a.zip
Last bits of basic configuration file. By default in ~/.tmux.conf or specified with -f. Just a list of tmux commands executed when the server is started and before and any session/window is created.
Diffstat (limited to 'cmd-has-session.c')
-rw-r--r--cmd-has-session.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/cmd-has-session.c b/cmd-has-session.c
index e4a178e5..40be25f3 100644
--- a/cmd-has-session.c
+++ b/cmd-has-session.c
@@ -24,27 +24,30 @@
#include "tmux.h"
/*
- * Cause client to exit with 0 if session exists, or 1 if it doesn't. This
- * is handled in the caller since this doesn't have flag CMD_NOSESSION, so
- * all that is necessary is to exit.
+ * Cause client to report an error and exit with 1 if session doesn't exist.
*/
void cmd_has_session_exec(void *, struct cmd_ctx *);
const struct cmd_entry cmd_has_session_entry = {
"has-session", "has",
- "",
+ CMD_SESSIONONLY_USAGE,
0,
- NULL,
+ cmd_sessiononly_parse,
cmd_has_session_exec,
- NULL,
- NULL,
- NULL
+ cmd_sessiononly_send,
+ cmd_sessiononly_recv,
+ cmd_sessiononly_free
};
void
-cmd_has_session_exec(unused void *ptr, struct cmd_ctx *ctx)
+cmd_has_session_exec(void *ptr, struct cmd_ctx *ctx)
{
+ struct session *s;
+
+ if ((s = cmd_sessiononly_get(ptr, ctx)) == NULL)
+ return;
+
if (ctx->cmdclient != NULL)
server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0);
}