4 * Command-line user list utility.
13 #if TIME_WITH_SYS_TIME
14 # include <sys/time.h>
18 # include <sys/time.h>
26 #include "citadel_ipc.h"
34 void userlist(CtdlIPC *ipc) {
42 r = CtdlIPCUserListing(ipc, "", &listing, buf);
47 printf(" User Name Num L LastCall Calls Posts\n");
48 printf("------------------------- ----- - ---------- ----- -----\n");
49 while (strlen(listing) > 0) {
50 extract_token(buf, listing, 0, '\n', sizeof buf);
51 remove_token(listing, 0, '\n');
52 extract_token(fl, buf, 0, '|', sizeof fl);
54 printf("%5ld %d ", extract_long(buf,2),
56 lc = extract_long(buf,3);
57 localtime_r(&lc, &tmbuf);
58 printf("%02d/%02d/%04d ",
61 (tmbuf.tm_year + 1900));
63 extract_long(buf,4),extract_long(buf,5));
69 int main(int argc, char **argv)
72 char hostbuf[SIZ], portbuf[SIZ];
75 CtdlInitBase64Table();
76 ipc = CtdlIPC_new(argc, argv, hostbuf, portbuf);
77 CtdlIPC_chat_recv(ipc, buf);
78 if ((buf[0]!='2')&&(strncmp(buf,"551",3))) {
79 fprintf(stderr,"%s: %s\n",argv[0],&buf[4]);
92 * replacement strerror() for systems that don't have it
98 snprintf(buf, sizeof buf, "errno = %d",e);