Another win for short circuit evaluation
[citadel] / ctdlsh / who.c
index 5fd3cf9..8cfb4b4 100644 (file)
@@ -8,36 +8,37 @@
 #include "ctdlsh.h"
 
 
-int cmd_who(int server_socket, char *cmdbuf) {
+int cmd_who(int server_socket, char *cmdbuf)
+{
        char buf[1024];
        char *t = NULL;
 
-        sock_puts(server_socket, "RWHO");
-        sock_getln(server_socket, buf, sizeof buf);
-        printf("%s\n", &buf[4]);
+       sock_puts(server_socket, "RWHO");
+       sock_getln(server_socket, buf, sizeof buf);
+       printf("%s\n", &buf[4]);
        if (buf[0] != '1') {
-               return(cmdret_error);
+               return (cmdret_error);
        }
 
-       printf( "Session         User name               Room                  From host\n");
-       printf( "------- ------------------------- ------------------- ------------------------\n");
+       printf("Session         User name               Room                  From host\n");
+       printf("------- ------------------------- ------------------- ------------------------\n");
 
-        while (sock_getln(server_socket, buf, sizeof buf), strcmp(buf, "000")) {
+       while (sock_getln(server_socket, buf, sizeof buf), strcmp(buf, "000")) {
 
 //7872|Dampfklon| |p5DE44943.dip.t-dialin.net||1330016445|CHEK|.||||1
 
-               t = strtok(buf, "|");           /* session number */
+               t = strtok(buf, "|");   /* session number */
                printf("%-7d ", atoi(t));
 
                t = strtok(NULL, "|");
-               printf("%-26s", t);             /* user name */
+               printf("%-26s", t);     /* user name */
 
-               t = strtok(NULL, "|");          /* room name */
+               t = strtok(NULL, "|");  /* room name */
                printf("%-19s ", t);
 
-               t = strtok(NULL, "|");          /* from host */
+               t = strtok(NULL, "|");  /* from host */
                printf("%-24s\n", t);
        }
 
-        return(cmdret_ok);
+       return (cmdret_ok);
 }