From f096ecba797fe2aeffd6330770e0c1a7440b5789 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Fri, 20 Jan 2012 14:45:53 -0500 Subject: [PATCH] Removed the obsolete 'whobbs' and 'userlist' utilities. --- citadel/Makefile.in | 20 +--- citadel/utils/userlist.c | 113 ---------------------- citadel/utils/whobbs.c | 201 --------------------------------------- 3 files changed, 4 insertions(+), 330 deletions(-) delete mode 100644 citadel/utils/userlist.c delete mode 100644 citadel/utils/whobbs.c diff --git a/citadel/Makefile.in b/citadel/Makefile.in index 6cfec7327..3e377d4f2 100644 --- a/citadel/Makefile.in +++ b/citadel/Makefile.in @@ -30,7 +30,7 @@ all: buildinfo $(TARGETS) EXEEXT=@EXEEXT@ -CLIENT_TARGETS=citadel$(EXEEXT) whobbs$(EXEEXT) +CLIENT_TARGETS=citadel$(EXEEXT) NOINST_TARGETS=stress$(EXEEXT) SERVER_TARGETS=citserver$(EXEEXT) SERV_MODULES= md5.o \ @@ -41,7 +41,7 @@ include Make_modules UTIL_TARGETS=citmail$(EXEEXT) sendcommand$(EXEEXT) UTILBIN_TARGETS= base64$(EXEEXT) setup$(EXEEXT) \ - chkpw$(EXEEXT) chkpwd$(EXEEXT) userlist$(EXEEXT) \ + chkpw$(EXEEXT) chkpwd$(EXEEXT) \ aidepost$(EXEEXT) msgform$(EXEEXT) \ ctdlmigrate$(EXEEXT) @@ -74,9 +74,9 @@ LOCALEDIR=@LOCALEDIR@ .SILENT: -SOURCES=utils/aidepost.c utils/stress.c utils/whobbs.c utils/citmail.c \ +SOURCES=utils/aidepost.c utils/stress.c utils/citmail.c \ utils/setup.c utils/msgform.c utils/chkpw.c \ - utils/sendcommand.c utils/userlist.c \ + utils/sendcommand.c \ utils/ctdlmigrate.c utils/base64.c utils/chkpwd.c \ utillib/citadel_ipc.c utillib/citadel_dirs.c utillib/ipc_c_tcp.c \ textclient/client_chat.c textclient/client_passwords.c \ @@ -192,12 +192,6 @@ chkpw$(EXEEXT): utils/chkpw.o auth.o utillib/citadel_dirs.o $(CC) utils/chkpw.o auth.o utillib/citadel_dirs.o \ $(LDFLAGS) -o chkpw$(EXEEXT) $(chkpwd_LIBS) -whobbs$(EXEEXT): utils/whobbs.o utillib/ipc_c_tcp.o utillib/citadel_ipc.o \ - utillib/citadel_dirs.o $(LIBOBJS) - $(CC) utils/whobbs.o utillib/ipc_c_tcp.o utillib/citadel_ipc.o \ - utillib/citadel_dirs.o $(LIBOBJS) \ - $(LDFLAGS) -o whobbs$(EXEEXT) $(LIBS) - stress$(EXEEXT): utils/stress.o utillib/ipc_c_tcp.o utillib/citadel_ipc.o \ utillib/citadel_dirs.o $(LIBOBJS) $(CC) utils/stress.o utillib/ipc_c_tcp.o utillib/citadel_ipc.o \ @@ -211,12 +205,6 @@ sendcommand$(EXEEXT): utils/sendcommand.o utillib/citadel_dirs.o $(LIBOBJS) base64$(EXEEXT): utils/base64.o $(CC) utils/base64.o $(LDFLAGS) -o base64$(EXEEXT) -userlist$(EXEEXT): utils/userlist.o utillib/ipc_c_tcp.o utillib/citadel_ipc.o \ - utillib/citadel_dirs.o $(LIBOBJS) - $(CC) utils/userlist.o utillib/ipc_c_tcp.o utillib/citadel_ipc.o \ - utillib/citadel_dirs.o \ - $(LIBOBJS) $(LDFLAGS) -o userlist$(EXEEXT) $(LIBS) - msgform$(EXEEXT): utils/msgform.o $(CC) utils/msgform.o $(LDFLAGS) -o msgform$(EXEEXT) diff --git a/citadel/utils/userlist.c b/citadel/utils/userlist.c deleted file mode 100644 index 1bf75973a..000000000 --- a/citadel/utils/userlist.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Command-line user list utility. - * - */ - -#include -#include -#include -#include - -#if TIME_WITH_SYS_TIME -# include -# include -#else -# if HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif - -#include -#include "citadel.h" -#include -#include "citadel_ipc.h" -#include "citadel_dirs.h" - -void logoff(int code) -{ - exit(code); -} - -void userlist(CtdlIPC *ipc) { - char buf[SIZ]; - char fl[SIZ]; - struct tm tmbuf; - time_t lc; - char *listing = NULL; - int r; - - r = CtdlIPCUserListing(ipc, "", &listing, buf); - if (r / 100 != 1) { - printf("%s\n", buf); - return; - } - printf(" User Name Num L Last Visit Logins Messages\n"); - printf("------------------------- ----- - ---------- ------ --------\n"); - while (strlen(listing) > 0) { - extract_token(buf, listing, 0, '\n', sizeof buf); - remove_token(listing, 0, '\n'); - extract_token(fl, buf, 0, '|', sizeof fl); - printf("%-25s ",fl); - printf("%5ld %d ", extract_long(buf,2), - extract_int(buf,1)); - lc = extract_long(buf,3); - localtime_r(&lc, &tmbuf); - printf("%02d/%02d/%04d ", - (tmbuf.tm_mon+1), - tmbuf.tm_mday, - (tmbuf.tm_year + 1900)); - printf("%6ld %8ld\n", - extract_long(buf,4),extract_long(buf,5)); - } - printf("\n"); -} - - -int main(int argc, char **argv) -{ - char buf[SIZ]; - char hostbuf[SIZ], portbuf[SIZ]; - CtdlIPC *ipc = NULL; - int relh=0; - int home=0; - char relhome[PATH_MAX]=""; - char ctdldir[PATH_MAX]=CTDLDIR; - - calc_dirs_n_files(relh, home, relhome, ctdldir, 0); - - ipc = CtdlIPC_new(argc, argv, hostbuf, portbuf); - 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)); - } - - userlist(ipc); - - CtdlIPCQuit(ipc); - exit(0); -} - - -#ifndef HAVE_STRERROR -/* - * replacement strerror() for systems that don't have it - */ -char *strerror(int e) -{ - static char buf[32]; - - snprintf(buf, sizeof buf, "errno = %d",e); - return(buf); -} -#endif - - -/* - * Stub function - */ -void stty_ctdl(int cmd) { -} - diff --git a/citadel/utils/whobbs.c b/citadel/utils/whobbs.c deleted file mode 100644 index 7d4901a29..000000000 --- a/citadel/utils/whobbs.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Command-line "who is online?" utility - * - */ - -#include "sysdep.h" -#include -#include -#include -#include -#include -#include -#include "citadel.h" -#include "citadel_ipc.h" -#include "citadel_dirs.h" - -void logoff(int code) -{ - exit(code); - } - -static void escapize(char *buf, size_t n) { - char hold[512]; - int i, len; - size_t tmp; - - strcpy(hold, buf); - strcpy(buf, ""); - tmp = 0; - len = strlen(hold); - for (i=0; i'){ - snprintf(&buf[tmp], n - tmp, ">"); - tmp += 4; - } - else if (hold[i]==34){ - snprintf(&buf[tmp], n - tmp, """); - tmp += 6; - } - else{ - snprintf(&buf[tmp], n - tmp, "%c", hold[i]); - tmp ++; - } - } -} - - - - -int main(int argc, char **argv) -{ - char buf[512]; - char nodetitle[SIZ]; - int www = 0; - int s_pid = 0; - int my_pid = 0; - char hostbuf[SIZ]; - char portbuf[SIZ]; - char s_user[SIZ]; - char s_room[SIZ]; - char s_host[SIZ]; - char s_client[SIZ]; - int r; /* IPC response code */ - time_t timenow; - char *listing = NULL; - CtdlIPC *ipc = NULL; - int relh=0; - int home=0; - char relhome[PATH_MAX]=""; - char ctdldir[PATH_MAX]=CTDLDIR; - - calc_dirs_n_files(relh, home, relhome, ctdldir, 0); - - /* If this environment variable is set, we assume that the program - * is being called as a cgi-bin from a webserver and will output - * everything as HTML. - */ - if (getenv("REQUEST_METHOD") != NULL) www = 1; - - ipc = CtdlIPC_new(argc, argv, hostbuf, portbuf); - if (!ipc) { - fprintf(stderr, "Server not available: %s\n", strerror(errno)); - logoff(errno); - } - 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 Citadel site"); - r = CtdlIPCServerInfo(ipc, buf); - if (r / 100 == 1) { - my_pid = ipc->ServInfo.pid; - strcpy(nodetitle, ipc->ServInfo.humannode); - } - - if (www) { - printf( "Content-type: text/html\n" - "\n" - "" - "\n" - ""); - printf("%s: who is online", nodetitle); - printf( "

"); - } else { - printf(" "); - } - - if (www) { - printf("

"); - } - - printf("Users currently logged on to %s\n", nodetitle); - - if (www) { - printf("

\n"); - } - - r = CtdlIPCOnlineUsers(ipc, &listing, &timenow, buf); - if (r / 100 != 1) { - fprintf(stderr,"%s: %s\n",argv[0], buf); - logoff(atoi(buf)); - } - - if (www) { - printf( "" - "" - "" - "\n"); - } else { - - printf( "Session User name " - "Room From host\n"); - printf( "------- ------------------------- " - "------------------- ------------------------\n"); - } - - - while (!IsEmptyStr(listing)) { - 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_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("\n", s_client); - } - } - free(listing); - - if (www) printf("
SessionUser nameRoomFrom hostClient software
"); - printf("%-7d", s_pid); - printf("%c", - ((s_pid == my_pid) ? '*' : ' ')); - if (www) printf(""); - printf("%-26s", s_user); - if (www) printf(""); - printf("%-19s ", s_room); - if (www) printf(""); - printf("%-24s\n", s_host); - if (www) printf("%s
\n" - "" - "(This display will automatically refresh " - "once per minute)\n" - "\n"); - - r = CtdlIPCQuit(ipc); - return (r / 100 == 2) ? 0 : r; -} - - -/* - * Stub function - */ -void stty_ctdl(int cmd) { -} - - -#ifndef HAVE_STRERROR -/* - * replacement strerror() for systems that don't have it - */ -char *strerror(int e) -{ - static char buf[32]; - - snprintf(buf, sizeof buf, "errno = %d",e); - return(buf); - } -#endif -- 2.30.2