]> code.citadel.org Git - citadel.git/blobdiff - citadel/whobbs.c
* Variable names, comments, documentation, etc... removed the acronym 'BBS'
[citadel.git] / citadel / whobbs.c
index 917189a2b2bc410fe0f5064e373658403af8fb65..82d9f0d26716c33ecb0b001972172cb1965da003 100644 (file)
@@ -10,6 +10,7 @@
 #include <unistd.h>
 #include <stdio.h>
 #include <string.h>
+#include <errno.h>
 #include "citadel.h"
 #include "citadel_ipc.h"
 #include "tools.h"
@@ -59,7 +60,6 @@ int main(int argc, char **argv)
        int r;                  /* IPC response code */
        time_t timenow;
        char *listing = NULL;
-       struct CtdlServInfo serv_info;
        CtdlIPC *ipc = NULL;
 
        /* If this environment variable is set, we assume that the program
@@ -73,16 +73,16 @@ int main(int argc, char **argv)
                fprintf(stderr, "Server not available: %s\n", strerror(errno));
                logoff(errno);
        }
-       CtdlIPC_getline(ipc, buf);
+       CtdlIPC_chat_recv(ipc, buf);
        if ((buf[0]!='2')&&(strncmp(buf,"551",3))) {
                fprintf(stderr,"%s: %s\n",argv[0],&buf[4]);
                logoff(atoi(buf));
                }
-       strcpy(nodetitle, "this BBS");
-       r = CtdlIPCServerInfo(ipc, &serv_info, buf);
+       strcpy(nodetitle, "this Citadel site");
+       r = CtdlIPCServerInfo(ipc, buf);
        if (r / 100 == 1) {
-               my_pid = serv_info.serv_pid;
-               strcpy(nodetitle, serv_info.serv_humannode);
+               my_pid = ipc->ServInfo.pid;
+               strcpy(nodetitle, ipc->ServInfo.humannode);
        }
        
        if (www) {
@@ -128,17 +128,17 @@ int main(int argc, char **argv)
 
 
        while (strlen(listing) > 0) {
-               extract_token(buf, listing, 0, '\n');
+               extract_token(buf, listing, 0, '\n', sizeof buf);
                remove_token(listing, 0, '\n');
 
                /* Escape some stuff if we're using www mode */
                if (www) escapize(buf, sizeof buf);
 
                s_pid = extract_int(buf,0);
-               extract(s_user,buf,1);
-               extract(s_room,buf,2);
-               extract(s_host,buf,3);
-               extract(s_client,buf,4);
+               extract_token(s_user, buf, 1, '|', sizeof s_user);
+               extract_token(s_room, buf, 2, '|', sizeof s_room);
+               extract_token(s_host, buf, 3, '|', sizeof s_host);
+               extract_token(s_client, buf, 4, '|', sizeof s_client);
                if (s_pid != my_pid) {
 
                        if (www) printf("<TR><TD>");