static void mate_notify_message(struct client *c, int join) { char buf[100]; int count; static int multi_client; count = num_clients(); if (count > 1) multi_client = 1; if (multi_client) sprintf(buf, " -- %d mate%s %sconnected", count, count == 1 ? " is" : "s are", (join || !count) ? "" : "still "); tmate_notify("%s mate has %s the session (%s)%s", multi_client ? "A" : "Your", join ? "joined" : "left", c->ip_address, multi_client ? buf : ""); }
int num_clients(Node *head){ if(head == NULL) return 0; return 1 + num_clients(head->next); }