2 * Command-line user list utility.
11 #if TIME_WITH_SYS_TIME
12 # include <sys/time.h>
16 # include <sys/time.h>
22 #include <libcitadel.h>
25 #include "citadel_ipc.h"
26 #include "citadel_dirs.h"
33 void userlist(CtdlIPC *ipc) {
41 r = CtdlIPCUserListing(ipc, "", &listing, buf);
46 printf(" User Name Num L Last Visit Logins Messages\n");
47 printf("------------------------- ----- - ---------- ------ --------\n");
48 while (strlen(listing) > 0) {
49 extract_token(buf, listing, 0, '\n', sizeof buf);
50 remove_token(listing, 0, '\n');
51 extract_token(fl, buf, 0, '|', sizeof fl);
53 printf("%5ld %d ", extract_long(buf,2),
55 lc = extract_long(buf,3);
56 localtime_r(&lc, &tmbuf);
57 printf("%02d/%02d/%04d ",
60 (tmbuf.tm_year + 1900));
62 extract_long(buf,4),extract_long(buf,5));
68 int main(int argc, char **argv)
71 char hostbuf[SIZ], portbuf[SIZ];
75 char relhome[PATH_MAX]="";
76 char ctdldir[PATH_MAX]=CTDLDIR;
78 calc_dirs_n_files(relh, home, relhome, ctdldir, 0);
80 ipc = CtdlIPC_new(argc, argv, hostbuf, portbuf);
81 CtdlIPC_chat_recv(ipc, buf);
82 if ((buf[0]!='2')&&(strncmp(buf,"551",3))) {
83 fprintf(stderr,"%s: %s\n",argv[0],&buf[4]);
96 * replacement strerror() for systems that don't have it
102 snprintf(buf, sizeof buf, "errno = %d",e);
111 void stty_ctdl(int cmd) {