diff options
author | nicm <nicm> | 2017-05-29 20:37:30 +0000 |
---|---|---|
committer | nicm <nicm> | 2017-05-29 20:37:30 +0000 |
commit | 8a214b2f8e57be9b55c091ebc707a05a176f3eaa (patch) | |
tree | e80bf9b9515080fd48f59acd17bf0350bf8f5ac2 | |
parent | a2ace9da24491c46e704ce6120dcb7e6c9d21c20 (diff) |
Function to count clients.
-rw-r--r-- | server-client.c | 15 | ||||
-rw-r--r-- | tmux.h | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/server-client.c b/server-client.c index cfaf565b..18e9d935 100644 --- a/server-client.c +++ b/server-client.c @@ -49,6 +49,21 @@ static void server_client_dispatch_command(struct client *, struct imsg *); static void server_client_dispatch_identify(struct client *, struct imsg *); static void server_client_dispatch_shell(struct client *); +/* Number of attached clients. */ +u_int +server_client_how_many(void) +{ + struct client *c; + u_int n; + + n = 0; + TAILQ_FOREACH(c, &clients, entry) { + if (c->session != NULL && (~c->flags & CLIENT_DETACHING)) + n++; + } + return (n); +} + /* Identify mode callback. */ static void server_client_callback_identify(__unused int fd, __unused short events, @@ -1836,6 +1836,7 @@ void server_update_socket(void); void server_add_accept(int); /* server-client.c */ +u_int server_client_how_many(void); void server_client_set_identify(struct client *); void server_client_clear_identify(struct client *, struct window_pane *); void server_client_set_key_table(struct client *, const char *); |