]> code.citadel.org Git - citadel.git/blobdiff - citadel/userlist.c
* extract_token() now expects to be supplied with the size of the
[citadel.git] / citadel / userlist.c
index 9c23f189133d0bc3a1cd970c5e87a7ff7f99e41e..59a398d7999843eb238a50e94d514e9335c9e04e 100644 (file)
@@ -34,7 +34,7 @@ void logoff(int code)
 void userlist(CtdlIPC *ipc) { 
        char buf[SIZ];
        char fl[SIZ];
-       struct tm *tmbuf;
+       struct tm tmbuf;
        time_t lc;
        char *listing = NULL;
        int r;
@@ -47,18 +47,18 @@ void userlist(CtdlIPC *ipc) {
        printf("       User Name           Num  L  LastCall  Calls Posts\n");
        printf("------------------------- ----- - ---------- ----- -----\n");
        while (strlen(listing) > 0) {
-               extract_token(buf, listing, 0, '\n');
+               extract_token(buf, listing, 0, '\n', sizeof buf);
                remove_token(listing, 0, '\n');
-               extract(fl,buf,0);
+               extract_token(fl, buf, 0, '|', sizeof fl);
                printf("%-25s ",fl);
-               printf("%5ld %d ",extract_long(buf,2),
+               printf("%5ld %d ", extract_long(buf,2),
                        extract_int(buf,1));
                lc = extract_long(buf,3);
-               tmbuf = (struct tm *)localtime(&lc);
+               localtime_r(&lc, &tmbuf);
                printf("%02d/%02d/%04d ",
-                       (tmbuf->tm_mon+1),
-                       tmbuf->tm_mday,
-                       (tmbuf->tm_year + 1900));
+                       (tmbuf.tm_mon+1),
+                       tmbuf.tm_mday,
+                       (tmbuf.tm_year + 1900));
                printf("%5ld %5ld\n",
                        extract_long(buf,4),extract_long(buf,5));
        }