From 8b537f8d15f353c4a1a97d18bf2aef0a045e6b29 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Fri, 2 Sep 2022 11:41:46 -0400 Subject: [PATCH] indent -kr -i8 -brf -bbb -fnc -l132 -nce --- textclient/citadel.c | 132 +++++++------- textclient/citadel_ipc.c | 318 +++++++++++++++------------------- textclient/client_chat.c | 32 ++-- textclient/client_passwords.c | 15 +- textclient/commands.c | 74 ++++---- textclient/ipc_c_tcp.c | 16 +- textclient/messages.c | 103 ++++++----- textclient/rooms.c | 121 ++++++------- textclient/routines.c | 69 ++++---- textclient/routines2.c | 43 ++--- textclient/tuiconfig.c | 18 +- 11 files changed, 440 insertions(+), 501 deletions(-) diff --git a/textclient/citadel.c b/textclient/citadel.c index 0bab0a566..16941d6a5 100644 --- a/textclient/citadel.c +++ b/textclient/citadel.c @@ -69,8 +69,7 @@ int enable_syslog = 0; /* * here is our 'clean up gracefully and exit' routine */ -void ctdl_logoff(char *file, int line, CtdlIPC * ipc, int code) -{ +void ctdl_logoff(char *file, int line, CtdlIPC * ipc, int code) { int lp; if (editor_pid > 0) { /* kill the editor if it's running */ @@ -119,8 +118,7 @@ void ctdl_logoff(char *file, int line, CtdlIPC * ipc, int code) /* * signal catching function for hangups... */ -void dropcarr(int signum) -{ +void dropcarr(int signum) { logoff(NULL, 3); /* No IPC when server's already gone! */ } @@ -130,8 +128,7 @@ void dropcarr(int signum) * catch SIGCONT to reset terminal modes when were are put back into the * foreground. */ -void catch_sigcont(int signum) -{ +void catch_sigcont(int signum) { stty_ctdl(SB_LAST); signal(SIGCONT, catch_sigcont); } @@ -140,8 +137,7 @@ void catch_sigcont(int signum) /* general purpose routines */ /* display a file */ -void formout(CtdlIPC * ipc, char *name) -{ +void formout(CtdlIPC * ipc, char *name) { int r; /* IPC return code */ char buf[SIZ]; char *text = NULL; @@ -251,8 +247,7 @@ void remove_march(char *roomname, int floornum) { * Locate the room on the march list which we most want to go to. Each room * is measured given a "weight" of preference based on various factors. */ -char *pop_march(int desired_floor, struct march *_march) -{ +char *pop_march(int desired_floor, struct march *_march) { static char TheRoom[ROOMNAMELEN]; int TheWeight = 0; int weight; @@ -284,8 +279,7 @@ char *pop_march(int desired_floor, struct march *_march) /* * jump directly to a room */ -void dotgoto(CtdlIPC * ipc, char *towhere, int display_name, int fromungoto) -{ +void dotgoto(CtdlIPC * ipc, char *towhere, int display_name, int fromungoto) { char aaa[SIZ], bbb[SIZ]; static long ls = 0L; int newmailcount = 0; @@ -307,7 +301,8 @@ void dotgoto(CtdlIPC * ipc, char *towhere, int display_name, int fromungoto) uglistlsn[lp] = uglistlsn[lp + 1]; } ugpos--; - } else { + } + else { uglistsize++; } @@ -382,16 +377,16 @@ void dotgoto(CtdlIPC * ipc, char *towhere, int display_name, int fromungoto) // Determine, based on the room's default view, whether an nter message command will be valid here. switch (room->RRdefaultview) { - case VIEW_BBS: - case VIEW_MAILBOX: - entmsg_ok = ENTMSG_OK_YES; - break; - case VIEW_BLOG: - entmsg_ok = ENTMSG_OK_BLOG; - break; - default: - entmsg_ok = ENTMSG_OK_NO; - break; + case VIEW_BBS: + case VIEW_MAILBOX: + entmsg_ok = ENTMSG_OK_YES; + break; + case VIEW_BLOG: + entmsg_ok = ENTMSG_OK_BLOG; + break; + default: + entmsg_ok = ENTMSG_OK_NO; + break; } remove_march(room_name, 0); @@ -481,7 +476,8 @@ void gotonext(CtdlIPC * ipc) { strcpy(mptr->march_name, "_BASEROOM_"); if (marchptr == NULL) { marchptr = mptr; - } else { + } + else { mptr2 = marchptr; while (mptr2->next != NULL) mptr2 = mptr2->next; @@ -505,7 +501,7 @@ void gotonext(CtdlIPC * ipc) { /* * forget all rooms on a given floor */ -void forget_all_rooms_on(CtdlIPC *ipc, int ffloor) { +void forget_all_rooms_on(CtdlIPC * ipc, int ffloor) { char buf[SIZ]; struct march *flist = NULL; struct march *fptr = NULL; @@ -540,8 +536,7 @@ void forget_all_rooms_on(CtdlIPC *ipc, int ffloor) { /* * routine called by gotofloor() to move to a new room on a new floor */ -void gf_toroom(CtdlIPC * ipc, char *towhere, int mode) -{ +void gf_toroom(CtdlIPC * ipc, char *towhere, int mode) { int floor_being_left; floor_being_left = curr_floor; @@ -549,10 +544,12 @@ void gf_toroom(CtdlIPC * ipc, char *towhere, int mode) if (mode == GF_GOTO) { /* <;G>oto mode */ updatels(ipc); dotgoto(ipc, towhere, 1, 0); - } else if (mode == GF_SKIP) { /* <;S>kip mode */ + } + else if (mode == GF_SKIP) { /* <;S>kip mode */ dotgoto(ipc, towhere, 1, 0); remove_march("_FLOOR_", floor_being_left); - } else if (mode == GF_ZAP) { /* <;Z>ap mode */ + } + else if (mode == GF_ZAP) { /* <;Z>ap mode */ dotgoto(ipc, towhere, 1, 0); remove_march("_FLOOR_", floor_being_left); forget_all_rooms_on(ipc, floor_being_left); @@ -563,8 +560,7 @@ void gf_toroom(CtdlIPC * ipc, char *towhere, int mode) /* * go to a new floor */ -void gotofloor(CtdlIPC * ipc, char *towhere, int mode) -{ +void gotofloor(CtdlIPC * ipc, char *towhere, int mode) { int a, tofloor; int r; /* IPC response code */ struct march *mptr; @@ -641,7 +637,8 @@ void gotofloor(CtdlIPC * ipc, char *towhere, int mode) } if (!IsEmptyStr(targ)) { gf_toroom(ipc, targ, mode); - } else { + } + else { scr_printf("There are no rooms on '%s'.\n", &floorlist[tofloor][0]); } } @@ -650,8 +647,7 @@ void gotofloor(CtdlIPC * ipc, char *towhere, int mode) /* * Indexing mechanism for a room list, called by gotoroomstep() */ -void room_tree_list_query(struct ctdlroomlisting *rp, char *findrmname, int findrmslot, char *rmname, int *rmslot, int *rmtotal) -{ +void room_tree_list_query(struct ctdlroomlisting *rp, char *findrmname, int findrmslot, char *rmname, int *rmslot, int *rmtotal) { char roomname[ROOMNAMELEN]; static int cur_rmslot = 0; @@ -695,8 +691,7 @@ void room_tree_list_query(struct ctdlroomlisting *rp, char *findrmname, int find /* * step through rooms on current floor */ -void gotoroomstep(CtdlIPC * ipc, int direction, int mode) -{ +void gotoroomstep(CtdlIPC * ipc, int direction, int mode) { struct march *listing = NULL; struct march *mptr; int r; /* IPC response code */ @@ -735,20 +730,24 @@ void gotoroomstep(CtdlIPC * ipc, int direction, int mode) rs = rl; if (rl == NULL) { rl = rp; - } else { + } + else { while (rp != NULL) { if (rordercmp(rp, rs) < 0) { if (rs->lnext == NULL) { rs->lnext = rp; rp = NULL; - } else { + } + else { rs = rs->lnext; } - } else { + } + else { if (rs->rnext == NULL) { rs->rnext = rp; rp = NULL; - } else { + } + else { rs = rs->rnext; } } @@ -770,7 +769,7 @@ void gotoroomstep(CtdlIPC * ipc, int direction, int mode) rmslot--; } } - else { /* Next room */ + else { /* Next room */ /* If we're at the last room, wrap to the first room */ if (rmslot == rmtotal - 1) { rmslot = 0; @@ -821,7 +820,8 @@ void gotofloorstep(CtdlIPC * ipc, int direction, int mode) { while (!floorlist[tofloor][0]) tofloor--; - } else { /* Next floor */ + } + else { /* Next floor */ if (curr_floor < 127) tofloor = curr_floor + 1; else @@ -849,8 +849,7 @@ void gotofloorstep(CtdlIPC * ipc, int direction, int mode) { * Display user 'preferences'. */ extern int rc_prompt_control; -void read_config(CtdlIPC * ipc) -{ +void read_config(CtdlIPC * ipc) { char buf[SIZ]; char *resp = NULL; int r; /* IPC response code */ @@ -949,8 +948,7 @@ void read_config(CtdlIPC * ipc) /* * Display system statistics. */ -void system_info(CtdlIPC * ipc) -{ +void system_info(CtdlIPC * ipc) { char buf[SIZ]; char *resp = NULL; size_t bytes; @@ -990,8 +988,7 @@ void system_info(CtdlIPC * ipc) /* * forget all rooms on current floor */ -void forget_this_floor(CtdlIPC * ipc) -{ +void forget_this_floor(CtdlIPC * ipc) { if (curr_floor == 0) { scr_printf("Can't forget this floor.\n"); return; @@ -1011,8 +1008,7 @@ void forget_this_floor(CtdlIPC * ipc) /* * set floor mode depending on client, server, and user settings */ -void set_floor_mode(CtdlIPC * ipc) -{ +void set_floor_mode(CtdlIPC * ipc) { if (ipc->ServInfo.ok_floors == 0) { floor_mode = 0; /* Don't use floors if the server */ } @@ -1033,8 +1029,7 @@ void set_floor_mode(CtdlIPC * ipc) /* * Set or change the user's password */ -int set_password(CtdlIPC * ipc) -{ +int set_password(CtdlIPC * ipc) { char pass1[20]; char pass2[20]; char buf[SIZ]; @@ -1042,7 +1037,8 @@ int set_password(CtdlIPC * ipc) if (!IsEmptyStr(rc_password)) { strcpy(pass1, rc_password); strcpy(pass2, rc_password); - } else { + } + else { IFNEXPERT formout(ipc, "changepw"); newprompt("Enter a new password: ", pass1, -19); newprompt("Enter it again to confirm: ", pass2, -19); @@ -1054,7 +1050,8 @@ int set_password(CtdlIPC * ipc) scr_printf("%s\n", buf); offer_to_remember_password(ipc, hostbuf, portbuf, fullname, pass1); return (0); - } else { + } + else { scr_printf("*** They don't match... try again.\n"); return (1); } @@ -1064,8 +1061,7 @@ int set_password(CtdlIPC * ipc) /* * get info about the server we've connected to */ -void get_serv_info(CtdlIPC * ipc, char *supplied_hostname) -{ +void get_serv_info(CtdlIPC * ipc, char *supplied_hostname) { char buf[SIZ]; CtdlIPCServerInfo(ipc, buf); @@ -1103,8 +1099,7 @@ void get_serv_info(CtdlIPC * ipc, char *supplied_hostname) /* * Session username compare function for SortOnlineUsers() */ -int rwho_username_cmp(const void *rec1, const void *rec2) -{ +int rwho_username_cmp(const void *rec1, const void *rec2) { char *u1, *u2; u1 = strchr(rec1, '|'); @@ -1117,8 +1112,7 @@ int rwho_username_cmp(const void *rec1, const void *rec2) /* * Idle time compare function for SortOnlineUsers() */ -int idlecmp(const void *rec1, const void *rec2) -{ +int idlecmp(const void *rec1, const void *rec2) { time_t i1, i2; i1 = extract_long(rec1, 5); @@ -1140,8 +1134,7 @@ int idlecmp(const void *rec1, const void *rec2) * If 'condense' is nonzero, multiple sessions for the same user will be * combined into one for brevity. */ -char *SortOnlineUsers(char *listing, int condense) -{ +char *SortOnlineUsers(char *listing, int condense) { int rows; char *sortbuf; char *retbuf; @@ -1206,8 +1199,7 @@ char *SortOnlineUsers(char *listing, int condense) /* * Display list of users currently logged on to the server */ -void who_is_online(CtdlIPC * ipc, int longlist) -{ +void who_is_online(CtdlIPC * ipc, int longlist) { char buf[SIZ], username[SIZ], roomname[SIZ], fromhost[SIZ]; char flags[SIZ]; char actual_user[SIZ], actual_room[SIZ], actual_host[SIZ]; @@ -1343,8 +1335,7 @@ void who_is_online(CtdlIPC * ipc, int longlist) } -void enternew(CtdlIPC * ipc, char *desc, char *buf, int maxlen) -{ +void enternew(CtdlIPC * ipc, char *desc, char *buf, int maxlen) { char bbb[128]; snprintf(bbb, sizeof bbb, "Enter in your new %s: ", desc); newprompt(bbb, buf, maxlen); @@ -1513,7 +1504,8 @@ int main(int argc, char **argv) { do { if (!IsEmptyStr(rc_username)) { strcpy(fullname, rc_username); - } else { + } + else { newprompt("Enter your name: ", fullname, 29); } strproc(fullname); @@ -1542,7 +1534,8 @@ int main(int argc, char **argv) { /* password authentication */ if (!IsEmptyStr(rc_password)) { strcpy(password, rc_password); - } else { + } + else { newprompt("\rPlease enter your password: ", password, -(SIZ - 1)); } @@ -1856,7 +1849,8 @@ int main(int argc, char **argv) { if (atoi(aaa)) { scr_printf ("The Citadel server will terminate when all users are logged off.\n"); - } else { + } + else { scr_printf("The Citadel server will not terminate.\n"); } } diff --git a/textclient/citadel_ipc.c b/textclient/citadel_ipc.c index 3853a7bbd..e5788ad4c 100644 --- a/textclient/citadel_ipc.c +++ b/textclient/citadel_ipc.c @@ -20,7 +20,7 @@ char rc_encrypt; #define INADDR_NONE 0xffffffff #endif -static void (*status_hook) (char *s) = NULL; +static void (*status_hook)(char *s) = NULL; char ctdl_autoetc_dir[PATH_MAX] = ""; char file_citadel_rc[PATH_MAX] = ""; char ctdl_run_dir[PATH_MAX] = ""; @@ -124,11 +124,11 @@ void calc_dirs_n_files(int relh, int home, const char *relhome, char *ctdldir, i DBG_PRINT(file_citadel_rc); } -void setCryptoStatusHook(void (*hook) (char *s)) { +void setCryptoStatusHook(void (*hook)(char *s)) { status_hook = hook; } -void CtdlIPC_SetNetworkStatusCallback(CtdlIPC * ipc, void (*hook) (int state)) { +void CtdlIPC_SetNetworkStatusCallback(CtdlIPC * ipc, void (*hook)(int state)) { ipc->network_status_cb = hook; } @@ -328,8 +328,11 @@ int CtdlIPCChangePassword(CtdlIPC * ipc, const char *passwd, char *cret) { /* LKRN */ + /* Caller must free the march list */ + /* Room types are defined in enum RoomList; keep these in sync! */ + /* floor is -1 for all, or floornum */ int CtdlIPCKnownRooms(CtdlIPC * ipc, enum RoomList which, int floor, struct march **listing, char *cret) { int ret; @@ -390,6 +393,7 @@ int CtdlIPCKnownRooms(CtdlIPC * ipc, enum RoomList which, int floor, struct marc /* GETU */ + /* Caller must free the struct ctdluser; caller may pass an existing one */ int CtdlIPCGetConfig(CtdlIPC * ipc, struct ctdluser **uret, char *cret) { int ret; @@ -464,7 +468,8 @@ int CtdlIPCGotoRoom(CtdlIPC * ipc, const char *room, const char *passwd, struct return -1; } sprintf(aaa, "GOTO %s|%s", room, passwd); - } else { + } + else { aaa = (char *) malloc(strlen(room) + 6); if (!aaa) { free(*rret); @@ -489,7 +494,8 @@ int CtdlIPCGotoRoom(CtdlIPC * ipc, const char *room, const char *passwd, struct rret[0]->RRdefaultview = extract_int(cret, 12); /* position 13 is a trash folder flag ... irrelevant in this client */ rret[0]->RRflags2 = extract_int(cret, 14); - } else { + } + else { free(*rret); *rret = NULL; } @@ -499,10 +505,11 @@ int CtdlIPCGotoRoom(CtdlIPC * ipc, const char *room, const char *passwd, struct /* MSGS */ + /* which is 0 = all, 1 = old, 2 = new, 3 = last, 4 = first, 5 = gt, 6 = lt */ + /* whicharg is number of messages, applies to last, first, gt, lt */ -int CtdlIPCGetMessages(CtdlIPC * ipc, enum MessageList which, int whicharg, const char *mtemplate, unsigned long **mret, char *cret) -{ +int CtdlIPCGetMessages(CtdlIPC * ipc, enum MessageList which, int whicharg, const char *mtemplate, unsigned long **mret, char *cret) { int ret; unsigned long count = 0; static char *proto[] = { "ALL", "OLD", "NEW", "LAST", "FIRST", "GT", "LT" }; @@ -539,7 +546,8 @@ int CtdlIPCGetMessages(CtdlIPC * ipc, enum MessageList which, int whicharg, cons if (*mret) { (*mret)[count++] = atol(aaa); (*mret)[count] = 0L; - } else { + } + else { break; } } @@ -550,8 +558,7 @@ int CtdlIPCGetMessages(CtdlIPC * ipc, enum MessageList which, int whicharg, cons /* MSG0, MSG2 */ -int CtdlIPCGetSingleMessage(CtdlIPC * ipc, long msgnum, int headers, int as_mime, struct ctdlipcmessage **mret, char *cret) -{ +int CtdlIPCGetSingleMessage(CtdlIPC * ipc, long msgnum, int headers, int as_mime, struct ctdlipcmessage **mret, char *cret) { int ret; char aaa[SIZ]; char *bbb = NULL; @@ -614,7 +621,8 @@ int CtdlIPCGetSingleMessage(CtdlIPC * ipc, long msgnum, int headers, int as_mime if (!strcasecmp(multipart_prefix, "multipart/alternative")) { ++multipart_hunting; } - } else if (!strncasecmp(aaa, "suff=", 5)) { + } + else if (!strncasecmp(aaa, "suff=", 5)) { extract_token(multipart_prefix, &aaa[5], 1, '|', sizeof multipart_prefix); if (!strcasecmp(multipart_prefix, "multipart/alternative")) { ++multipart_hunting; @@ -699,7 +707,8 @@ int CtdlIPCGetSingleMessage(CtdlIPC * ipc, long msgnum, int headers, int as_mime ccc = malloc(strlen(bbb) + 32768); if (!strcasecmp(encoding, "base64")) { bytes_decoded = CtdlDecodeBase64(ccc, bbb, strlen(bbb)); - } else if (!strcasecmp(encoding, "quoted-printable")) { + } + else if (!strcasecmp(encoding, "quoted-printable")) { bytes_decoded = CtdlDecodeQuotedPrintable(ccc, bbb, strlen(bbb)); } ccc[bytes_decoded] = 0; @@ -710,7 +719,8 @@ int CtdlIPCGetSingleMessage(CtdlIPC * ipc, long msgnum, int headers, int as_mime /* FIXME: Strip trailing whitespace */ bbb = (char *) realloc(bbb, (size_t) (strlen(bbb) + 1)); - } else { + } + else { bbb = (char *) realloc(bbb, 1); *bbb = '\0'; } @@ -721,8 +731,7 @@ int CtdlIPCGetSingleMessage(CtdlIPC * ipc, long msgnum, int headers, int as_mime /* WHOK */ -int CtdlIPCWhoKnowsRoom(CtdlIPC * ipc, char **listing, char *cret) -{ +int CtdlIPCWhoKnowsRoom(CtdlIPC * ipc, char **listing, char *cret) { int ret; size_t bytes; @@ -739,8 +748,7 @@ int CtdlIPCWhoKnowsRoom(CtdlIPC * ipc, char **listing, char *cret) /* INFO */ -int CtdlIPCServerInfo(CtdlIPC * ipc, char *cret) -{ +int CtdlIPCServerInfo(CtdlIPC * ipc, char *cret) { int ret; size_t bytes; char *listing = NULL; @@ -828,8 +836,7 @@ int CtdlIPCServerInfo(CtdlIPC * ipc, char *cret) /* RDIR */ -int CtdlIPCReadDirectory(CtdlIPC * ipc, char **listing, char *cret) -{ +int CtdlIPCReadDirectory(CtdlIPC * ipc, char **listing, char *cret) { int ret; size_t bytes; @@ -848,8 +855,7 @@ int CtdlIPCReadDirectory(CtdlIPC * ipc, char **listing, char *cret) /* * Set last-read pointer in this room to msgnum, or 0 for HIGHEST. */ -int CtdlIPCSetLastRead(CtdlIPC * ipc, long msgnum, char *cret) -{ +int CtdlIPCSetLastRead(CtdlIPC * ipc, long msgnum, char *cret) { int ret; char aaa[64]; @@ -858,7 +864,8 @@ int CtdlIPCSetLastRead(CtdlIPC * ipc, long msgnum, char *cret) if (msgnum) { sprintf(aaa, "SLRP %ld", msgnum); - } else { + } + else { sprintf(aaa, "SLRP HIGHEST"); } ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret); @@ -867,8 +874,7 @@ int CtdlIPCSetLastRead(CtdlIPC * ipc, long msgnum, char *cret) /* INVT */ -int CtdlIPCInviteUserToRoom(CtdlIPC * ipc, const char *username, char *cret) -{ +int CtdlIPCInviteUserToRoom(CtdlIPC * ipc, const char *username, char *cret) { int ret; char *aaa; @@ -889,8 +895,7 @@ int CtdlIPCInviteUserToRoom(CtdlIPC * ipc, const char *username, char *cret) /* KICK */ -int CtdlIPCKickoutUserFromRoom(CtdlIPC * ipc, const char *username, char *cret) -{ +int CtdlIPCKickoutUserFromRoom(CtdlIPC * ipc, const char *username, char *cret) { int ret; char *aaa; @@ -909,8 +914,7 @@ int CtdlIPCKickoutUserFromRoom(CtdlIPC * ipc, const char *username, char *cret) /* GETR */ -int CtdlIPCGetRoomAttributes(CtdlIPC * ipc, struct ctdlroom **qret, char *cret) -{ +int CtdlIPCGetRoomAttributes(CtdlIPC * ipc, struct ctdlroom **qret, char *cret) { int ret; if (!cret) @@ -938,11 +942,8 @@ int CtdlIPCGetRoomAttributes(CtdlIPC * ipc, struct ctdlroom **qret, char *cret) /* SETR */ -int CtdlIPCSetRoomAttributes(CtdlIPC *ipc, - int forget, // if nonzero, kick all users out of the room - struct ctdlroom *qret, - char *cret -) { +int CtdlIPCSetRoomAttributes(CtdlIPC * ipc, int forget, // if nonzero, kick all users out of the room + struct ctdlroom *qret, char *cret) { int ret; char *cmd; @@ -965,8 +966,7 @@ int CtdlIPCSetRoomAttributes(CtdlIPC *ipc, /* GETA */ -int CtdlIPCGetRoomAide(CtdlIPC *ipc, char *cret) -{ +int CtdlIPCGetRoomAide(CtdlIPC * ipc, char *cret) { if (!cret) return -1; @@ -975,7 +975,7 @@ int CtdlIPCGetRoomAide(CtdlIPC *ipc, char *cret) /* SETA */ -int CtdlIPCSetRoomAide(CtdlIPC *ipc, const char *username, char *cret) { +int CtdlIPCSetRoomAide(CtdlIPC * ipc, const char *username, char *cret) { int ret; char *aaa; @@ -996,8 +996,7 @@ int CtdlIPCSetRoomAide(CtdlIPC *ipc, const char *username, char *cret) { /* ENT0 */ -int CtdlIPCPostMessage(CtdlIPC * ipc, int flag, int *subject_required, struct ctdlipcmessage *mr, char *cret) -{ +int CtdlIPCPostMessage(CtdlIPC * ipc, int flag, int *subject_required, struct ctdlipcmessage *mr, char *cret) { int ret; char cmd[SIZ]; char *ptr; @@ -1095,8 +1094,7 @@ int CtdlIPCDeleteRoom(CtdlIPC * ipc, int for_real, char *cret) { /* CRE8 */ -int CtdlIPCCreateRoom(CtdlIPC * ipc, int for_real, const char *roomname, int type, const char *password, int floor, char *cret) -{ +int CtdlIPCCreateRoom(CtdlIPC * ipc, int for_real, const char *roomname, int type, const char *password, int floor, char *cret) { int ret; char *aaa; @@ -1159,7 +1157,7 @@ int CtdlIPCSystemMessage(CtdlIPC * ipc, const char *message, char **mret, char * /* GNUR */ -int CtdlIPCNextUnvalidatedUser(CtdlIPC *ipc, char *cret) { +int CtdlIPCNextUnvalidatedUser(CtdlIPC * ipc, char *cret) { if (!cret) return -2; @@ -1221,8 +1219,7 @@ int CtdlIPCValidateUser(CtdlIPC * ipc, const char *username, int axlevel, char * /* EINF */ -int CtdlIPCSetRoomInfo(CtdlIPC * ipc, int for_real, const char *info, char *cret) -{ +int CtdlIPCSetRoomInfo(CtdlIPC * ipc, int for_real, const char *info, char *cret) { char aaa[64]; if (!cret) @@ -1236,8 +1233,7 @@ int CtdlIPCSetRoomInfo(CtdlIPC * ipc, int for_real, const char *info, char *cret /* LIST */ -int CtdlIPCUserListing(CtdlIPC * ipc, char *searchstring, char **listing, char *cret) -{ +int CtdlIPCUserListing(CtdlIPC * ipc, char *searchstring, char **listing, char *cret) { size_t bytes; char *cmd; int ret; @@ -1261,8 +1257,7 @@ int CtdlIPCUserListing(CtdlIPC * ipc, char *searchstring, char **listing, char * /* REGI */ -int CtdlIPCSetRegistration(CtdlIPC * ipc, const char *info, char *cret) -{ +int CtdlIPCSetRegistration(CtdlIPC * ipc, const char *info, char *cret) { if (!cret) return -1; if (!info) @@ -1273,8 +1268,7 @@ int CtdlIPCSetRegistration(CtdlIPC * ipc, const char *info, char *cret) /* CHEK */ -int CtdlIPCMiscCheck(CtdlIPC * ipc, struct ctdlipcmisc *chek, char *cret) -{ +int CtdlIPCMiscCheck(CtdlIPC * ipc, struct ctdlipcmisc *chek, char *cret) { int ret; if (!cret) @@ -1293,8 +1287,7 @@ int CtdlIPCMiscCheck(CtdlIPC * ipc, struct ctdlipcmisc *chek, char *cret) /* DELF */ -int CtdlIPCDeleteFile(CtdlIPC * ipc, const char *filename, char *cret) -{ +int CtdlIPCDeleteFile(CtdlIPC * ipc, const char *filename, char *cret) { int ret; char *aaa; @@ -1315,8 +1308,7 @@ int CtdlIPCDeleteFile(CtdlIPC * ipc, const char *filename, char *cret) /* MOVF */ -int CtdlIPCMoveFile(CtdlIPC * ipc, const char *filename, const char *destroom, char *cret) -{ +int CtdlIPCMoveFile(CtdlIPC * ipc, const char *filename, const char *destroom, char *cret) { int ret; char *aaa; @@ -1339,8 +1331,7 @@ int CtdlIPCMoveFile(CtdlIPC * ipc, const char *filename, const char *destroom, c /* RWHO */ -int CtdlIPCOnlineUsers(CtdlIPC * ipc, char **listing, time_t * stamp, char *cret) -{ +int CtdlIPCOnlineUsers(CtdlIPC * ipc, char **listing, time_t * stamp, char *cret) { int ret; size_t bytes; @@ -1361,8 +1352,7 @@ int CtdlIPCOnlineUsers(CtdlIPC * ipc, char **listing, time_t * stamp, char *cret /* OPEN */ int CtdlIPCFileDownload(CtdlIPC * ipc, const char *filename, void **buf, size_t resume, void (*progress_gauge_callback) - (CtdlIPC *, unsigned long, unsigned long), char *cret) -{ + (CtdlIPC *, unsigned long, unsigned long), char *cret) { int ret; size_t bytes; time_t last_mod; @@ -1403,8 +1393,7 @@ int CtdlIPCFileDownload(CtdlIPC * ipc, const char *filename, void **buf, size_t /* OPNA */ int CtdlIPCAttachmentDownload(CtdlIPC * ipc, long msgnum, const char *part, void **buf, void (*progress_gauge_callback) - (CtdlIPC *, unsigned long, unsigned long), char *cret) -{ + (CtdlIPC *, unsigned long, unsigned long), char *cret) { int ret; size_t bytes; time_t last_mod; @@ -1445,8 +1434,7 @@ int CtdlIPCAttachmentDownload(CtdlIPC * ipc, long msgnum, const char *part, void /* OIMG */ int CtdlIPCImageDownload(CtdlIPC * ipc, const char *filename, void **buf, void (*progress_gauge_callback) - (CtdlIPC *, unsigned long, unsigned long), char *cret) -{ + (CtdlIPC *, unsigned long, unsigned long), char *cret) { int ret; size_t bytes; time_t last_mod; @@ -1476,6 +1464,7 @@ int CtdlIPCImageDownload(CtdlIPC * ipc, const char *filename, void **buf, void ( bytes = extract_long(cret, 0); last_mod = extract_int(cret, 1); extract_token(mimetype, cret, 2, '|', sizeof mimetype); + /* ret = CtdlIPCReadDownload(ipc, buf, bytes, 0, progress_gauge_callback, cret); */ ret = CtdlIPCHighSpeedReadDownload(ipc, buf, bytes, 0, progress_gauge_callback, cret); ret = CtdlIPCEndDownload(ipc, cret); @@ -1488,8 +1477,7 @@ int CtdlIPCImageDownload(CtdlIPC * ipc, const char *filename, void **buf, void ( /* UOPN */ int CtdlIPCFileUpload(CtdlIPC * ipc, const char *save_as, const char *comment, const char *path, void (*progress_gauge_callback) - (CtdlIPC *, unsigned long, unsigned long), char *cret) -{ + (CtdlIPC *, unsigned long, unsigned long), char *cret) { int ret; char *aaa; FILE *uploadFP; @@ -1539,8 +1527,7 @@ int CtdlIPCFileUpload(CtdlIPC * ipc, const char *save_as, const char *comment, c /* UIMG */ int CtdlIPCImageUpload(CtdlIPC * ipc, int for_real, const char *path, const char *save_as, void (*progress_gauge_callback) - (CtdlIPC *, unsigned long, unsigned long), char *cret) -{ + (CtdlIPC *, unsigned long, unsigned long), char *cret) { int ret; FILE *uploadFP; char *aaa; @@ -1587,8 +1574,7 @@ int CtdlIPCImageUpload(CtdlIPC * ipc, int for_real, const char *path, const char /* QUSR */ -int CtdlIPCQueryUsername(CtdlIPC * ipc, const char *username, char *cret) -{ +int CtdlIPCQueryUsername(CtdlIPC * ipc, const char *username, char *cret) { int ret; char *aaa; @@ -1609,8 +1595,7 @@ int CtdlIPCQueryUsername(CtdlIPC * ipc, const char *username, char *cret) /* LFLR */ -int CtdlIPCFloorListing(CtdlIPC * ipc, char **listing, char *cret) -{ +int CtdlIPCFloorListing(CtdlIPC * ipc, char **listing, char *cret) { size_t bytes; if (!cret) @@ -1625,8 +1610,7 @@ int CtdlIPCFloorListing(CtdlIPC * ipc, char **listing, char *cret) /* CFLR */ -int CtdlIPCCreateFloor(CtdlIPC * ipc, int for_real, const char *name, char *cret) -{ +int CtdlIPCCreateFloor(CtdlIPC * ipc, int for_real, const char *name, char *cret) { int ret; char aaa[SIZ]; @@ -1642,8 +1626,7 @@ int CtdlIPCCreateFloor(CtdlIPC * ipc, int for_real, const char *name, char *cret /* KFLR */ -int CtdlIPCDeleteFloor(CtdlIPC * ipc, int for_real, int floornum, char *cret) -{ +int CtdlIPCDeleteFloor(CtdlIPC * ipc, int for_real, int floornum, char *cret) { char aaa[SIZ]; if (!cret) @@ -1657,8 +1640,7 @@ int CtdlIPCDeleteFloor(CtdlIPC * ipc, int for_real, int floornum, char *cret) /* EFLR */ -int CtdlIPCEditFloor(CtdlIPC * ipc, int floornum, const char *floorname, char *cret) -{ +int CtdlIPCEditFloor(CtdlIPC * ipc, int floornum, const char *floorname, char *cret) { int ret; char aaa[SIZ]; @@ -1682,8 +1664,7 @@ int CtdlIPCEditFloor(CtdlIPC * ipc, int floornum, const char *floorname, char *c * other fields are not set properly. */ int CtdlIPCIdentifySoftware(CtdlIPC * ipc, int developerid, int clientid, - int revision, const char *software_name, const char *hostname, char *cret) -{ + int revision, const char *software_name, const char *hostname, char *cret) { int ret; char *aaa; @@ -1708,8 +1689,7 @@ int CtdlIPCIdentifySoftware(CtdlIPC * ipc, int developerid, int clientid, /* SEXP */ -int CtdlIPCSendInstantMessage(CtdlIPC * ipc, const char *username, const char *text, char *cret) -{ +int CtdlIPCSendInstantMessage(CtdlIPC * ipc, const char *username, const char *text, char *cret) { int ret; char *aaa; @@ -1725,7 +1705,8 @@ int CtdlIPCSendInstantMessage(CtdlIPC * ipc, const char *username, const char *t if (text) { sprintf(aaa, "SEXP %s|-", username); ret = CtdlIPCGenericCommand(ipc, aaa, text, strlen(text), NULL, NULL, cret); - } else { + } + else { sprintf(aaa, "SEXP %s||", username); ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret); } @@ -1735,8 +1716,7 @@ int CtdlIPCSendInstantMessage(CtdlIPC * ipc, const char *username, const char *t /* GEXP */ -int CtdlIPCGetInstantMessage(CtdlIPC * ipc, char **listing, char *cret) -{ +int CtdlIPCGetInstantMessage(CtdlIPC * ipc, char **listing, char *cret) { size_t bytes; if (!cret) @@ -1751,9 +1731,9 @@ int CtdlIPCGetInstantMessage(CtdlIPC * ipc, char **listing, char *cret) /* DEXP */ + /* mode is 0 = enable, 1 = disable, 2 = status */ -int CtdlIPCEnableInstantMessageReceipt(CtdlIPC * ipc, int mode, char *cret) -{ +int CtdlIPCEnableInstantMessageReceipt(CtdlIPC * ipc, int mode, char *cret) { char aaa[64]; if (!cret) @@ -1765,8 +1745,7 @@ int CtdlIPCEnableInstantMessageReceipt(CtdlIPC * ipc, int mode, char *cret) /* EBIO */ -int CtdlIPCSetBio(CtdlIPC * ipc, char *bio, char *cret) -{ +int CtdlIPCSetBio(CtdlIPC * ipc, char *bio, char *cret) { if (!cret) return -2; if (!bio) @@ -1777,8 +1756,7 @@ int CtdlIPCSetBio(CtdlIPC * ipc, char *bio, char *cret) /* RBIO */ -int CtdlIPCGetBio(CtdlIPC * ipc, const char *username, char **listing, char *cret) -{ +int CtdlIPCGetBio(CtdlIPC * ipc, const char *username, char **listing, char *cret) { int ret; size_t bytes; char *aaa; @@ -1804,8 +1782,7 @@ int CtdlIPCGetBio(CtdlIPC * ipc, const char *username, char **listing, char *cre /* LBIO */ -int CtdlIPCListUsersWithBios(CtdlIPC * ipc, char **listing, char *cret) -{ +int CtdlIPCListUsersWithBios(CtdlIPC * ipc, char **listing, char *cret) { size_t bytes; if (!cret) @@ -1820,8 +1797,7 @@ int CtdlIPCListUsersWithBios(CtdlIPC * ipc, char **listing, char *cret) /* STEL */ -int CtdlIPCStealthMode(CtdlIPC * ipc, int mode, char *cret) -{ +int CtdlIPCStealthMode(CtdlIPC * ipc, int mode, char *cret) { char aaa[64]; if (!cret) @@ -1833,8 +1809,7 @@ int CtdlIPCStealthMode(CtdlIPC * ipc, int mode, char *cret) /* TERM */ -int CtdlIPCTerminateSession(CtdlIPC * ipc, int sid, char *cret) -{ +int CtdlIPCTerminateSession(CtdlIPC * ipc, int sid, char *cret) { char aaa[64]; if (!cret) @@ -1846,8 +1821,7 @@ int CtdlIPCTerminateSession(CtdlIPC * ipc, int sid, char *cret) /* DOWN */ -int CtdlIPCTerminateServerNow(CtdlIPC * ipc, char *cret) -{ +int CtdlIPCTerminateServerNow(CtdlIPC * ipc, char *cret) { if (!cret) return -1; @@ -1856,8 +1830,7 @@ int CtdlIPCTerminateServerNow(CtdlIPC * ipc, char *cret) /* SCDN */ -int CtdlIPCTerminateServerScheduled(CtdlIPC * ipc, int mode, char *cret) -{ +int CtdlIPCTerminateServerScheduled(CtdlIPC * ipc, int mode, char *cret) { char aaa[16]; if (!cret) @@ -1869,8 +1842,7 @@ int CtdlIPCTerminateServerScheduled(CtdlIPC * ipc, int mode, char *cret) /* EMSG */ -int CtdlIPCEnterSystemMessage(CtdlIPC * ipc, const char *filename, const char *text, char *cret) -{ +int CtdlIPCEnterSystemMessage(CtdlIPC * ipc, const char *filename, const char *text, char *cret) { int ret; char *aaa; @@ -1893,16 +1865,17 @@ int CtdlIPCEnterSystemMessage(CtdlIPC * ipc, const char *filename, const char *t /* TIME */ + /* This function returns the actual server time reported, or 0 if error */ -time_t CtdlIPCServerTime(CtdlIPC * ipc, char *cret) -{ +time_t CtdlIPCServerTime(CtdlIPC * ipc, char *cret) { time_t tret; int ret; ret = CtdlIPCGenericCommand(ipc, "TIME", NULL, 0, NULL, NULL, cret); if (ret / 100 == 2) { tret = extract_long(cret, 0); - } else { + } + else { tret = 0L; } return tret; @@ -1910,8 +1883,7 @@ time_t CtdlIPCServerTime(CtdlIPC * ipc, char *cret) /* AGUP */ -int CtdlIPCAideGetUserParameters(CtdlIPC * ipc, const char *who, struct ctdluser **uret, char *cret) -{ +int CtdlIPCAideGetUserParameters(CtdlIPC * ipc, const char *who, struct ctdluser **uret, char *cret) { int ret; char aaa[SIZ]; @@ -1943,8 +1915,7 @@ int CtdlIPCAideGetUserParameters(CtdlIPC * ipc, const char *who, struct ctdluser /* ASUP */ -int CtdlIPCAideSetUserParameters(CtdlIPC * ipc, const struct ctdluser *uret, char *cret) -{ +int CtdlIPCAideSetUserParameters(CtdlIPC * ipc, const struct ctdluser *uret, char *cret) { int ret; char *aaa; @@ -1967,8 +1938,7 @@ int CtdlIPCAideSetUserParameters(CtdlIPC * ipc, const struct ctdluser *uret, cha /* AGEA */ -int CtdlIPCAideGetEmailAddresses(CtdlIPC * ipc, const char *who, char *target_buf, char *cret) -{ +int CtdlIPCAideGetEmailAddresses(CtdlIPC * ipc, const char *who, char *target_buf, char *cret) { int ret; char aaa[SIZ]; char *emailaddrs = NULL; @@ -1990,8 +1960,7 @@ int CtdlIPCAideGetEmailAddresses(CtdlIPC * ipc, const char *who, char *target_bu /* ASEA */ -int CtdlIPCAideSetEmailAddresses(CtdlIPC * ipc, const char *who, char *emailaddrs, char *cret) -{ +int CtdlIPCAideSetEmailAddresses(CtdlIPC * ipc, const char *who, char *emailaddrs, char *cret) { char aaa[SIZ]; int ret; @@ -2009,10 +1978,11 @@ int CtdlIPCAideSetEmailAddresses(CtdlIPC * ipc, const char *who, char *emailaddr /* GPEX */ + /* which is 0 = room, 1 = floor, 2 = site, 3 = default for mailboxes */ + /* caller must free the struct ExpirePolicy */ -int CtdlIPCGetMessageExpirationPolicy(CtdlIPC * ipc, GPEXWhichPolicy which, struct ExpirePolicy **policy, char *cret) -{ +int CtdlIPCGetMessageExpirationPolicy(CtdlIPC * ipc, GPEXWhichPolicy which, struct ExpirePolicy **policy, char *cret) { static char *proto[] = { strof(roompolicy), strof(floorpolicy), @@ -2044,10 +2014,11 @@ int CtdlIPCGetMessageExpirationPolicy(CtdlIPC * ipc, GPEXWhichPolicy which, stru /* SPEX */ + /* which is 0 = room, 1 = floor, 2 = site, 3 = default for mailboxes */ + /* policy is 0 = inherit, 1 = no purge, 2 = by count, 3 = by age (days) */ -int CtdlIPCSetMessageExpirationPolicy(CtdlIPC * ipc, int which, struct ExpirePolicy *policy, char *cret) -{ +int CtdlIPCSetMessageExpirationPolicy(CtdlIPC * ipc, int which, struct ExpirePolicy *policy, char *cret) { char aaa[38]; char *whichvals[] = { "room", "floor", "site", "mailboxes" }; @@ -2068,8 +2039,7 @@ int CtdlIPCSetMessageExpirationPolicy(CtdlIPC * ipc, int which, struct ExpirePol /* CONF GET */ -int CtdlIPCGetSystemConfig(CtdlIPC * ipc, char **listing, char *cret) -{ +int CtdlIPCGetSystemConfig(CtdlIPC * ipc, char **listing, char *cret) { size_t bytes; if (!cret) @@ -2084,8 +2054,7 @@ int CtdlIPCGetSystemConfig(CtdlIPC * ipc, char **listing, char *cret) /* CONF SET */ -int CtdlIPCSetSystemConfig(CtdlIPC * ipc, const char *listing, char *cret) -{ +int CtdlIPCSetSystemConfig(CtdlIPC * ipc, const char *listing, char *cret) { if (!cret) return -2; if (!listing) @@ -2096,8 +2065,7 @@ int CtdlIPCSetSystemConfig(CtdlIPC * ipc, const char *listing, char *cret) /* CONF GETSYS */ -int CtdlIPCGetSystemConfigByType(CtdlIPC * ipc, const char *mimetype, char **listing, char *cret) -{ +int CtdlIPCGetSystemConfigByType(CtdlIPC * ipc, const char *mimetype, char **listing, char *cret) { int ret; char *aaa; size_t bytes; @@ -2122,8 +2090,7 @@ int CtdlIPCGetSystemConfigByType(CtdlIPC * ipc, const char *mimetype, char **lis /* CONF PUTSYS */ -int CtdlIPCSetSystemConfigByType(CtdlIPC * ipc, const char *mimetype, const char *listing, char *cret) -{ +int CtdlIPCSetSystemConfigByType(CtdlIPC * ipc, const char *mimetype, const char *listing, char *cret) { int ret; char *aaa; @@ -2145,8 +2112,7 @@ int CtdlIPCSetSystemConfigByType(CtdlIPC * ipc, const char *mimetype, const char /* GNET */ -int CtdlIPCGetRoomNetworkConfig(CtdlIPC * ipc, char **listing, char *cret) -{ +int CtdlIPCGetRoomNetworkConfig(CtdlIPC * ipc, char **listing, char *cret) { size_t bytes; if (!cret) @@ -2161,8 +2127,7 @@ int CtdlIPCGetRoomNetworkConfig(CtdlIPC * ipc, char **listing, char *cret) /* SNET */ -int CtdlIPCSetRoomNetworkConfig(CtdlIPC * ipc, const char *listing, char *cret) -{ +int CtdlIPCSetRoomNetworkConfig(CtdlIPC * ipc, const char *listing, char *cret) { if (!cret) return -2; if (!listing) @@ -2173,8 +2138,7 @@ int CtdlIPCSetRoomNetworkConfig(CtdlIPC * ipc, const char *listing, char *cret) /* REQT */ -int CtdlIPCRequestClientLogout(CtdlIPC * ipc, int session, char *cret) -{ +int CtdlIPCRequestClientLogout(CtdlIPC * ipc, int session, char *cret) { char aaa[64]; if (!cret) @@ -2188,8 +2152,7 @@ int CtdlIPCRequestClientLogout(CtdlIPC * ipc, int session, char *cret) /* SEEN */ -int CtdlIPCSetMessageSeen(CtdlIPC * ipc, long msgnum, int seen, char *cret) -{ +int CtdlIPCSetMessageSeen(CtdlIPC * ipc, long msgnum, int seen, char *cret) { char aaa[27]; if (!cret) @@ -2203,8 +2166,7 @@ int CtdlIPCSetMessageSeen(CtdlIPC * ipc, long msgnum, int seen, char *cret) /* STLS */ -int CtdlIPCStartEncryption(CtdlIPC * ipc, char *cret) -{ +int CtdlIPCStartEncryption(CtdlIPC * ipc, char *cret) { int a; int r; char buf[SIZ]; @@ -2260,8 +2222,7 @@ int CtdlIPCStartEncryption(CtdlIPC * ipc, char *cret) #ifdef HAVE_OPENSSL -static void endtls(SSL * ssl) -{ +static void endtls(SSL * ssl) { if (ssl) { SSL_shutdown(ssl); SSL_free(ssl); @@ -2271,8 +2232,7 @@ static void endtls(SSL * ssl) /* QDIR */ -int CtdlIPCDirectoryLookup(CtdlIPC * ipc, const char *address, char *cret) -{ +int CtdlIPCDirectoryLookup(CtdlIPC * ipc, const char *address, char *cret) { int ret; char *aaa; @@ -2293,8 +2253,7 @@ int CtdlIPCDirectoryLookup(CtdlIPC * ipc, const char *address, char *cret) /* IPGM */ -int CtdlIPCInternalProgram(CtdlIPC * ipc, int secret, char *cret) -{ +int CtdlIPCInternalProgram(CtdlIPC * ipc, int secret, char *cret) { char aaa[30]; if (!cret) @@ -2307,13 +2266,14 @@ int CtdlIPCInternalProgram(CtdlIPC * ipc, int secret, char *cret) /* ************************************************************************** */ + /* Stuff below this line is not for public consumption */ + /* ************************************************************************** */ /* Read a listing from the server up to 000. Append to dest if it exists */ -char *CtdlIPCReadListing(CtdlIPC * ipc, char *dest) -{ +char *CtdlIPCReadListing(CtdlIPC * ipc, char *dest) { size_t length = 0; size_t linelength; char *ret = NULL; @@ -2322,7 +2282,8 @@ char *CtdlIPCReadListing(CtdlIPC * ipc, char *dest) ret = dest; if (ret != NULL) { length = strlen(ret); - } else { + } + else { length = 0; } @@ -2341,8 +2302,7 @@ char *CtdlIPCReadListing(CtdlIPC * ipc, char *dest) /* Send a listing to the server; generate the ending 000. */ -int CtdlIPCSendListing(CtdlIPC * ipc, const char *listing) -{ +int CtdlIPCSendListing(CtdlIPC * ipc, const char *listing) { char *text; text = (char *) malloc(strlen(listing) + 6); @@ -2354,7 +2314,8 @@ int CtdlIPCSendListing(CtdlIPC * ipc, const char *listing) CtdlIPC_putline(ipc, text); free(text); text = NULL; - } else { + } + else { /* Malloc failed but we are committed to send */ /* This may result in extra blanks at the bottom */ CtdlIPC_putline(ipc, text); @@ -2365,8 +2326,7 @@ int CtdlIPCSendListing(CtdlIPC * ipc, const char *listing) /* Partial read of file from server */ -size_t CtdlIPCPartialRead(CtdlIPC * ipc, void **buf, size_t offset, size_t bytes, char *cret) -{ +size_t CtdlIPCPartialRead(CtdlIPC * ipc, void **buf, size_t offset, size_t bytes, char *cret) { size_t len = 0; char aaa[SIZ]; @@ -2389,7 +2349,8 @@ size_t CtdlIPCPartialRead(CtdlIPC * ipc, void **buf, size_t offset, size_t bytes if (*buf) { /* I know what I'm doing */ serv_read(ipc, ((char *) (*buf) + offset), len); - } else { + } + else { /* We have to read regardless */ serv_read(ipc, aaa, len); len = 0; @@ -2401,8 +2362,7 @@ size_t CtdlIPCPartialRead(CtdlIPC * ipc, void **buf, size_t offset, size_t bytes /* CLOS */ -int CtdlIPCEndDownload(CtdlIPC * ipc, char *cret) -{ +int CtdlIPCEndDownload(CtdlIPC * ipc, char *cret) { int ret; if (!cret) @@ -2418,8 +2378,7 @@ int CtdlIPCEndDownload(CtdlIPC * ipc, char *cret) /* MSGP */ -int CtdlIPCSpecifyPreferredFormats(CtdlIPC * ipc, char *cret, char *formats) -{ +int CtdlIPCSpecifyPreferredFormats(CtdlIPC * ipc, char *cret, char *formats) { int ret; char cmd[SIZ]; @@ -2432,8 +2391,7 @@ int CtdlIPCSpecifyPreferredFormats(CtdlIPC * ipc, char *cret, char *formats) /* READ */ int CtdlIPCReadDownload(CtdlIPC * ipc, void **buf, size_t bytes, size_t resume, void (*progress_gauge_callback) - (CtdlIPC *, unsigned long, unsigned long), char *cret) -{ + (CtdlIPC *, unsigned long, unsigned long), char *cret) { size_t len; if (!cret) @@ -2465,8 +2423,7 @@ int CtdlIPCReadDownload(CtdlIPC * ipc, void **buf, size_t bytes, size_t resume, /* READ - pipelined */ int CtdlIPCHighSpeedReadDownload(CtdlIPC * ipc, void **buf, size_t bytes, size_t resume, void (*progress_gauge_callback) - (CtdlIPC *, unsigned long, unsigned long), char *cret) -{ + (CtdlIPC *, unsigned long, unsigned long), char *cret) { size_t len; int calls; /* How many calls in the pipeline */ int i; /* iterator */ @@ -2520,8 +2477,7 @@ int CtdlIPCHighSpeedReadDownload(CtdlIPC * ipc, void **buf, size_t bytes, size_t /* UCLS */ -int CtdlIPCEndUpload(CtdlIPC * ipc, int discard, char *cret) -{ +int CtdlIPCEndUpload(CtdlIPC * ipc, int discard, char *cret) { int ret; char cmd[8]; @@ -2539,8 +2495,7 @@ int CtdlIPCEndUpload(CtdlIPC * ipc, int discard, char *cret) /* WRIT */ int CtdlIPCWriteUpload(CtdlIPC * ipc, FILE * uploadFP, void (*progress_gauge_callback) - (CtdlIPC *, unsigned long, unsigned long), char *cret) -{ + (CtdlIPC *, unsigned long, unsigned long), char *cret) { int ret = -1; size_t offset = 0; size_t bytes; @@ -2583,7 +2538,8 @@ int CtdlIPCWriteUpload(CtdlIPC * ipc, FILE * uploadFP, void (*progress_gauge_cal /* Detect short reads and back up if needed */ /* offset will never be negative anyway */ fseek(fd, (signed) offset, SEEK_SET); - } else { + } + else { break; } } @@ -2623,14 +2579,10 @@ int CtdlIPCWriteUpload(CtdlIPC * ipc, FILE * uploadFP, void (*progress_gauge_cal * protocol_response as described above. Some commands send additional * data in this string. */ -int CtdlIPCGenericCommand(CtdlIPC *ipc, - const char *command, - const char *to_send, - size_t bytes_to_send, - char **to_receive, - size_t *bytes_to_receive, - char *proto_response -) { +int CtdlIPCGenericCommand(CtdlIPC * ipc, + const char *command, + const char *to_send, + size_t bytes_to_send, char **to_receive, size_t *bytes_to_receive, char *proto_response) { char buf[SIZ]; int ret; @@ -2659,7 +2611,8 @@ int CtdlIPCGenericCommand(CtdlIPC *ipc, case 1: /* LISTING_FOLLOWS */ if (to_receive && !*to_receive && bytes_to_receive) { *to_receive = CtdlIPCReadListing(ipc, NULL); - } else { /* Drain */ + } + else { /* Drain */ while (CtdlIPC_getline(ipc, buf), strcmp(buf, "000")); ret = -ret; } @@ -2667,7 +2620,8 @@ int CtdlIPCGenericCommand(CtdlIPC *ipc, case 4: /* SEND_LISTING */ if (to_send) { CtdlIPCSendListing(ipc, to_send); - } else { + } + else { /* No listing given, fake it */ CtdlIPC_putline(ipc, "000"); ret = -ret; @@ -2677,13 +2631,15 @@ int CtdlIPCGenericCommand(CtdlIPC *ipc, if (to_receive && !*to_receive && bytes_to_receive) { *bytes_to_receive = extract_long(proto_response, 0); *to_receive = (char *) - malloc((size_t) * bytes_to_receive); + malloc((size_t) *bytes_to_receive); if (!*to_receive) { ret = -1; - } else { + } + else { serv_read(ipc, *to_receive, *bytes_to_receive); } - } else { + } + else { /* Drain */ size_t drain; @@ -2699,7 +2655,8 @@ int CtdlIPCGenericCommand(CtdlIPC *ipc, case 7: /* SEND_BINARY */ if (to_send && bytes_to_send) { serv_write(ipc, to_send, bytes_to_send); - } else if (bytes_to_send) { + } + else if (bytes_to_send) { /* Fake it, send nulls */ size_t fake; @@ -2892,6 +2849,7 @@ void serv_write(CtdlIPC * ipc, const char *buf, unsigned int nbytes) { #ifdef HAVE_OPENSSL + /* * input binary data from encrypted connection */ @@ -3083,7 +3041,8 @@ static void CtdlIPC_getline(CtdlIPC * ipc, char *buf) { buf[i--] = 0; if (i >= 0 && buf[i] == 13) buf[i--] = 0; - } else + } + else #endif { if (ipc->Buf == NULL) { @@ -3116,7 +3075,8 @@ static void CtdlIPC_getline(CtdlIPC * ipc, char *buf) { /* is there more in the buffer we need to read later? */ if (ipc->Buf + ipc->BufUsed > aptr) { ipc->BufPtr = aptr; - } else { + } + else { ipc->BufUsed = 0; ipc->BufPtr = ipc->Buf; } @@ -3326,7 +3286,7 @@ CtdlIPC *CtdlIPC_new(int argc, char **argv, char *hostbuf, char *portbuf) { /* * Disconnect and delete the IPC class (destructor) */ -void CtdlIPC_delete(CtdlIPC *ipc) { +void CtdlIPC_delete(CtdlIPC * ipc) { #ifdef HAVE_OPENSSL if (ipc->ssl) { SSL_shutdown(ipc->ssl); @@ -3350,7 +3310,7 @@ void CtdlIPC_delete(CtdlIPC *ipc) { * Disconnect and delete the IPC class (destructor) * Also NULLs out the pointer */ -void CtdlIPC_delete_ptr(CtdlIPC **pipc) { +void CtdlIPC_delete_ptr(CtdlIPC ** pipc) { CtdlIPC_delete(*pipc); *pipc = NULL; } diff --git a/textclient/client_chat.c b/textclient/client_chat.c index 55ccb9b4d..68ba3a520 100644 --- a/textclient/client_chat.c +++ b/textclient/client_chat.c @@ -17,7 +17,7 @@ extern char temp[]; char last_paged[SIZ] = ""; -void chatmode(CtdlIPC *ipc) { +void chatmode(CtdlIPC * ipc) { char wbuf[SIZ]; char buf[SIZ]; char response[SIZ]; @@ -69,12 +69,14 @@ void chatmode(CtdlIPC *ipc) { ch = scr_getc(SCR_BLOCK); if ((ch == 10) || (ch == 13)) { send_complete_line = 1; - } else if ((ch == 8) || (ch == 127)) { + } + else if ((ch == 8) || (ch == 127)) { if (!IsEmptyStr(wbuf)) { wbuf[strlen(wbuf) - 1] = 0; scr_printf("%c %c", 8, 8); } - } else { + } + else { scr_putc(ch); wbuf[strlen(wbuf) + 1] = 0; wbuf[strlen(wbuf)] = ch; @@ -119,7 +121,8 @@ void chatmode(CtdlIPC *ipc) { } strcpy(wbuf, ""); send_complete_line = 0; - } else { + } + else { wbuf[pos] = 0; CtdlIPC_chat_send(ipc, "RCHT send"); CtdlIPC_chat_recv(ipc, response); @@ -143,14 +146,17 @@ void chatmode(CtdlIPC *ipc) { scr_printf("\r%79s\r", ""); if (!strcmp(c_user, fullname)) { color(BRIGHT_YELLOW); - } else if (!strcmp(c_user, ":")) { + } + else if (!strcmp(c_user, ":")) { color(BRIGHT_RED); - } else { + } + else { color(BRIGHT_GREEN); } if (strcmp(c_user, last_user)) { snprintf(buf, sizeof buf, "%s: %s", c_user, c_text); - } else { + } + else { size_t i = MIN(sizeof buf - 1, strlen(c_user) + 2); memset(buf, ' ', i); strncpy(&buf[i], c_text, sizeof buf - i); @@ -214,8 +220,7 @@ void page_user(CtdlIPC * ipc) { } -void quiet_mode(CtdlIPC * ipc) -{ +void quiet_mode(CtdlIPC * ipc) { static int quiet = 0; char cret[SIZ]; int r; @@ -224,14 +229,14 @@ void quiet_mode(CtdlIPC * ipc) if (r / 100 == 2) { quiet = !quiet; scr_printf("Quiet mode %sabled (%sother users may page you)\n", (quiet) ? "en" : "dis", (quiet) ? "no " : ""); - } else { + } + else { scr_printf("Unable to change quiet mode: %s\n", cret); } } -void stealth_mode(CtdlIPC * ipc) -{ +void stealth_mode(CtdlIPC * ipc) { static int stealth = 0; char cret[SIZ]; int r; @@ -241,7 +246,8 @@ void stealth_mode(CtdlIPC * ipc) stealth = !stealth; scr_printf("Stealth mode %sabled (you are %s)\n", (stealth) ? "en" : "dis", (stealth) ? "invisible" : "listed as online"); - } else { + } + else { scr_printf("Unable to change stealth mode: %s\n", cret); } } diff --git a/textclient/client_passwords.c b/textclient/client_passwords.c index 040e1783f..59c9c0423 100644 --- a/textclient/client_passwords.c +++ b/textclient/client_passwords.c @@ -15,8 +15,7 @@ #define PWFILENAME "%s/.citadel.passwords" -void determine_pwfilename(char *pwfile, size_t n) -{ +void determine_pwfilename(char *pwfile, size_t n) { struct passwd *p; p = getpwuid(getuid()); @@ -30,8 +29,7 @@ void determine_pwfilename(char *pwfile, size_t n) * Check the password file for a host/port match; if found, stuff the user * name and password into the user/pass buffers */ -void get_stored_password(char *host, char *port, char *username, char *password) -{ +void get_stored_password(char *host, char *port, char *username, char *password) { char pwfile[PATH_MAX]; FILE *fp; @@ -70,8 +68,7 @@ void get_stored_password(char *host, char *port, char *username, char *password) /* * Set (or clear) stored passwords. */ -void set_stored_password(char *host, char *port, char *username, char *password) -{ +void set_stored_password(char *host, char *port, char *username, char *password) { char pwfile[PATH_MAX]; FILE *fp, *oldfp; @@ -118,13 +115,13 @@ void set_stored_password(char *host, char *port, char *username, char *password) /* * Set the password if the user wants to, clear it otherwise */ -void offer_to_remember_password(CtdlIPC * ipc, char *host, char *port, char *username, char *password) -{ +void offer_to_remember_password(CtdlIPC * ipc, char *host, char *port, char *username, char *password) { if (rc_remember_passwords) { if (boolprompt("Remember username/password for this site", 0)) { set_stored_password(host, port, username, password); - } else { + } + else { set_stored_password(host, port, "", ""); } } diff --git a/textclient/commands.c b/textclient/commands.c index 5685d2f10..880d3ebc0 100644 --- a/textclient/commands.c +++ b/textclient/commands.c @@ -60,9 +60,7 @@ char *helptexts[] = { " In addition, there are dot commands. You hit the . (dot), then press the\n" "first letter of each word of the command. As you hit the letters, the words\n" "pop onto your screen. Exceptions: after you hit .Help or .Goto, the remainder\n" - "of the command is a help file name or room name.\n" - " \n" - " *** USE .elp ? for additional help *** \n", + "of the command is a help file name or room name.\n" " \n" " *** USE .elp ? for additional help *** \n", // <.H>elp ADMIN "The following commands are available only to Admins. A subset of these\n" @@ -449,10 +447,10 @@ struct citcmd *cmdlist = NULL; // these variables are local to this module -char keepalives_enabled = KA_YES; // send NOOPs to server when idle -int ok_to_interrupt = 0; // print instant msgs asynchronously -time_t AnsiDetect; // when did we send the detect code? -int enable_color = 0; // nonzero for ANSI color +char keepalives_enabled = KA_YES; // send NOOPs to server when idle +int ok_to_interrupt = 0; // print instant msgs asynchronously +time_t AnsiDetect; // when did we send the detect code? +int enable_color = 0; // nonzero for ANSI color // If an interesting key has been pressed, return its value, otherwise 0 @@ -732,10 +730,10 @@ int yesno_d(int d) { // Function to read a line of text from the terminal. // -// string Pointer to string buffer -// lim Maximum length -// noshow Echo asterisks instead of keystrokes? -// bs Allow backspacing out of the prompt? (returns -1 if this happens) +// string Pointer to string buffer +// lim Maximum length +// noshow Echo asterisks instead of keystrokes? +// bs Allow backspacing out of the prompt? (returns -1 if this happens) // // returns: string length int ctdl_getline(char *string, int lim, int noshow, int bs) { @@ -747,14 +745,15 @@ int ctdl_getline(char *string, int lim, int noshow, int bs) { while (num_stars--) { scr_putc('*'); } - } else { + } + else { scr_printf("%s", string); } while (1) { ch = inkey(); - if ((ch == 8) && (pos > 0)) { // backspace + if ((ch == 8) && (pos > 0)) { // backspace --pos; scr_putc(8); scr_putc(32); @@ -765,7 +764,7 @@ int ctdl_getline(char *string, int lim, int noshow, int bs) { return (-1); } - else if ((ch == 23) && (pos > 0)) { // Ctrl-W deletes a word + else if ((ch == 23) && (pos > 0)) { // Ctrl-W deletes a word while ((pos > 0) && !isspace(string[pos])) { --pos; scr_putc(8); @@ -780,13 +779,13 @@ int ctdl_getline(char *string, int lim, int noshow, int bs) { } } - else if (ch == 10) { // return + else if (ch == 10) { // return string[pos] = 0; scr_printf("\n"); return (pos); } - else if (isprint(ch)) { // payload characters + else if (isprint(ch)) { // payload characters scr_putc((noshow ? '*' : ch)); string[pos] = ch; ++pos; @@ -948,7 +947,8 @@ void load_command_set(void) { #ifdef HAVE_OPENSSL else if (!strcasecmp(&buf[8], "no")) { rc_encrypt = RC_NO; - } else if (!strcasecmp(&buf[8], "default")) { + } + else if (!strcasecmp(&buf[8], "default")) { rc_encrypt = RC_DEFAULT; } #endif @@ -997,9 +997,9 @@ void load_command_set(void) { if (!strncasecmp(&buf[11], "on", 2)) rc_ansi_color = 1; if (!strncasecmp(&buf[11], "auto", 4)) - rc_ansi_color = 2; // autodetect + rc_ansi_color = 2; // autodetect if (!strncasecmp(&buf[11], "user", 4)) - rc_ansi_color = 3; // user config + rc_ansi_color = 3; // user config } if (!strncasecmp(buf, "status_line=", 12)) { if (!strncasecmp(&buf[12], "on", 2)) @@ -1013,7 +1013,7 @@ void load_command_set(void) { if (!strncasecmp(&buf[15], "on", 2)) rc_prompt_control = 1; if (!strncasecmp(&buf[15], "user", 4)) - rc_prompt_control = 3; // user config + rc_prompt_control = 3; // user config } if (!strncasecmp(buf, "username=", 9)) strcpy(rc_username, &buf[9]); @@ -1278,13 +1278,13 @@ int getcmd(CtdlIPC * ipc, char *argbuf) { // If this command is one that changes rooms, then the next lazy-command // (space bar) should be "read new" instead of "goto" - if ( (cptr->c_cmdnum == 5) - || (cptr->c_cmdnum == 6) - || (cptr->c_cmdnum == 47) - || (cptr->c_cmdnum == 52) - || (cptr->c_cmdnum == 16) - || (cptr->c_cmdnum == 20) - ) { + if ((cptr->c_cmdnum == 5) + || (cptr->c_cmdnum == 6) + || (cptr->c_cmdnum == 47) + || (cptr->c_cmdnum == 52) + || (cptr->c_cmdnum == 16) + || (cptr->c_cmdnum == 20) + ) { next_lazy_cmd = 13; } @@ -1396,10 +1396,10 @@ void display_help(CtdlIPC * ipc, char *name) { // fmout() - Citadel text formatter and paginator int fmout(int width, // screen width to use - FILE * fpin, // file to read from, or NULL to format given text - char *text, // text to be formatted (when fpin is NULL - FILE * fpout, // file to write to, or NULL to write to screen - int subst) { // nonzero if we should use hypertext mode + FILE * fpin, // file to read from, or NULL to format given text + char *text, // text to be formatted (when fpin is NULL + FILE * fpout, // file to write to, or NULL to write to screen + int subst) { // nonzero if we should use hypertext mode char *buffer = NULL; // The current message char *word = NULL; // What we are about to actually print char *e; // Pointer to position in text @@ -1434,17 +1434,18 @@ int fmout(int width, // screen width to use e++; continue; } - if (*e == '\n') { // newline? + if (*e == '\n') { // newline? e++; - if (*e == ' ') { // paragraph? + if (*e == ' ') { // paragraph? if (fpout) { fprintf(fpout, "\n"); - } else { + } + else { scr_printf("\n"); } column = 0; } - else if (old != ' ') { // Don't print two spaces + else if (old != ' ') { // Don't print two spaces if (fpout) { fprintf(fpout, " "); } @@ -1654,7 +1655,8 @@ void keyopt(char *buf) { if (buf[i] == '<') { scr_printf("%c", buf[i]); color(BRIGHT_MAGENTA); - } else { + } + else { if (buf[i] == '>' && buf[i + 1] != '>') { color(DIM_WHITE); } diff --git a/textclient/ipc_c_tcp.c b/textclient/ipc_c_tcp.c index efb997dcc..b24a130b8 100644 --- a/textclient/ipc_c_tcp.c +++ b/textclient/ipc_c_tcp.c @@ -16,21 +16,18 @@ /* Note that some of these functions may not work with multiple instances. */ -static void (*deathHook) (void) = NULL; -int (*error_printf) (char *s, ...) = (int (*)(char *, ...)) printf; +static void (*deathHook)(void) = NULL; +int (*error_printf)(char *s, ...) =(int(*)(char *, ...)) printf; -void setIPCDeathHook(void (*hook) (void)) -{ +void setIPCDeathHook(void (*hook)(void)) { deathHook = hook; } -void setIPCErrorPrintf(int (*func) (char *s, ...)) -{ +void setIPCErrorPrintf(int (*func)(char *s, ...)) { error_printf = func; } -void connection_died(CtdlIPC * ipc, int using_ssl) -{ +void connection_died(CtdlIPC * ipc, int using_ssl) { if (deathHook != NULL) { deathHook(); } @@ -44,7 +41,8 @@ void connection_died(CtdlIPC * ipc, int using_ssl) fprintf(stderr, "Last error: %s\n", ERR_reason_error_string(ERR_get_error())); SSL_free(ipc->ssl); ipc->ssl = NULL; - } else + } + else #endif fprintf(stderr, "Last error: %s\n", strerror(errno)); diff --git a/textclient/messages.c b/textclient/messages.c index 9ece2099d..34e188228 100644 --- a/textclient/messages.c +++ b/textclient/messages.c @@ -64,7 +64,7 @@ extern CtdlIPC *ipc_for_signal_handlers; /* KLUDGE cover your eyes */ int num_urls = 0; char urls[MAXURLS][SIZ]; char imagecmd[SIZ]; -int has_images = 0; /* Current msg has images */ +int has_images = 0; /* Current msg has images */ struct parts *last_message_parts = NULL; /* Parts from last msg */ @@ -342,34 +342,34 @@ void free_parts(struct parts *p) { * We can do this "in place" because the converted string will always be smaller than the source string. */ void mini_2047_decode(char *s) { - if (!s) { // no null strings allowed! + if (!s) { // no null strings allowed! return; } - char *qstart = strstr(s, "=?UTF-8?Q?"); // Must start with this string + char *qstart = strstr(s, "=?UTF-8?Q?"); // Must start with this string if (!qstart) { return; } - char *qend = strstr(qstart+10, "?="); // Must end with this string + char *qend = strstr(qstart + 10, "?="); // Must end with this string if (!qend) { return; } - if (qend <= qstart) { // And there must be something in between them. + if (qend <= qstart) { // And there must be something in between them. return; } // The string has qualified for conversion. - strcpy(qend, ""); // Strip the trailer - strcpy(qstart, &qstart[10]); // Strip the header + strcpy(qend, ""); // Strip the trailer + strcpy(qstart, &qstart[10]); // Strip the header - char *r = qstart; // Pointer to where in the string we're reading - char *w = s; // Pointer to where in the string we're writing + char *r = qstart; // Pointer to where in the string we're reading + char *w = s; // Pointer to where in the string we're writing - while(*r) { // Loop through the source string - if (r[0] == '=') { // "=" means read a hex character + while (*r) { // Loop through the source string + if (r[0] == '=') { // "=" means read a hex character char ch[3]; ch[0] = r[1]; ch[1] = r[2]; @@ -380,29 +380,28 @@ void mini_2047_decode(char *s) { r += 3; ++w; } - else if (r[0] == '_') { // "_" is a space + else if (r[0] == '_') { // "_" is a space w[0] = ' '; ++r; ++w; } - else { // anything else pass through literally + else { // anything else pass through literally w[0] = r[0]; ++r; ++w; } } - w[0] = 0; // null terminate + w[0] = 0; // null terminate } /* * Read a message from the server */ -int read_message(CtdlIPC *ipc, - long num, /* message number */ - int pagin, /* 0 = normal read, 1 = read with pagination, 2 = header */ - FILE *dest /* Destination file, NULL for screen */ -) { +int read_message(CtdlIPC * ipc, long num, /* message number */ + int pagin, /* 0 = normal read, 1 = read with pagination, 2 = header */ + FILE * dest /* Destination file, NULL for screen */ + ) { char buf[SIZ]; char now[256]; int format_type = 0; @@ -484,7 +483,8 @@ int read_message(CtdlIPC *ipc, if (rc_display_message_numbers) { if (dest) { fprintf(dest, "[#%s] ", message->msgid); - } else { + } + else { color(DIM_WHITE); scr_printf("["); color(BRIGHT_WHITE); @@ -683,7 +683,8 @@ int read_message(CtdlIPC *ipc, } if (dest) { fprintf(dest, "%s\n", lineptr); - } else { + } + else { scr_printf("%s\n", lineptr); } } @@ -698,7 +699,8 @@ int read_message(CtdlIPC *ipc, if (!final_line_is_blank) { if (dest) { fprintf(dest, "\n"); - } else { + } + else { scr_printf("\n"); fr = sigcaught; } @@ -814,15 +816,10 @@ void replace_string(char *filename, long int startpos) { // Function to begin composing a new message -int client_make_message(CtdlIPC * ipc, - char *filename, // temporary file name +int client_make_message(CtdlIPC * ipc, char *filename, // temporary file name char *recipient, // NULL if it's not mail - int is_anonymous, - int format_type, - int mode, - char *subject, // buffer to store subject line - int subject_required -) { + int is_anonymous, int format_type, int mode, char *subject, // buffer to store subject line + int subject_required) { FILE *fp; int a, b, e_ex_code; long beg; @@ -844,7 +841,7 @@ int client_make_message(CtdlIPC * ipc, if (room_flags & QR_ANONONLY && !recipient) { snprintf(header, sizeof header, " ****"); } - else { + else { snprintf(header, sizeof header, " %s from %s", datestr, (is_anonymous ? "[anonymous]" : fullname)); if (!IsEmptyStr(recipient)) { size_t tmp = strlen(header); @@ -884,7 +881,7 @@ int client_make_message(CtdlIPC * ipc, } } -ME1: switch (mode) { + ME1:switch (mode) { case 0: fp = fopen(filename, "r+"); @@ -944,7 +941,7 @@ ME1: switch (mode) { break; } -MECR: if (mode >= 2) { + MECR:if (mode >= 2) { if (file_checksum(filename) == cksum) { scr_printf("*** Aborted message.\n"); e_ex_code = 1; @@ -956,14 +953,8 @@ MECR: if (mode >= 2) { } b = keymenu("Entry command (? for options)", - "bort|" - "ontinue|" - "ave message|" - "

rint formatted|" - "add sbject|" - "eplace string|" - "old message" - ); + "bort|" + "ontinue|" "ave message|" "

rint formatted|" "add sbject|" "eplace string|" "old message"); if (b == 'a') goto MEABT; @@ -1005,13 +996,13 @@ MECR: if (mode >= 2) { goto MECR; } -MEFIN: return (0); + MEFIN:return (0); -MEABT: scr_printf("Are you sure? "); + MEABT:scr_printf("Are you sure? "); if (yesno() == 0) { goto ME1; } -MEABT2: unlink(filename); + MEABT2:unlink(filename); return (2); } @@ -1058,7 +1049,7 @@ void break_big_lines(char *msg) { int entmsg(CtdlIPC * ipc, int is_reply, /* nonzero if this was a eply command */ int c, /* mode */ int masquerade /* prompt for a non-default display name? */ -) { + ) { char buf[SIZ]; int a, b; int need_recp = 0; @@ -1085,7 +1076,7 @@ int entmsg(CtdlIPC * ipc, int is_reply, /* nonzero if this was a eply command scr_printf("If you want to leave a comment or reply to a comment, use the 'eply' command.\n"); scr_printf("Do you really want to create a new blog post? "); if (!yesno()) { - return(1); + return (1); } } } @@ -1460,7 +1451,8 @@ void image_view(CtdlIPC * ipc, unsigned long msg) { r = CtdlIPCAttachmentDownload(ipc, msg, ptr->number, &file, progress, buf); if (r / 100 != 2) { scr_printf("%s\n", buf); - } else { + } + else { size_t len; len = (size_t) extract_long(buf, 0); @@ -1484,11 +1476,10 @@ void image_view(CtdlIPC * ipc, unsigned long msg) { /* * Read the messages in the current room */ -void readmsgs(CtdlIPC *ipc, - enum MessageList c, // see listing in citadel_ipc.h - enum MessageDirection rdir, // 1=Forward (-1)=Reverse - int q // Number of msgs to read (if c==3) -) { +void readmsgs(CtdlIPC * ipc, enum MessageList c, // see listing in citadel_ipc.h + enum MessageDirection rdir, // 1=Forward (-1)=Reverse + int q // Number of msgs to read (if c==3) + ) { int a, e, f, g, start; int savedpos; int hold_sw = 0; @@ -1570,7 +1561,7 @@ void readmsgs(CtdlIPC *ipc, if ((quotflag) || (arcflag)) { screenwidth = hold_sw; } -RMSGREAD: + RMSGREAD: highest_msg_read = msg_arr[a]; if (quotflag) { fclose(dest); @@ -1628,10 +1619,13 @@ RMSGREAD: do { e = (inkey() & 127); e = tolower(e); + /* return key same as */ if (e == 10) e = 'n'; + /* space key same as */ if (e == 32) e = 'n'; + /* del/move for aides only */ if ((!is_room_aide) && ((room_flags & QR_MAILBOX) == 0) @@ -1640,13 +1634,16 @@ RMSGREAD: if ((e == 'd') || (e == 'm')) e = 0; } + /* print only if available */ if ((e == 'p') && (IsEmptyStr(printcmd))) e = 0; + /* can't file if not allowed */ if ((e == 'f') && (rc_allow_attachments == 0)) e = 0; + /* link only if browser avail*/ if ((e == 'u') && (IsEmptyStr(rc_url_cmd))) diff --git a/textclient/rooms.c b/textclient/rooms.c index be579c1d7..99a5ed98b 100644 --- a/textclient/rooms.c +++ b/textclient/rooms.c @@ -44,8 +44,7 @@ extern int uglistsize; extern char floorlist[128][SIZ]; -void load_floorlist(CtdlIPC * ipc) -{ +void load_floorlist(CtdlIPC * ipc) { int a; char buf[SIZ]; char *listing = NULL; @@ -68,8 +67,7 @@ void load_floorlist(CtdlIPC * ipc) } -void room_tree_list(struct ctdlroomlisting *rp) -{ +void room_tree_list(struct ctdlroomlisting *rp) { static int c = 0; char rmname[ROOMNAMELEN]; int f; @@ -94,15 +92,18 @@ void room_tree_list(struct ctdlroomlisting *rp) } if (f & QR_MAILBOX) { color(BRIGHT_YELLOW); - } else if (f & QR_PRIVATE) { + } + else if (f & QR_PRIVATE) { color(BRIGHT_RED); - } else { + } + else { color(DIM_WHITE); } scr_printf("%s", rmname); if (f & QR_DIRECTORY) { scr_printf("] "); - } else { + } + else { scr_printf("> "); } c = c + strlen(rmname) + 3; @@ -119,8 +120,7 @@ void room_tree_list(struct ctdlroomlisting *rp) /* * Room ordering stuff (compare first by floor, then by order) */ -int rordercmp(struct ctdlroomlisting *r1, struct ctdlroomlisting *r2) -{ +int rordercmp(struct ctdlroomlisting *r1, struct ctdlroomlisting *r2) { if ((r1 == NULL) && (r2 == NULL)) return (0); if (r1 == NULL) @@ -142,8 +142,7 @@ int rordercmp(struct ctdlroomlisting *r1, struct ctdlroomlisting *r2) /* * Common code for all room listings */ -static void listrms(struct march *listing, int new_only, int floor_only, unsigned int flags, char *match) -{ +static void listrms(struct march *listing, int new_only, int floor_only, unsigned int flags, char *match) { struct march *mptr; struct ctdlroomlisting *rl = NULL; struct ctdlroomlisting *rp; @@ -183,20 +182,24 @@ static void listrms(struct march *listing, int new_only, int floor_only, unsigne rs = rl; if (rl == NULL) { rl = rp; - } else { + } + else { while (rp != NULL) { if (rordercmp(rp, rs) < 0) { if (rs->lnext == NULL) { rs->lnext = rp; rp = NULL; - } else { + } + else { rs = rs->lnext; } - } else { + } + else { if (rs->rnext == NULL) { rs->rnext = rp; rp = NULL; - } else { + } + else { rs = rs->rnext; } } @@ -211,8 +214,7 @@ static void listrms(struct march *listing, int new_only, int floor_only, unsigne } -void list_other_floors(void) -{ +void list_other_floors(void) { int a, c; c = 1; @@ -233,8 +235,7 @@ void list_other_floors(void) * List known rooms. kn_floor_mode should be set to 0 for a 'flat' listing, * 1 to list rooms on the current floor, or 2 to list rooms on all floors. */ -void knrooms(CtdlIPC * ipc, int kn_floor_mode) -{ +void knrooms(CtdlIPC * ipc, int kn_floor_mode) { int a; struct march *listing = NULL; struct march *mptr; @@ -296,8 +297,7 @@ void knrooms(CtdlIPC * ipc, int kn_floor_mode) } -void listzrooms(CtdlIPC * ipc) -{ /* list public forgotten rooms */ +void listzrooms(CtdlIPC * ipc) { /* list public forgotten rooms */ struct march *listing = NULL; struct march *mptr; int r; /* IPC response code */ @@ -325,8 +325,7 @@ void listzrooms(CtdlIPC * ipc) color(DIM_WHITE); } -void dotknown(CtdlIPC * ipc, int what, char *match) -{ /* list rooms according to attribute */ +void dotknown(CtdlIPC * ipc, int what, char *match) { /* list rooms according to attribute */ struct march *listing = NULL; struct march *mptr; int r; /* IPC response code */ @@ -384,8 +383,7 @@ void dotknown(CtdlIPC * ipc, int what, char *match) } -int set_room_attr(CtdlIPC * ipc, unsigned int ibuf, char *prompt, unsigned int sbit) -{ +int set_room_attr(CtdlIPC * ipc, unsigned int ibuf, char *prompt, unsigned int sbit) { int a; a = boolprompt(prompt, (ibuf & sbit)); @@ -403,8 +401,7 @@ int set_room_attr(CtdlIPC * ipc, unsigned int ibuf, char *prompt, unsigned int s * The supplied argument is the 'default' floor number. * This function returns the selected floor number. */ -int select_floor(CtdlIPC * ipc, int rfloor) -{ +int select_floor(CtdlIPC * ipc, int rfloor) { int a, newfloor; char floorstr[SIZ]; @@ -453,8 +450,7 @@ int select_floor(CtdlIPC * ipc, int rfloor) /* * .ide dit room */ -void editthisroom(CtdlIPC * ipc) -{ +void editthisroom(CtdlIPC * ipc) { int rbump = 0; char room_admin_name[USERNAME_SIZE]; char buf[SIZ]; @@ -474,7 +470,8 @@ void editthisroom(CtdlIPC * ipc) r = CtdlIPCGetRoomAide(ipc, buf); if (r / 100 == 2) { strncpy(room_admin_name, buf, sizeof room_admin_name); - } else { + } + else { strcpy(room_admin_name, ""); } if (IsEmptyStr(room_admin_name)) { @@ -524,7 +521,8 @@ void editthisroom(CtdlIPC * ipc) attr->QRflags = set_room_attr(ipc, attr->QRflags, "Read-only room", QR_READONLY); attr->QRflags2 = set_room_attr(ipc, attr->QRflags2, "Allow message deletion by anyone who can post", QR2_COLLABDEL); attr->QRflags = set_room_attr(ipc, attr->QRflags, "Permanent room", QR_PERMANENT); - attr->QRflags2 = set_room_attr(ipc, attr->QRflags2, "Subject Required (Force users to specify a message subject)", QR2_SUBJECTREQ); + attr->QRflags2 = + set_room_attr(ipc, attr->QRflags2, "Subject Required (Force users to specify a message subject)", QR2_SUBJECTREQ); attr->QRflags = set_room_attr(ipc, attr->QRflags, "Directory room", QR_DIRECTORY); if (attr->QRflags & QR_DIRECTORY) { strprompt("Directory name", attr->QRdirname, 14); @@ -731,7 +729,8 @@ void destination_directory(char *dest, const char *supplied_filename) { if (IsEmptyStr(save_dir)) { if (getenv("HOME") == NULL) { strcpy(save_dir, "."); - } else { + } + else { sprintf(save_dir, "%s/Desktop", getenv("HOME")); if (access(save_dir, W_OK) != 0) { sprintf(save_dir, "%s", getenv("HOME")); @@ -749,7 +748,8 @@ void destination_directory(char *dest, const char *supplied_filename) { strcpy(save_dir, dest); if (strrchr(save_dir, '/') != NULL) { strcpy(strrchr(save_dir, '/'), ""); - } else { + } + else { strcpy(save_dir, "."); } } @@ -766,6 +766,7 @@ void download(CtdlIPC * ipc, int proto) { char tempname[PATH_MAX]; char transmit_cmd[SIZ]; FILE *tpipe = NULL; + /* int broken = 0;*/ int r; int rv = 0; @@ -816,7 +817,8 @@ void download(CtdlIPC * ipc, int proto) { /* FIXME: display internally instead */ snprintf(transmit_cmd, sizeof transmit_cmd, "SHELL=/dev/null; export SHELL; TERM=dumb; export TERM; exec more -d <%s", tempname); - } else if (proto == 1) + } + else if (proto == 1) snprintf(transmit_cmd, sizeof transmit_cmd, "exec sx %s", tempname); else if (proto == 3) snprintf(transmit_cmd, sizeof transmit_cmd, "exec sb %s", tempname); @@ -841,8 +843,7 @@ void download(CtdlIPC * ipc, int proto) { /* * read directory of this room */ -void roomdir(CtdlIPC * ipc) -{ +void roomdir(CtdlIPC * ipc) { char flnm[256]; char flsz[32]; char comment[256]; @@ -882,8 +883,7 @@ void roomdir(CtdlIPC * ipc) /* * add a user to a private room */ -void invite(CtdlIPC * ipc) -{ +void invite(CtdlIPC * ipc) { char username[USERNAME_SIZE]; char buf[SIZ]; @@ -899,8 +899,7 @@ void invite(CtdlIPC * ipc) /* * kick a user out of a room */ -void kickout(CtdlIPC * ipc) -{ +void kickout(CtdlIPC * ipc) { char username[USERNAME_SIZE]; char buf[SIZ]; @@ -916,8 +915,7 @@ void kickout(CtdlIPC * ipc) /* * aide command: kill the current room */ -void killroom(CtdlIPC * ipc) -{ +void killroom(CtdlIPC * ipc) { char aaa[100]; int r; @@ -938,8 +936,7 @@ void killroom(CtdlIPC * ipc) dotgoto(ipc, "_BASEROOM_", 0, 0); } -void forget(CtdlIPC * ipc) -{ /* forget the current room */ +void forget(CtdlIPC * ipc) { /* forget the current room */ char buf[SIZ]; scr_printf("Are you sure you want to forget this room? "); @@ -960,8 +957,7 @@ void forget(CtdlIPC * ipc) /* * create a new room */ -void entroom(CtdlIPC * ipc) -{ +void entroom(CtdlIPC * ipc) { char buf[SIZ]; char new_room_name[ROOMNAMELEN]; int new_room_type; @@ -1013,7 +1009,8 @@ void entroom(CtdlIPC * ipc) for (a = 0; !IsEmptyStr(&new_room_pass[a]); ++a) if (new_room_pass[a] == '|') new_room_pass[a] = '_'; - } else { + } + else { strcpy(new_room_pass, ""); } @@ -1045,8 +1042,7 @@ void entroom(CtdlIPC * ipc) -void readinfo(CtdlIPC * ipc) -{ /* read info file for current room */ +void readinfo(CtdlIPC * ipc) { /* read info file for current room */ char buf[SIZ]; char room_admin_name[64]; int r; /* IPC response code */ @@ -1076,8 +1072,7 @@ void readinfo(CtdlIPC * ipc) /* * ho knows room... */ -void whoknows(CtdlIPC * ipc) -{ +void whoknows(CtdlIPC * ipc) { char buf[256]; char *listing = NULL; int r; @@ -1097,8 +1092,7 @@ void whoknows(CtdlIPC * ipc) } -void do_edit(CtdlIPC * ipc, char *desc, char *read_cmd, char *check_cmd, char *write_cmd) -{ +void do_edit(CtdlIPC * ipc, char *desc, char *read_cmd, char *check_cmd, char *write_cmd) { FILE *fp; char cmd[SIZ]; int b, cksum, editor_exit; @@ -1153,7 +1147,8 @@ void do_edit(CtdlIPC * ipc, char *desc, char *read_cmd, char *check_cmd, char *w editor_pid = (-1); scr_printf("Executed %s\n", editor_path); stty_ctdl(0); - } else { + } + else { scr_printf("Entering %s. Press return twice when finished.\n", desc); fp = fopen(temp, "r+"); citedit(fp); @@ -1185,13 +1180,11 @@ void do_edit(CtdlIPC * ipc, char *desc, char *read_cmd, char *check_cmd, char *w } -void enterinfo(CtdlIPC * ipc) -{ /* edit info file for current room */ +void enterinfo(CtdlIPC * ipc) { /* edit info file for current room */ do_edit(ipc, "the Info file for this room", "RINF", "EINF 0", "EINF 1"); } -void enter_bio(CtdlIPC * ipc) -{ +void enter_bio(CtdlIPC * ipc) { char cmd[SIZ]; snprintf(cmd, sizeof cmd, "RBIO %s", fullname); do_edit(ipc, "your Bio", cmd, "NOOP", "EBIO"); @@ -1200,8 +1193,7 @@ void enter_bio(CtdlIPC * ipc) /* * create a new floor */ -void create_floor(CtdlIPC * ipc) -{ +void create_floor(CtdlIPC * ipc) { char buf[SIZ]; char newfloorname[SIZ]; int r; /* IPC response code */ @@ -1220,7 +1212,8 @@ void create_floor(CtdlIPC * ipc) r = CtdlIPCCreateFloor(ipc, 1, newfloorname, buf); if (r / 100 == 2) { scr_printf("Floor has been created.\n"); - } else { + } + else { scr_printf("%s\n", buf); } @@ -1230,8 +1223,7 @@ void create_floor(CtdlIPC * ipc) /* * edit the current floor */ -void edit_floor(CtdlIPC * ipc) -{ +void edit_floor(CtdlIPC * ipc) { char buf[SIZ]; struct ExpirePolicy *ep = NULL; @@ -1285,8 +1277,7 @@ void edit_floor(CtdlIPC * ipc) /* * kill the current floor */ -void kill_floor(CtdlIPC * ipc) -{ +void kill_floor(CtdlIPC * ipc) { int floornum_to_delete, a; char buf[SIZ]; diff --git a/textclient/routines.c b/textclient/routines.c index b488dc9d1..56b4fd337 100644 --- a/textclient/routines.c +++ b/textclient/routines.c @@ -22,8 +22,7 @@ extern int rc_ansi_color; extern int rc_prompt_control; /* Destructive backspace */ -void back(int spaces) -{ +void back(int spaces) { int a; for (a = 0; a < spaces; ++a) { scr_putc(8); @@ -35,8 +34,7 @@ void back(int spaces) /* * Edit a user's Internet email addresses */ -void edit_user_internet_email_addresses(CtdlIPC * ipc, char *who) -{ +void edit_user_internet_email_addresses(CtdlIPC * ipc, char *who) { char buf[SIZ]; char *resp = NULL; int num_recs = 0; @@ -89,7 +87,8 @@ void edit_user_internet_email_addresses(CtdlIPC * ipc, char *who) ++num_recs; if (num_recs == 1) { recs = malloc(sizeof(char *)); - } else { + } + else { recs = realloc(recs, (sizeof(char *)) * num_recs); } recs[num_recs - 1] = strdup(buf); @@ -122,7 +121,8 @@ void edit_user_internet_email_addresses(CtdlIPC * ipc, char *who) r = CtdlIPCAideSetEmailAddresses(ipc, who, resp, buf); if (r / 100 != 4) { scr_printf("%s\n", buf); - } else { + } + else { scr_printf("Saved %d addresses.\n", num_recs); modified = 0; quitting = 1; @@ -148,8 +148,7 @@ void edit_user_internet_email_addresses(CtdlIPC * ipc, char *who) /* * Edit or delete a user (cmd=25 to edit/create, 96 to delete) */ -void edituser(CtdlIPC * ipc, int cmd) -{ +void edituser(CtdlIPC * ipc, int cmd) { char buf[SIZ]; char who[USERNAME_SIZE]; char newname[USERNAME_SIZE]; @@ -190,11 +189,13 @@ void edituser(CtdlIPC * ipc, int cmd) r = CtdlIPCRenameUser(ipc, user->fullname, newname, buf); if (r / 100 != 2) { scr_printf("%s\n", buf); - } else { + } + else { strcpy(user->fullname, newname); change_name = 0; } - } else { + } + else { change_name = 0; } } @@ -207,12 +208,14 @@ void edituser(CtdlIPC * ipc, int cmd) user->axlevel = intprompt("Access level", user->axlevel, 0, 6); if (boolprompt("Permission to send Internet mail", (user->flags & US_INTERNET))) { user->flags |= US_INTERNET; - } else { + } + else { user->flags &= ~US_INTERNET; } if (boolprompt("Ask user to register again", !(user->flags & US_REGIS))) { user->flags &= ~US_REGIS; - } else { + } + else { user->flags |= US_REGIS; } user->timescalled = intprompt("Times called", user->timescalled, 0, INT_MAX); @@ -247,8 +250,7 @@ void edituser(CtdlIPC * ipc, int cmd) * yes or no. Yes=1 and No=0, unless 'backwards' is set to a nonzero value * in which case No=1 and Yes=0. */ -int set_attr(CtdlIPC * ipc, unsigned int sval, char *prompt, unsigned int sbit, int backwards) -{ +int set_attr(CtdlIPC * ipc, unsigned int sval, char *prompt, unsigned int sbit, int backwards) { int a; int temp; @@ -261,7 +263,8 @@ int set_attr(CtdlIPC * ipc, unsigned int sval, char *prompt, unsigned int sbit, if (backwards) { scr_printf("%3s", ((temp & sbit) ? "No" : "Yes")); - } else { + } + else { scr_printf("%3s", ((temp & sbit) ? "Yes" : "No")); } @@ -287,8 +290,7 @@ int set_attr(CtdlIPC * ipc, unsigned int sval, char *prompt, unsigned int sbit, * modes are: 0 - .EC command, 1 - .EC for new user, * 2 - toggle Xpert mode 3 - toggle floor mode */ -void enter_config(CtdlIPC * ipc, int mode) -{ +void enter_config(CtdlIPC * ipc, int mode) { char buf[SIZ]; struct ctdluser *user = NULL; int r; /* IPC response code */ @@ -347,7 +349,8 @@ void enter_config(CtdlIPC * ipc, int mode) if (user->flags & US_EXPERT) { user->flags ^= US_EXPERT; scr_printf("Expert mode now OFF\n"); - } else { + } + else { user->flags |= US_EXPERT; scr_printf("Expert mode now ON\n"); } @@ -357,7 +360,8 @@ void enter_config(CtdlIPC * ipc, int mode) if (user->flags & US_FLOORS) { user->flags ^= US_FLOORS; scr_printf("Floor mode now OFF\n"); - } else { + } + else { user->flags |= US_FLOORS; scr_printf("Floor mode now ON\n"); } @@ -374,8 +378,7 @@ void enter_config(CtdlIPC * ipc, int mode) * getstring() - get a line of text from a file * ignores lines beginning with "#" */ -int getstring(FILE * fp, char *string) -{ +int getstring(FILE * fp, char *string) { int a, c; do { strcpy(string, ""); @@ -395,8 +398,7 @@ int getstring(FILE * fp, char *string) /* Searches for patn in search string */ -int pattern(char *search, char *patn) -{ +int pattern(char *search, char *patn) { int a, b, len; len = strlen(patn); @@ -409,8 +411,7 @@ int pattern(char *search, char *patn) } -void strproc(char *string) -{ +void strproc(char *string) { int a; if (IsEmptyStr(string)) @@ -457,8 +458,7 @@ void strproc(char *string) } -void progress(CtdlIPC * ipc, unsigned long curr, unsigned long cmax) -{ +void progress(CtdlIPC * ipc, unsigned long curr, unsigned long cmax) { static char dots[] = "**************************************************"; char dots_printed[51]; char fmt[42]; @@ -466,7 +466,8 @@ void progress(CtdlIPC * ipc, unsigned long curr, unsigned long cmax) if (curr >= cmax) { scr_printf("\r%79s\r", ""); - } else { + } + else { /* a will be range 0-50 rather than 0-100 */ a = (curr * 50) / cmax; sprintf(fmt, "[%%s%%%lds] %%3ld%%%% %%10ld/%%10ld\r", 50 - a); @@ -482,8 +483,7 @@ void progress(CtdlIPC * ipc, unsigned long curr, unsigned long cmax) * NOT the same locate_host() in locate_host.c. This one just does a * 'who am i' to try to discover where the user is... */ -void locate_host(CtdlIPC * ipc, char *hbuf) -{ +void locate_host(CtdlIPC * ipc, char *hbuf) { FILE *who = (FILE *) popen("who am i", "r"); if (who == NULL) { strcpy(hbuf, ipc->ServInfo.fqdn); @@ -497,8 +497,7 @@ void locate_host(CtdlIPC * ipc, char *hbuf) /* * miscellaneous server commands (testing, etc.) */ -void misc_server_cmd(CtdlIPC * ipc, char *cmd) -{ +void misc_server_cmd(CtdlIPC * ipc, char *cmd) { char buf[SIZ]; CtdlIPC_chat_send(ipc, cmd); @@ -525,8 +524,7 @@ void misc_server_cmd(CtdlIPC * ipc, char *cmd) /* * compute the checksum of a file */ -int file_checksum(char *filename) -{ +int file_checksum(char *filename) { int cksum = 0; int ch; FILE *fp; @@ -549,8 +547,7 @@ int file_checksum(char *filename) /* * nuke a directory and its contents */ -int nukedir(char *dirname) -{ +int nukedir(char *dirname) { DIR *dp; struct dirent *d; char filename[SIZ]; diff --git a/textclient/routines2.c b/textclient/routines2.c index 77fbe133c..edf206dd1 100644 --- a/textclient/routines2.c +++ b/textclient/routines2.c @@ -137,8 +137,7 @@ void entregis(CtdlIPC * ipc) { /* * make all messages old in current room */ -void updatels(CtdlIPC * ipc) -{ +void updatels(CtdlIPC * ipc) { char buf[256]; int r; /* IPC response code */ @@ -151,8 +150,7 @@ void updatels(CtdlIPC * ipc) /* * only make messages old in this room that have been read */ -void updatelsa(CtdlIPC * ipc) -{ +void updatelsa(CtdlIPC * ipc) { char buf[256]; int r; /* IPC response code */ @@ -165,8 +163,7 @@ void updatelsa(CtdlIPC * ipc) /* * client-based uploads (for users with their own clientware) */ -void cli_upload(CtdlIPC * ipc) -{ +void cli_upload(CtdlIPC * ipc) { char flnm[PATH_MAX]; char desc[151]; char buf[256]; @@ -215,8 +212,7 @@ void cli_upload(CtdlIPC * ipc) /* * Function used for various image upload commands */ -void cli_image_upload(CtdlIPC * ipc, char *keyname) -{ +void cli_image_upload(CtdlIPC * ipc, char *keyname) { char flnm[PATH_MAX]; char buf[256]; int r; @@ -242,8 +238,7 @@ void cli_image_upload(CtdlIPC * ipc, char *keyname) /* * protocol-based uploads (Xmodem, Ymodem, Zmodem) */ -void upload(CtdlIPC * ipc, int c) -{ /* c = upload mode */ +void upload(CtdlIPC * ipc, int c) { /* c = upload mode */ char flnm[PATH_MAX]; char desc[151]; char buf[256]; @@ -314,9 +309,10 @@ void upload(CtdlIPC * ipc, int c) exit(1); } } - else do { - b = ka_wait(&a); - } while ((b != xfer_pid) && (b != (-1))); + else + do { + b = ka_wait(&a); + } while ((b != xfer_pid) && (b != (-1))); stty_ctdl(0); if (a != 0) { @@ -345,8 +341,7 @@ void upload(CtdlIPC * ipc, int c) /* * validate a user (returns 0 for successful validation, nonzero if quitting) */ -int val_user(CtdlIPC * ipc, char *user, int do_validate) -{ +int val_user(CtdlIPC * ipc, char *user, int do_validate) { int a; char cmd[256]; char buf[256]; @@ -392,7 +387,8 @@ int val_user(CtdlIPC * ipc, char *user, int do_validate) * Webcit limits to 6 as does the code here but there are 7 in axdefs.h */ scr_printf("Current access level: %d (%s)\n", ax, axdefs[ax]); - } else { + } + else { scr_printf("%s\n%s\n", user, &cmd[4]); } if (resp) @@ -429,8 +425,7 @@ int val_user(CtdlIPC * ipc, char *user, int do_validate) /* * Validate new users */ -void validate(CtdlIPC * ipc) -{ +void validate(CtdlIPC * ipc) { char cmd[256]; char buf[256]; int finished = 0; @@ -451,8 +446,7 @@ void validate(CtdlIPC * ipc) } -void subshell(void) -{ +void subshell(void) { int a, b; stty_ctdl(SB_RESTORE); @@ -473,8 +467,7 @@ void subshell(void) /* * <.A>ide ile elete command */ -void deletefile(CtdlIPC * ipc) -{ +void deletefile(CtdlIPC * ipc) { char filename[32]; char buf[256]; @@ -489,8 +482,7 @@ void deletefile(CtdlIPC * ipc) /* * <.A>ide ile ove command */ -void movefile(CtdlIPC * ipc) -{ +void movefile(CtdlIPC * ipc) { char filename[64]; char newroom[ROOMNAMELEN]; char buf[256]; @@ -507,8 +499,7 @@ void movefile(CtdlIPC * ipc) /* * list of users who have filled out a bio */ -void list_bio(CtdlIPC * ipc) -{ +void list_bio(CtdlIPC * ipc) { char buf[256]; char *resp = NULL; int pos = 1; diff --git a/textclient/tuiconfig.c b/textclient/tuiconfig.c index 12038ba91..209ff2463 100644 --- a/textclient/tuiconfig.c +++ b/textclient/tuiconfig.c @@ -71,10 +71,12 @@ void do_system_configuration(CtdlIPC * ipc) { strprompt("Initial access level for new users", &sc[6][0], 1); strprompt("Access level required to create rooms", &sc[19][0], 1); snprintf(sc[67], sizeof sc[67], "%d", (boolprompt("Allow anonymous guest logins", atoi(&sc[67][0])))); - snprintf(sc[4], sizeof sc[4], "%d", (boolprompt("Automatically give room admin privs to a user who creates a private room", atoi(&sc[4][0])))); + snprintf(sc[4], sizeof sc[4], "%d", + (boolprompt("Automatically give room admin privs to a user who creates a private room", atoi(&sc[4][0])))); snprintf(sc[8], sizeof sc[8], "%d", (boolprompt("Automatically move problem user messages to twit room", atoi(&sc[8][0])))); strprompt("Name of twit room", &sc[9][0], ROOMNAMELEN); - snprintf(sc[11], sizeof sc[11], "%d", (boolprompt("Restrict Internet mail to only those with that privilege", atoi(&sc[11][0])))); + snprintf(sc[11], sizeof sc[11], "%d", + (boolprompt("Restrict Internet mail to only those with that privilege", atoi(&sc[11][0])))); snprintf(sc[26], sizeof sc[26], "%d", (boolprompt("Allow admins to Zap (forget) rooms", atoi(&sc[26][0])))); if (!IsEmptyStr(&sc[18][0])) { @@ -129,8 +131,10 @@ void do_system_configuration(CtdlIPC * ipc) { a = (a ? 0 : 1); snprintf(sc[61], sizeof sc[61], "%d", a); - snprintf(sc[45], sizeof sc[45], "%d", (boolprompt("Allow unauthenticated SMTP clients to spoof my domains", atoi(&sc[45][0])))); - snprintf(sc[57], sizeof sc[57], "%d", (boolprompt("Perform RBL checks at greeting instead of after RCPT", atoi(&sc[57][0])))); + snprintf(sc[45], sizeof sc[45], "%d", + (boolprompt("Allow unauthenticated SMTP clients to spoof my domains", atoi(&sc[45][0])))); + snprintf(sc[57], sizeof sc[57], "%d", + (boolprompt("Perform RBL checks at greeting instead of after RCPT", atoi(&sc[57][0])))); // LDAP settings if (ipc->ServInfo.supports_ldap) { @@ -206,7 +210,8 @@ void do_system_configuration(CtdlIPC * ipc) { strprompt("Default frequency to run POP3 collection (in seconds)", &sc[64][0], 5); strprompt("Fastest frequency to run POP3 collection (in seconds)", &sc[65][0], 5); strprompt("Hour to run purges (0-23)", &sc[31][0], 2); - snprintf(sc[42], sizeof sc[42], "%d", (boolprompt("Enable full text search index (warning: resource intensive)", atoi(&sc[42][0])))); + snprintf(sc[42], sizeof sc[42], "%d", + (boolprompt("Enable full text search index (warning: resource intensive)", atoi(&sc[42][0])))); snprintf(sc[46], sizeof sc[46], "%d", (boolprompt("Perform journaling of email messages", atoi(&sc[46][0])))); snprintf(sc[47], sizeof sc[47], "%d", (boolprompt("Perform journaling of non-email messages", atoi(&sc[47][0])))); if ((atoi(&sc[46][0])) || (atoi(&sc[47][0]))) { @@ -637,7 +642,8 @@ void do_pop3client_configuration(CtdlIPC * ipc) { ++num_recs; if (num_recs == 1) { recs = malloc(sizeof(char *)); - } else { + } + else { recs = realloc(recs, (sizeof(char *)) * num_recs); } strcpy(buf, "pop3client|"); -- 2.30.2