indent -kr -i8 -l132 on everything in textclient
authorArt Cancro <ajc@citadel.org>
Fri, 27 Jul 2018 15:46:27 +0000 (11:46 -0400)
committerArt Cancro <ajc@citadel.org>
Fri, 27 Jul 2018 15:46:27 +0000 (11:46 -0400)
13 files changed:
textclient/citadel.c
textclient/citadel_ipc.c
textclient/client_chat.c
textclient/client_passwords.c
textclient/commands.c
textclient/ipc_c_tcp.c
textclient/md5.c
textclient/messages.c
textclient/rooms.c
textclient/routines.c
textclient/routines2.c
textclient/screen.c
textclient/tuiconfig.c

index b8c5343..9995103 100644 (file)
@@ -34,11 +34,11 @@ unsigned room_flags;
 unsigned room_flags2;
 int entmsg_ok = 0;
 char room_name[ROOMNAMELEN];
-char *uglist[UGLISTLEN]; /* size of the ungoto list */
-long uglistlsn[UGLISTLEN]; /* current read position for all the ungoto's. Not going to make any friends with this one. */
+char *uglist[UGLISTLEN];       /* size of the ungoto list */
+long uglistlsn[UGLISTLEN];     /* current read position for all the ungoto's. Not going to make any friends with this one. */
 int uglistsize = 0;
 char is_mail = 0;              /* nonzero when we're in a mail room */
-char axlevel = AxDeleted;              /* access level */
+char axlevel = AxDeleted;      /* access level */
 char is_room_aide = 0;         /* boolean flag, 1 if room admin */
 int timescalled;
 int posted;
@@ -71,7 +71,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;
 
@@ -110,8 +110,8 @@ void ctdl_logoff(char *file, int line, CtdlIPC *ipc, int code)
        stty_ctdl(SB_RESTORE);  /* return the old terminal settings */
        /* 
         * uncomment the following if you need to know why Citadel exited
-       printf("*** Exit code %d at %s:%d\n", code, file, line);
-       sleep(2);
+        printf("*** Exit code %d at %s:%d\n", code, file, line);
+        sleep(2);
         */
        exit(code);             /* exit with the proper exit code */
 }
@@ -142,7 +142,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];
@@ -160,13 +160,13 @@ void formout(CtdlIPC *ipc, char *name)
 }
 
 
-void userlist(CtdlIPC *ipc, char *patn)
+void userlist(CtdlIPC * ipc, char *patn)
 {
        char buf[SIZ];
        char fl[SIZ];
        struct tm tmbuf;
        time_t lc;
-       int r;                          /* IPC response code */
+       int r;                  /* IPC response code */
        char *listing = NULL;
 
        r = CtdlIPCUserListing(ipc, patn, &listing, buf);
@@ -177,27 +177,24 @@ void userlist(CtdlIPC *ipc, char *patn)
 
        scr_printf("       User Name           Num  L Last Visit Logins Messages\n");
        scr_printf("------------------------- ----- - ---------- ------ --------\n");
-       if (listing != NULL) while (!IsEmptyStr(listing)) {
-               extract_token(buf, listing, 0, '\n', sizeof buf);
-               remove_token(listing, 0, '\n');
-
-               if (sigcaught == 0) {
-                   extract_token(fl, buf, 0, '|', sizeof fl);
-                   if (pattern(fl, patn) >= 0) {
-                       scr_printf("%-25s ", fl);
-                       scr_printf("%5ld %d ", extract_long(buf, 2),
-                              extract_int(buf, 1));
-                       lc = extract_long(buf, 3);
-                       localtime_r(&lc, &tmbuf);
-                       scr_printf("%02d/%02d/%04d ",
-                              (tmbuf.tm_mon + 1),
-                              tmbuf.tm_mday,
-                              (tmbuf.tm_year + 1900));
-                       scr_printf("%6ld %8ld\n", extract_long(buf, 4), extract_long(buf, 5));
-                   }
+       if (listing != NULL)
+               while (!IsEmptyStr(listing)) {
+                       extract_token(buf, listing, 0, '\n', sizeof buf);
+                       remove_token(listing, 0, '\n');
+
+                       if (sigcaught == 0) {
+                               extract_token(fl, buf, 0, '|', sizeof fl);
+                               if (pattern(fl, patn) >= 0) {
+                                       scr_printf("%-25s ", fl);
+                                       scr_printf("%5ld %d ", extract_long(buf, 2), extract_int(buf, 1));
+                                       lc = extract_long(buf, 3);
+                                       localtime_r(&lc, &tmbuf);
+                                       scr_printf("%02d/%02d/%04d ", (tmbuf.tm_mon + 1), tmbuf.tm_mday, (tmbuf.tm_year + 1900));
+                                       scr_printf("%6ld %8ld\n", extract_long(buf, 4), extract_long(buf, 5));
+                               }
 
+                       }
                }
-       }
        free(listing);
        scr_printf("\n");
 }
@@ -291,7 +288,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;
@@ -299,30 +296,30 @@ void dotgoto(CtdlIPC *ipc, char *towhere, int display_name, int fromungoto)
        int partial_match, best_match;
        char from_floor;
        int ugpos = uglistsize;
-       int r;                          /* IPC result code */
+       int r;                  /* IPC result code */
        struct ctdlipcroom *room = NULL;
        int rv = 0;
 
        /* store ungoto information */
        if (fromungoto == 0) {
                /* sloppy slide them all down, hey it's the client, who cares. :-) */
-               if (uglistsize >= (UGLISTLEN-1)) {
+               if (uglistsize >= (UGLISTLEN - 1)) {
                        int lp;
-                       free (uglist[0]);
-                       for (lp = 0; lp < (UGLISTLEN-1); lp++) {
-                               uglist[lp] = uglist[lp+1];
-                               uglistlsn[lp] = uglistlsn[lp+1];
+                       free(uglist[0]);
+                       for (lp = 0; lp < (UGLISTLEN - 1); lp++) {
+                               uglist[lp] = uglist[lp + 1];
+                               uglistlsn[lp] = uglistlsn[lp + 1];
                        }
                        ugpos--;
                } else {
                        uglistsize++;
                }
-        
-               uglist[ugpos] = malloc(strlen(room_name)+1);
+
+               uglist[ugpos] = malloc(strlen(room_name) + 1);
                strcpy(uglist[ugpos], room_name);
                uglistlsn[ugpos] = ls;
        }
-      
+
        /* first try an exact match */
        r = CtdlIPCGotoRoom(ipc, towhere, "", &room, aaa);
        if (r / 10 == 54) {
@@ -332,7 +329,7 @@ void dotgoto(CtdlIPC *ipc, char *towhere, int display_name, int fromungoto)
                        scr_printf("Wrong password.\n");
                        return;
                }
-       }       
+       }
 
        /*
         * If a match is not found, try a partial match.
@@ -390,15 +387,15 @@ void dotgoto(CtdlIPC *ipc, char *towhere, int display_name, int fromungoto)
        /* Determine, based on the room's default view, whether an <E>nter message
         * command will be valid here.
         */
-       switch(room->RRdefaultview) {
-               case VIEW_BBS:
-               case VIEW_MAILBOX:
-               case VIEW_BLOG:
-                                       entmsg_ok = 1;
-                                       break;
-               default:
-                                       entmsg_ok = 0;
-                                       break;
+       switch (room->RRdefaultview) {
+       case VIEW_BBS:
+       case VIEW_MAILBOX:
+       case VIEW_BLOG:
+               entmsg_ok = 1;
+               break;
+       default:
+               entmsg_ok = 0;
+               break;
        }
 
        remove_march(room_name, 0);
@@ -443,28 +440,22 @@ void dotgoto(CtdlIPC *ipc, char *towhere, int display_name, int fromungoto)
                color(BRIGHT_RED);
                if (newmailcount == 1) {
                        scr_printf("*** A new mail message has arrived.\n");
-               }
-               else {
-                       scr_printf("*** %d new mail messages have arrived.\n",
-                                       newmailcount);
+               } else {
+                       scr_printf("*** %d new mail messages have arrived.\n", newmailcount);
                }
                color(DIM_WHITE);
                if (!IsEmptyStr(rc_gotmail_cmd)) {
                        rv = system(rc_gotmail_cmd);
-                       if (rv) 
-                               scr_printf("*** failed to check for mail calling %s Reason %d.\n",
-                                          rc_gotmail_cmd, rv);
+                       if (rv)
+                               scr_printf("*** failed to check for mail calling %s Reason %d.\n", rc_gotmail_cmd, rv);
                }
        }
        free(room);
 
-       if (screenwidth>5) snprintf(&status_line[1], screenwidth-1, "%s  |  %s  |  %s  |  %s  |  %d new mail  |",
-               (secure ? "Encrypted" : "Unencrypted"),
-               ipc->ServInfo.humannode,
-               ipc->ServInfo.site_location,
-               room_name,
-               newmailcount
-       );
+       if (screenwidth > 5)
+               snprintf(&status_line[1], screenwidth - 1, "%s  |  %s  |  %s  |  %s  |  %d new mail  |",
+                        (secure ? "Encrypted" : "Unencrypted"),
+                        ipc->ServInfo.humannode, ipc->ServInfo.site_location, room_name, newmailcount);
 }
 
 /* Goto next room having unread messages.
@@ -472,7 +463,7 @@ void dotgoto(CtdlIPC *ipc, char *towhere, int display_name, int fromungoto)
  * user back to the lobby when done.  The room we end up in is placed in
  * newroom - which is set to 0 (the lobby) initially.
  */
-void gotonext(CtdlIPC *ipc)
+void gotonext(CtdlIPC * ipc)
 {
        char buf[SIZ];
        struct march *mptr, *mptr2;
@@ -482,8 +473,7 @@ void gotonext(CtdlIPC *ipc)
         * If it is, pop the first room off the list and go there.
         */
        if (marchptr == NULL) {
-               CtdlIPCKnownRooms(ipc, SubscribedRoomsWithNewMessages,
-                                 AllFloors, &marchptr, buf);
+               CtdlIPCKnownRooms(ipc, SubscribedRoomsWithNewMessages, AllFloors, &marchptr, buf);
 
 /* add _BASEROOM_ to the end of the march list, so the user will end up
  * in the system base room (usually the Lobby>) at the end of the loop
@@ -491,7 +481,7 @@ void gotonext(CtdlIPC *ipc)
                mptr = (struct march *) malloc(sizeof(struct march));
                mptr->next = NULL;
                mptr->march_order = 0;
-               mptr->march_floor = 0;
+               mptr->march_floor = 0;
                strcpy(mptr->march_name, "_BASEROOM_");
                if (marchptr == NULL) {
                        marchptr = mptr;
@@ -519,13 +509,13 @@ 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;
        struct ctdlipcroom *room = NULL;
-       int r;                          /* IPC response code */
+       int r;                  /* IPC response code */
 
        scr_printf("Forgetting all rooms on %s...\n", &floorlist[ffloor][0]);
        remove_march("_FLOOR_", ffloor);
@@ -547,28 +537,27 @@ void forget_all_rooms_on(CtdlIPC *ipc, int ffloor)
                flist = flist->next;
                free(fptr);
        }
-       if (room) free(room);
+       if (room)
+               free(room);
 }
 
 
 /*
  * 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;
 
-       if (mode == GF_GOTO) {          /* <;G>oto 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);
@@ -579,10 +568,10 @@ 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 */
+       int r;                  /* IPC response code */
        struct march *mptr;
        char buf[SIZ], targ[SIZ];
 
@@ -626,7 +615,7 @@ void gotofloor(CtdlIPC *ipc, char *towhere, int mode)
 
                /*. . . according to room order */
                if (mptr)
-           strcpy(targ, pop_march(tofloor, mptr));
+                       strcpy(targ, pop_march(tofloor, mptr));
                while (mptr) {
                        tmp = mptr->next;
                        free(mptr);
@@ -645,8 +634,8 @@ void gotofloor(CtdlIPC *ipc, char *towhere, int mode)
        r = CtdlIPCKnownRooms(ipc, AllAccessibleRooms, tofloor, &mptr, buf);
        if (r / 100 == 1) {
                struct march *tmp = mptr;
-               
-        /*. . . according to room order */
+
+               /*. . . according to room order */
                if (mptr)
                        strcpy(targ, pop_march(tofloor, mptr));
                while (mptr) {
@@ -710,11 +699,11 @@ 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 */
+       int r;                  /* IPC response code */
        char buf[SIZ];
        struct ctdlroomlisting *rl = NULL;
        struct ctdlroomlisting *rp;
@@ -735,8 +724,7 @@ void  gotoroomstep(CtdlIPC *ipc, int direction, int mode)
        for (mptr = listing; mptr != NULL; mptr = mptr->next) {
                list_it = 1;
 
-               if ( floor_mode 
-                        && (mptr->march_floor != curr_floor))
+               if (floor_mode && (mptr->march_floor != curr_floor))
                        list_it = 0;
 
                if (list_it) {
@@ -775,19 +763,19 @@ void  gotoroomstep(CtdlIPC *ipc, int direction, int mode)
 
        /* Find position of current room */
        room_tree_list_query(NULL, NULL, 0, NULL, NULL, NULL);
-       room_tree_list_query(rl,  room_name, 0, NULL, &rmslot, &rmtotal);
+       room_tree_list_query(rl, room_name, 0, NULL, &rmslot, &rmtotal);
 
-       if (direction == 0) { /* Previous room */
+       if (direction == 0) {   /* Previous room */
                /* If we're at the first room, wrap to the last room */
                if (rmslot == 0) {
                        rmslot = rmtotal - 1;
                } else {
                        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; 
+                       rmslot = 0;
                } else {
                        rmslot++;
                }
@@ -795,13 +783,13 @@ void  gotoroomstep(CtdlIPC *ipc, int direction, int mode)
 
        /* Get name of next/previous room */
        room_tree_list_query(NULL, NULL, 0, NULL, NULL, NULL);
-       room_tree_list_query(rl,  NULL, rmslot, rmname, NULL, NULL);
+       room_tree_list_query(rl, NULL, rmslot, rmname, NULL, NULL);
 
        /* Free the tree */
        room_tree_list_query(rl, NULL, 0, NULL, NULL, NULL);
 
-       if (mode == 0) { /* not skipping */
-           updatels(ipc);
+       if (mode == 0) {        /* not skipping */
+               updatels(ipc);
        }
 
        /* Free the room list */
@@ -818,55 +806,62 @@ void  gotoroomstep(CtdlIPC *ipc, int direction, int mode)
 /*
  * step through floors on system
  */
-void  gotofloorstep(CtdlIPC *ipc, int direction, int mode)
+void gotofloorstep(CtdlIPC * ipc, int direction, int mode)
 {
-       int  tofloor;
+       int tofloor;
 
        if (floorlist[0][0] == 0)
                load_floorlist(ipc);
 
-       empty_keep_going:
+      empty_keep_going:
 
-       if (direction == 0) { /* Previous floor */
-               if (curr_floor) tofloor = curr_floor - 1;
-               else tofloor = 127;
+       if (direction == 0) {   /* Previous floor */
+               if (curr_floor)
+                       tofloor = curr_floor - 1;
+               else
+                       tofloor = 127;
 
-               while (!floorlist[tofloor][0]) tofloor--;
-       } else {                   /* Next floor */
-               if (curr_floor < 127) tofloor = curr_floor + 1;
-               else tofloor = 0;
+               while (!floorlist[tofloor][0])
+                       tofloor--;
+       } else {                /* Next floor */
+               if (curr_floor < 127)
+                       tofloor = curr_floor + 1;
+               else
+                       tofloor = 0;
 
-               while (!floorlist[tofloor][0] && tofloor < 127) tofloor++;
-               if (!floorlist[tofloor][0])     tofloor = 0;
+               while (!floorlist[tofloor][0] && tofloor < 127)
+                       tofloor++;
+               if (!floorlist[tofloor][0])
+                       tofloor = 0;
        }
        /* ;g works when not in floor mode so . . . */
        if (!floor_mode) {
-               scr_printf("(%s)\n", floorlist[tofloor] );
+               scr_printf("(%s)\n", floorlist[tofloor]);
        }
 
        gotofloor(ipc, floorlist[tofloor], mode);
-       if (curr_floor != tofloor) { /* gotofloor failed */
-            curr_floor = tofloor;
-            goto empty_keep_going;
-       }            
+       if (curr_floor != tofloor) {    /* gotofloor failed */
+               curr_floor = tofloor;
+               goto empty_keep_going;
+       }
 }
 
 /* 
  * 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 */
-    char _fullname[USERNAME_SIZE];
+       char _fullname[USERNAME_SIZE];
        long _usernum;
        int _axlevel, _timescalled, _posted;
        time_t _lastcall;
        struct ctdluser *user = NULL;
 
-       /* get misc user info */   
+       /* get misc user info */
        r = CtdlIPCGetBio(ipc, fullname, &resp, buf);
        if (r / 100 != 1) {
                scr_printf("%s\n", buf);
@@ -876,11 +871,11 @@ void read_config(CtdlIPC *ipc)
        _usernum = extract_long(buf, 2);
        _axlevel = extract_int(buf, 3);
        _lastcall = extract_long(buf, 4);
-    _timescalled = extract_int(buf, 5);
+       _timescalled = extract_int(buf, 5);
        _posted = extract_int(buf, 6);
        free(resp);
        resp = NULL;
-   
+
        /* get preferences */
        r = CtdlIPCGetConfig(ipc, &user, buf);
        if (r / 100 != 2) {
@@ -891,35 +886,62 @@ void read_config(CtdlIPC *ipc)
 
        /* show misc user info */
        scr_printf("%s\nAccess level: %d (%s)\n"
-                  "User #%ld / %d Calls / %d Posts",
-                  _fullname, _axlevel, axdefs[(int) _axlevel],
-                  _usernum, _timescalled, _posted);
+                  "User #%ld / %d Calls / %d Posts", _fullname, _axlevel, axdefs[(int) _axlevel], _usernum, _timescalled, _posted);
        if (_lastcall > 0L) {
-               scr_printf(" / Curr login: %s",
-                          asctime(localtime(&_lastcall)));
+               scr_printf(" / Curr login: %s", asctime(localtime(&_lastcall)));
        }
        scr_printf("\n");
 
        /* show preferences */
-       scr_printf("Are you an experienced Citadel user: ");                   color(BRIGHT_CYAN); scr_printf("%s\n", (user->flags & US_EXPERT) ? "Yes" : "No");     color(DIM_WHITE);
-       scr_printf("Print last old message on New message request: ");         color(BRIGHT_CYAN); scr_printf("%s\n", (user->flags & US_LASTOLD)? "Yes" : "No");     color(DIM_WHITE);
-       scr_printf("Prompt after each message: ");                             color(BRIGHT_CYAN); scr_printf("%s\n", (!(user->flags & US_NOPROMPT))? "Yes" : "No"); color(DIM_WHITE);
+       scr_printf("Are you an experienced Citadel user: ");
+       color(BRIGHT_CYAN);
+       scr_printf("%s\n", (user->flags & US_EXPERT) ? "Yes" : "No");
+       color(DIM_WHITE);
+       scr_printf("Print last old message on New message request: ");
+       color(BRIGHT_CYAN);
+       scr_printf("%s\n", (user->flags & US_LASTOLD) ? "Yes" : "No");
+       color(DIM_WHITE);
+       scr_printf("Prompt after each message: ");
+       color(BRIGHT_CYAN);
+       scr_printf("%s\n", (!(user->flags & US_NOPROMPT)) ? "Yes" : "No");
+       color(DIM_WHITE);
        if ((user->flags & US_NOPROMPT) == 0) {
-       scr_printf("Use 'disappearing' prompts: ");                        color(BRIGHT_CYAN); scr_printf("%s\n", (user->flags & US_DISAPPEAR)? "Yes" : "No");   color(DIM_WHITE);
+               scr_printf("Use 'disappearing' prompts: ");
+               color(BRIGHT_CYAN);
+               scr_printf("%s\n", (user->flags & US_DISAPPEAR) ? "Yes" : "No");
+               color(DIM_WHITE);
        }
-       scr_printf("Pause after each screenful of text: ");                    color(BRIGHT_CYAN); scr_printf("%s\n", (user->flags & US_PAGINATOR)? "Yes" : "No");   color(DIM_WHITE);
-    if (rc_prompt_control == 3 && (user->flags & US_PAGINATOR)) {
-       scr_printf("<N>ext and <S>top work at paginator prompt: ");        color(BRIGHT_CYAN); scr_printf("%s\n", (user->flags & US_PROMPTCTL)? "Yes" : "No");   color(DIM_WHITE);
+       scr_printf("Pause after each screenful of text: ");
+       color(BRIGHT_CYAN);
+       scr_printf("%s\n", (user->flags & US_PAGINATOR) ? "Yes" : "No");
+       color(DIM_WHITE);
+       if (rc_prompt_control == 3 && (user->flags & US_PAGINATOR)) {
+               scr_printf("<N>ext and <S>top work at paginator prompt: ");
+               color(BRIGHT_CYAN);
+               scr_printf("%s\n", (user->flags & US_PROMPTCTL) ? "Yes" : "No");
+               color(DIM_WHITE);
        }
-    if (rc_floor_mode == RC_DEFAULT) {
-       scr_printf("View rooms by floor: ");                               color(BRIGHT_CYAN); scr_printf("%s\n", (user->flags & US_FLOORS)? "Yes" : "No");          color(DIM_WHITE);
+       if (rc_floor_mode == RC_DEFAULT) {
+               scr_printf("View rooms by floor: ");
+               color(BRIGHT_CYAN);
+               scr_printf("%s\n", (user->flags & US_FLOORS) ? "Yes" : "No");
+               color(DIM_WHITE);
        }
-       if (rc_ansi_color == 3) {
-           scr_printf("Enable color support: ");                              color(BRIGHT_CYAN); scr_printf("%s\n", (user->flags & US_COLOR)? "Yes" : "No");       color(DIM_WHITE);
+       if (rc_ansi_color == 3) {
+               scr_printf("Enable color support: ");
+               color(BRIGHT_CYAN);
+               scr_printf("%s\n", (user->flags & US_COLOR) ? "Yes" : "No");
+               color(DIM_WHITE);
        }
-       scr_printf("Be unlisted in userlog: ");                                color(BRIGHT_CYAN); scr_printf("%s\n", (user->flags & US_UNLISTED)? "Yes" : "No");    color(DIM_WHITE);
+       scr_printf("Be unlisted in userlog: ");
+       color(BRIGHT_CYAN);
+       scr_printf("%s\n", (user->flags & US_UNLISTED) ? "Yes" : "No");
+       color(DIM_WHITE);
        if (!IsEmptyStr(editor_path)) {
-       scr_printf("Always enter messages with the full-screen editor: "); color(BRIGHT_CYAN); scr_printf("%s\n", (user->flags & US_EXTEDIT)? "Yes" : "No");     color(DIM_WHITE);
+               scr_printf("Always enter messages with the full-screen editor: ");
+               color(BRIGHT_CYAN);
+               scr_printf("%s\n", (user->flags & US_EXTEDIT) ? "Yes" : "No");
+               color(DIM_WHITE);
        }
        free(user);
 }
@@ -927,12 +949,12 @@ 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;
-       int mrtg_users, mrtg_active_users; 
+       int mrtg_users, mrtg_active_users;
        char mrtg_server_uptime[40];
        long mrtg_himessage;
 
@@ -956,8 +978,8 @@ void system_info(CtdlIPC *ipc)
        CtdlIPCServerInfo(ipc, buf);
 
        scr_printf("You are connected to %s (%s) @%s\n", ipc->ServInfo.nodename, ipc->ServInfo.humannode, ipc->ServInfo.fqdn);
-       scr_printf("running %s with text client v%.2f,\n", ipc->ServInfo.software, (float)CLIENT_VERSION/100);
-       scr_printf("server build %s,\n", ipc->ServInfo.svn_revision, (float)CLIENT_VERSION/100);
+       scr_printf("running %s with text client v%.2f,\n", ipc->ServInfo.software, (float) CLIENT_VERSION / 100);
+       scr_printf("server build %s,\n", ipc->ServInfo.svn_revision, (float) CLIENT_VERSION / 100);
        scr_printf("and located in %s.\n", ipc->ServInfo.site_location);
        scr_printf("Connected users %d / Active users %d / Highest message #%ld\n", mrtg_users, mrtg_active_users, mrtg_himessage);
        scr_printf("Server uptime: %s\n", mrtg_server_uptime);
@@ -967,7 +989,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");
@@ -976,8 +998,7 @@ void forget_this_floor(CtdlIPC *ipc)
        if (floorlist[0][0] == 0) {
                load_floorlist(ipc);
        }
-       scr_printf("Are you sure you want to forget all rooms on %s? ",
-              &floorlist[(int) curr_floor][0]);
+       scr_printf("Are you sure you want to forget all rooms on %s? ", &floorlist[(int) curr_floor][0]);
        if (yesno() == 0) {
                return;
        }
@@ -989,7 +1010,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 */
@@ -1011,7 +1032,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];
@@ -1043,7 +1064,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];
 
@@ -1052,15 +1073,14 @@ void get_serv_info(CtdlIPC *ipc, char *supplied_hostname)
 
        /* be nice and identify ourself to the server */
        CtdlIPCIdentifySoftware(ipc, CLIENT_TYPE, 0, CLIENT_VERSION,
-                (ipc->isLocal ? "local" : "Citadel text mode client"),
-                (supplied_hostname) ? supplied_hostname : 
-                /* Look up the , in the bible if you're confused */
-                (locate_host(ipc, buf), buf), buf);
+                               (ipc->isLocal ? "local" : "Citadel text mode client"), (supplied_hostname) ? supplied_hostname :
+                               /* Look up the , in the bible if you're confused */
+                               (locate_host(ipc, buf), buf), buf);
 
        /* Indicate to the server that we prefer to decode Base64 and
         * quoted-printable on the client side.
         */
-       if ((CtdlIPCSpecifyPreferredFormats(ipc, buf, "dont_decode") / 100 ) != 2) {
+       if ((CtdlIPCSpecifyPreferredFormats(ipc, buf, "dont_decode") / 100) != 2) {
                scr_printf("ERROR: Extremely old server; MSG4 framework not supported.\n");
                logoff(ipc, 0);
        }
@@ -1073,7 +1093,7 @@ void get_serv_info(CtdlIPC *ipc, char *supplied_hostname)
         * isn't really all that great, it's probably better to just go with
         * the plain text when we have it available.
         */
-       if ((CtdlIPCSpecifyPreferredFormats(ipc, buf, "text/plain|text/html|text/x-markdown") / 100 ) != 2) {
+       if ((CtdlIPCSpecifyPreferredFormats(ipc, buf, "text/plain|text/html|text/x-markdown") / 100) != 2) {
                scr_printf("ERROR: Extremely old server; MSG4 framework not supported.\n");
                logoff(ipc, 0);
        }
@@ -1084,28 +1104,32 @@ 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, '|');
        u2 = strchr(rec2, '|');
 
-       return strcasecmp( (u1?++u1:"") , (u2?++u2:"") );
+       return strcasecmp((u1 ? ++u1 : ""), (u2 ? ++u2 : ""));
 }
 
 
 /*
  * 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);
        i2 = extract_long(rec2, 5);
 
-       if (i1 < i2) return(1);
-       if (i1 > i2) return(-1);
-       return(0);
+       if (i1 < i2)
+               return (1);
+       if (i1 > i2)
+               return (-1);
+       return (0);
 }
 
 
@@ -1117,7 +1141,8 @@ 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;
@@ -1126,18 +1151,19 @@ char *SortOnlineUsers(char *listing, int condense) {
 
        rows = num_tokens(listing, '\n');
        sortbuf = malloc(rows * SIZ);
-       if (sortbuf == NULL) return(listing);
+       if (sortbuf == NULL)
+               return (listing);
        retbuf = malloc(rows * SIZ);
        if (retbuf == NULL) {
                free(sortbuf);
-               return(listing);
+               return (listing);
        }
 
        /* Copy the list into a fixed-record-size array for sorting */
-       for (i=0; i<rows; ++i) {
+       for (i = 0; i < rows; ++i) {
                memset(buf, 0, SIZ);
                extract_token(buf, listing, i, '\n', sizeof buf);
-               memcpy(&sortbuf[i*SIZ], buf, (size_t)SIZ);
+               memcpy(&sortbuf[i * SIZ], buf, (size_t) SIZ);
        }
 
        /* Sort by idle time */
@@ -1146,32 +1172,35 @@ char *SortOnlineUsers(char *listing, int condense) {
        /* Combine multiple sessions for the same user */
        if (condense) {
                qsort(sortbuf, rows, SIZ, rwho_username_cmp);
-               if (rows > 1) for (i=1; i<rows; ++i) if (i>0) {
-                       char u1[USERNAME_SIZE];
-                       char u2[USERNAME_SIZE];
-                       extract_token(u1, &sortbuf[(i-1)*SIZ], 1, '|', sizeof u1);
-                       extract_token(u2, &sortbuf[i*SIZ], 1, '|', sizeof u2);
-                       if (!strcasecmp(u1, u2)) {
-                               memcpy(&sortbuf[i*SIZ], &sortbuf[(i+1)*SIZ], (rows-i-1)*SIZ);
-                               --rows;
-                               --i;
-                       }
-               }
+               if (rows > 1)
+                       for (i = 1; i < rows; ++i)
+                               if (i > 0) {
+                                       char u1[USERNAME_SIZE];
+                                       char u2[USERNAME_SIZE];
+                                       extract_token(u1, &sortbuf[(i - 1) * SIZ], 1, '|', sizeof u1);
+                                       extract_token(u2, &sortbuf[i * SIZ], 1, '|', sizeof u2);
+                                       if (!strcasecmp(u1, u2)) {
+                                               memcpy(&sortbuf[i * SIZ], &sortbuf[(i + 1) * SIZ], (rows - i - 1) * SIZ);
+                                               --rows;
+                                               --i;
+                                       }
+                               }
 
                qsort(sortbuf, rows, SIZ, idlecmp);     /* idle sort again */
        }
 
        /* Copy back to a \n delimited list */
        strcpy(retbuf, "");
-       for (i=0; i<rows; ++i) {
-               if (!IsEmptyStr(&sortbuf[i*SIZ])) {
-                       strcat(retbuf, &sortbuf[i*SIZ]);
-                       if (i<(rows-1)) strcat(retbuf, "\n");
+       for (i = 0; i < rows; ++i) {
+               if (!IsEmptyStr(&sortbuf[i * SIZ])) {
+                       strcat(retbuf, &sortbuf[i * SIZ]);
+                       if (i < (rows - 1))
+                               strcat(retbuf, "\n");
                }
        }
        free(listing);
        free(sortbuf);
-       return(retbuf);
+       return (retbuf);
 }
 
 
@@ -1179,7 +1208,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];
@@ -1190,8 +1219,8 @@ void who_is_online(CtdlIPC *ipc, int longlist)
        int last_session = (-1);
        int skipidle = 0;
        char *listing = NULL;
-       int r;                          /* IPC response code */
-    
+       int r;                  /* IPC response code */
+
        if (longlist == 2) {
                longlist = 0;
                skipidle = 1;
@@ -1200,11 +1229,13 @@ void who_is_online(CtdlIPC *ipc, int longlist)
        if (!longlist) {
                color(BRIGHT_WHITE);
                scr_printf("           User Name               Room          ");
-               if (screenwidth >= 80) scr_printf(" Idle        From host");
+               if (screenwidth >= 80)
+                       scr_printf(" Idle        From host");
                scr_printf("\n");
                color(DIM_WHITE);
                scr_printf("   ------------------------- --------------------");
-               if (screenwidth >= 80) scr_printf(" ---- ------------------------");
+               if (screenwidth >= 80)
+                       scr_printf(" ---- ------------------------");
                scr_printf("\n");
        }
        r = CtdlIPCOnlineUsers(ipc, &listing, &timenow, buf);
@@ -1212,7 +1243,7 @@ void who_is_online(CtdlIPC *ipc, int longlist)
        if (r / 100 == 1) {
                while (!IsEmptyStr(listing)) {
                        int isidle = 0;
-                       
+
                        /* Get another line */
                        extract_token(buf, listing, 0, '\n', sizeof buf);
                        remove_token(listing, 0, '\n');
@@ -1245,37 +1276,34 @@ void who_is_online(CtdlIPC *ipc, int longlist)
                                scr_printf("In room: %s\n", roomname);
                                scr_printf("   Host: %s\n", fromhost);
                                scr_printf(" Client: %s\n", clientsoft);
-                               scr_printf("   Idle: %ld:%02ld:%02ld\n",
-                                       (long) idlehours,
-                                       (long) idlemins,
-                                       (long) idlesecs);
-
-                               if ( (!IsEmptyStr(actual_user)&&
-                                     !IsEmptyStr(actual_room)&&
-                                     !IsEmptyStr(actual_host))) {
+                               scr_printf("   Idle: %ld:%02ld:%02ld\n", (long) idlehours, (long) idlemins, (long) idlesecs);
+
+                               if ((!IsEmptyStr(actual_user) && !IsEmptyStr(actual_room) && !IsEmptyStr(actual_host))) {
                                        scr_printf("(really ");
-                                       if (!IsEmptyStr(actual_user)) scr_printf("<%s> ", actual_user);
-                                       if (!IsEmptyStr(actual_room)) scr_printf("in <%s> ", actual_room);
-                                       if (!IsEmptyStr(actual_host)) scr_printf("from <%s> ", actual_host);
+                                       if (!IsEmptyStr(actual_user))
+                                               scr_printf("<%s> ", actual_user);
+                                       if (!IsEmptyStr(actual_room))
+                                               scr_printf("in <%s> ", actual_room);
+                                       if (!IsEmptyStr(actual_host))
+                                               scr_printf("from <%s> ", actual_host);
                                        scr_printf(")\n");
                                }
                                scr_printf("\n");
 
                        } else {
                                if (isidle == 0) {
-                                       if (extract_int(buf, 0) == last_session) {
-                                               scr_printf("        ");
-                                       }
-                                       else {
-                                               color(BRIGHT_MAGENTA);
-                                               scr_printf("%-3s", flags);
-                                       }
-                                       last_session = extract_int(buf, 0);
-                                       color(BRIGHT_CYAN);
-                                       scr_printf("%-25s ", username);
-                                       color(BRIGHT_MAGENTA);
-                                       roomname[20] = 0;
-                                       scr_printf("%-20s", roomname);
+                                       if (extract_int(buf, 0) == last_session) {
+                                               scr_printf("        ");
+                                       } else {
+                                               color(BRIGHT_MAGENTA);
+                                               scr_printf("%-3s", flags);
+                                       }
+                                       last_session = extract_int(buf, 0);
+                                       color(BRIGHT_CYAN);
+                                       scr_printf("%-25s ", username);
+                                       color(BRIGHT_MAGENTA);
+                                       roomname[20] = 0;
+                                       scr_printf("%-20s", roomname);
 
                                        if (screenwidth >= 80) {
                                                scr_printf(" ");
@@ -1283,38 +1311,34 @@ void who_is_online(CtdlIPC *ipc, int longlist)
                                                        /* over 1000d, must be gone fishing */
                                                        if (idlehours > 23999) {
                                                                scr_printf("fish");
-                                                       /* over 10 days */
+                                                               /* over 10 days */
                                                        } else if (idlehours > 239) {
                                                                scr_printf("%3ldd", idlehours / 24);
-                                                       /* over 10 hours */
+                                                               /* over 10 hours */
                                                        } else if (idlehours > 9) {
-                                                               scr_printf("%1ldd%02ld",
-                                                                       idlehours / 24,
-                                                                       idlehours % 24);
-                                                       /* less than 10 hours */
-                                                       }
-                                                       else {
+                                                               scr_printf("%1ldd%02ld", idlehours / 24, idlehours % 24);
+                                                               /* less than 10 hours */
+                                                       } else {
                                                                scr_printf("%1ld:%02ld", idlehours, idlemins);
                                                        }
-                                               }
-                                               else {
+                                               } else {
                                                        scr_printf("    ");
                                                }
                                                scr_printf(" ");
-                                               color(BRIGHT_CYAN);
-                                               fromhost[24] = '\0';
-                                               scr_printf("%-24s", fromhost);
+                                               color(BRIGHT_CYAN);
+                                               fromhost[24] = '\0';
+                                               scr_printf("%-24s", fromhost);
                                        }
                                        scr_printf("\n");
-                                       color(DIM_WHITE);
-                               }
+                                       color(DIM_WHITE);
+                               }
                        }
                }
        }
        free(listing);
 }
 
-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);
@@ -1323,17 +1347,19 @@ void enternew(CtdlIPC *ipc, char *desc, char *buf, int maxlen)
 
 
 
-int shift(int argc, char **argv, int start, int count) {
+int shift(int argc, char **argv, int start, int count)
+{
        int i;
 
-       for (i=start; i<(argc-count); ++i) {
-               argv[i] = argv[i+count];
+       for (i = start; i < (argc - count); ++i) {
+               argv[i] = argv[i + count];
        }
        argc = argc - count;
        return argc;
 }
 
-static void statusHook(char *s) {
+static void statusHook(char *s)
+{
        scr_printf(s);
 }
 
@@ -1343,7 +1369,7 @@ static void statusHook(char *s) {
 int main(int argc, char **argv)
 {
        int a, b, mcmd;
-       char aaa[100], bbb[100];/* general purpose variables */
+       char aaa[100], bbb[100];        /* general purpose variables */
        char argbuf[64];        /* command line buf */
        char nonce[NONCE_SIZE];
        char *telnet_client_host = NULL;
@@ -1352,15 +1378,15 @@ int main(int argc, char **argv)
        char password[SIZ];
        struct ctdlipcmisc chek;
        struct ctdluser *myself = NULL;
-       CtdlIPC* ipc;                   /* Our server connection */
-       int r;                          /* IPC result code */
-       int rv = 0;                     /* fetch but ignore syscall return value to suppress warnings */
-
-       int relh=0;
-       int home=0;
-       char relhome[PATH_MAX]="";
-       char ctdldir[PATH_MAX]=CTDLDIR;
-    int lp; 
+       CtdlIPC *ipc;           /* Our server connection */
+       int r;                  /* IPC result code */
+       int rv = 0;             /* fetch but ignore syscall return value to suppress warnings */
+
+       int relh = 0;
+       int home = 0;
+       char relhome[PATH_MAX] = "";
+       char ctdldir[PATH_MAX] = CTDLDIR;
+       int lp;
        calc_dirs_n_files(relh, home, relhome, ctdldir, 0);
 
 #ifdef HAVE_BACKTRACE
@@ -1368,17 +1394,17 @@ int main(int argc, char **argv)
        params.debugLevel = ECRASH_DEBUG_VERBOSE;
        params.dumpAllThreads = TRUE;
        params.useBacktraceSymbols = 1;
-       params.signals[0]=SIGSEGV;
-       params.signals[1]=SIGILL;
-       params.signals[2]=SIGBUS;
-       params.signals[3]=SIGABRT;
-#endif 
+       params.signals[0] = SIGSEGV;
+       params.signals[1] = SIGILL;
+       params.signals[2] = SIGBUS;
+       params.signals[3] = SIGABRT;
+#endif
        setIPCErrorPrintf(scr_printf);
        setCryptoStatusHook(statusHook);
-       
-       stty_ctdl(SB_SAVE);             /* Store the old terminal parameters */
-       load_command_set();             /* parse the citadel.rc file */
-       stty_ctdl(SB_NO_INTR);          /* Install the new ones */
+
+       stty_ctdl(SB_SAVE);     /* Store the old terminal parameters */
+       load_command_set();     /* parse the citadel.rc file */
+       stty_ctdl(SB_NO_INTR);  /* Install the new ones */
        signal(SIGPIPE, dropcarr);      /* Cleanup gracefully if local conn. dropped */
        signal(SIGTERM, dropcarr);      /* Cleanup gracefully if terminated */
        signal(SIGCONT, catch_sigcont); /* Catch SIGCONT so we can reset terminal */
@@ -1394,9 +1420,9 @@ int main(int argc, char **argv)
         * Handle command line options as if we were called like /bin/login
         * (i.e. from in.telnetd)
         */
-       for (a=0; a<argc; ++a) {
-               if ((argc > a+1) && (!strcmp(argv[a], "-h")) ) {
-                       telnet_client_host = argv[a+1];
+       for (a = 0; a < argc; ++a) {
+               if ((argc > a + 1) && (!strcmp(argv[a], "-h"))) {
+                       telnet_client_host = argv[a + 1];
                        argc = shift(argc, argv, a, 2);
                }
                if (!strcmp(argv[a], "-x")) {
@@ -1419,7 +1445,7 @@ int main(int argc, char **argv)
                        argc = shift(argc, argv, a, 1);
                }
        }
-       
+
        screen_new();
        /* Get screen dimensions.  First we go to a default of 80x24.
         * Then attempt to read the actual screen size from the terminal.
@@ -1455,24 +1481,18 @@ int main(int argc, char **argv)
        /* If there is a [nonce] at the end, put the nonce in <nonce>, else nonce
         * is zeroized.
         */
-       
-       if ((sptr = strchr(aaa, '<')) == NULL)
-               {
+
+       if ((sptr = strchr(aaa, '<')) == NULL) {
+               nonce[0] = '\0';
+       } else {
+               if ((sptr2 = strchr(sptr, '>')) == NULL) {
                        nonce[0] = '\0';
+               } else {
+                       sptr2++;
+                       *sptr2 = '\0';
+                       strncpy(nonce, sptr, (size_t) NONCE_SIZE);
                }
-       else
-               {
-                       if ((sptr2 = strchr(sptr, '>')) == NULL)
-                               {
-                                       nonce[0] = '\0';
-                               }
-                       else
-                               {
-                                       sptr2++;
-                                       *sptr2 = '\0';
-                                       strncpy(nonce, sptr, (size_t)NONCE_SIZE);
-                               }
-               }
+       }
 
 #ifdef HAVE_OPENSSL
        /* Evaluate encryption preferences */
@@ -1486,22 +1506,23 @@ int main(int argc, char **argv)
 #endif
 
        get_serv_info(ipc, telnet_client_host);
-       scr_printf("%-24s\n%s\n%s\n", ipc->ServInfo.software, ipc->ServInfo.humannode,
-                  ipc->ServInfo.site_location);
+       scr_printf("%-24s\n%s\n%s\n", ipc->ServInfo.software, ipc->ServInfo.humannode, ipc->ServInfo.site_location);
 
        scr_printf(" pause    next    stop\n");
        scr_printf(" ctrl-s  ctrl-o  ctrl-c\n\n");
        formout(ipc, "hello");  /* print the opening greeting */
        scr_printf("\n");
 
GSTA: /* See if we have a username and password on disk */
     GSTA:                    /* See if we have a username and password on disk */
        if (rc_remember_passwords) {
                get_stored_password(hostbuf, portbuf, fullname, password);
                if (!IsEmptyStr(fullname)) {
                        r = CtdlIPCTryLogin(ipc, fullname, aaa);
                        if (r / 100 == 3) {
                                if (*nonce) {
-                                       r = CtdlIPCTryApopPassword(ipc, make_apop_string(password, nonce, hexstring, sizeof hexstring), aaa);
+                                       r = CtdlIPCTryApopPassword(ipc,
+                                                                  make_apop_string(password, nonce, hexstring, sizeof hexstring),
+                                                                  aaa);
                                } else {
                                        r = CtdlIPCTryPassword(ipc, password, aaa);
                                }
@@ -1528,8 +1549,7 @@ int main(int argc, char **argv)
                if (!strcasecmp(fullname, "new")) {     /* just in case */
                        scr_printf("Please enter the name you wish to log in with.\n");
                }
-       } while (
-                (!strcasecmp(fullname, "bbs"))
+       } while ((!strcasecmp(fullname, "bbs"))
                 || (!strcasecmp(fullname, "new"))
                 || (IsEmptyStr(fullname)));
 
@@ -1539,7 +1559,7 @@ int main(int argc, char **argv)
        }
 
        /* FIXME this is a stupid way to do guest mode but it's a reasonable test harness FIXME */
-       if ( (ipc->ServInfo.guest_logins) && (!strcasecmp(fullname, "guest")) ) {
+       if ((ipc->ServInfo.guest_logins) && (!strcasecmp(fullname, "guest"))) {
                goto PWOK;
        }
 
@@ -1552,7 +1572,7 @@ int main(int argc, char **argv)
        if (!IsEmptyStr(rc_password)) {
                strcpy(password, rc_password);
        } else {
-               newprompt("\rPlease enter your password: ", password, -(SIZ-1));
+               newprompt("\rPlease enter your password: ", password, -(SIZ - 1));
        }
 
        if (*nonce) {
@@ -1568,11 +1588,10 @@ int main(int argc, char **argv)
                        r = CtdlIPCTryPassword(ipc, password, aaa);
                }
        }
-       
+
        if (r / 100 == 2) {
                load_user_info(aaa);
-               offer_to_remember_password(ipc, hostbuf, portbuf,
-                                          fullname, password);
+               offer_to_remember_password(ipc, hostbuf, portbuf, fullname, password);
                goto PWOK;
        }
        scr_printf("<< wrong password >>\n");
@@ -1580,14 +1599,13 @@ int main(int argc, char **argv)
                logoff(ipc, 2);
        goto GSTA;
 
-NEWUSR:        if (IsEmptyStr(rc_password)) {
+      NEWUSR:if (IsEmptyStr(rc_password)) {
                scr_printf("'%s' not found.\n", fullname);
                scr_printf("Type 'off' if you would like to exit.\n");
                if (ipc->ServInfo.newuser_disabled == 1) {
                        goto GSTA;
                }
-               scr_printf("Do you want to create a new user account called '%s'? ",
-                       fullname);
+               scr_printf("Do you want to create a new user account called '%s'? ", fullname);
                if (yesno() == 0) {
                        goto GSTA;
                }
@@ -1605,7 +1623,7 @@ NEWUSR:   if (IsEmptyStr(rc_password)) {
 
        enter_config(ipc, 1);
 
- PWOK:
     PWOK:
        /* Switch color support on or off if we're in user mode */
        if (rc_ansi_color == 3) {
                if (userflags & US_COLOR)
@@ -1616,12 +1634,9 @@ NEWUSR:  if (IsEmptyStr(rc_password)) {
 
        color(BRIGHT_WHITE);
        scr_printf("\n%s\nAccess level: %d (%s)\n"
-                  "User #%ld / Login #%d",
-                  fullname, axlevel, axdefs[(int) axlevel],
-                  usernum, timescalled);
+                  "User #%ld / Login #%d", fullname, axlevel, axdefs[(int) axlevel], usernum, timescalled);
        if (lastcall > 0L) {
-               scr_printf(" / Last login: %s",
-                          asctime(localtime(&lastcall)));
+               scr_printf(" / Last login: %s", asctime(localtime(&lastcall)));
        }
        scr_printf("\n");
 
@@ -1638,8 +1653,7 @@ NEWUSR:   if (IsEmptyStr(rc_password)) {
                        if (!IsEmptyStr(rc_gotmail_cmd)) {
                                rv = system(rc_gotmail_cmd);
                                if (rv)
-                                       scr_printf("*** failed to check for mail calling %s Reason %d.\n",
-                                                  rc_gotmail_cmd, rv);
+                                       scr_printf("*** failed to check for mail calling %s Reason %d.\n", rc_gotmail_cmd, rv);
 
                        }
                }
@@ -1667,7 +1681,7 @@ NEWUSR:   if (IsEmptyStr(rc_password)) {
        dotgoto(ipc, "_BASEROOM_", 1, 0);
 
        /* Main loop for the system... user is logged in. */
-    free(uglist[0]);
+       free(uglist[0]);
        uglistsize = 0;
 
        if (newnow == 1)
@@ -1680,7 +1694,7 @@ NEWUSR:   if (IsEmptyStr(rc_password)) {
                mcmd = getcmd(ipc, argbuf);     /* Get keyboard command */
 
 #ifdef TIOCGWINSZ
-               check_screen_dims();            /* get screen size */
+               check_screen_dims();    /* get screen size */
 #endif
 
                if (termn8 == 0)
@@ -1700,17 +1714,17 @@ NEWUSR: if (IsEmptyStr(rc_password)) {
                        case 78:
                                entmsg(ipc, 0, ((userflags & US_EXTEDIT) ? 2 : 0), 1);
                                break;
-                       case 5:                         /* <G>oto */
+                       case 5: /* <G>oto */
                                updatels(ipc);
                                gotonext(ipc);
                                break;
-                       case 47:                        /* <A>bandon */
+                       case 47:        /* <A>bandon */
                                gotonext(ipc);
                                break;
-                       case 90:                        /* <.A>bandon */
+                       case 90:        /* <.A>bandon */
                                dotgoto(ipc, argbuf, 0, 0);
                                break;
-                       case 58:                        /* <M>ail */
+                       case 58:        /* <M>ail */
                                updatelsa(ipc);
                                dotgoto(ipc, "_MAIL_", 1, 0);
                                break;
@@ -1725,7 +1739,7 @@ NEWUSR:   if (IsEmptyStr(rc_password)) {
                                        dotgoto(ipc, argbuf, 0, 0);
                                }
                                break;
-                       case 95: /* what exactly is the numbering scheme supposed to be anyway? --Ford, there isn't one. -IO */
+                       case 95:        /* what exactly is the numbering scheme supposed to be anyway? --Ford, there isn't one. -IO */
                                dotungoto(ipc, argbuf);
                                break;
                        case 10:
@@ -1744,8 +1758,7 @@ NEWUSR:   if (IsEmptyStr(rc_password)) {
                                readmsgs(ipc, OldMessages, ReadReverse, 0);
                                break;
                        case 71:
-                               readmsgs(ipc, LastMessages, ReadForward,
-                                               atoi(argbuf));
+                               readmsgs(ipc, LastMessages, ReadForward, atoi(argbuf));
                                break;
                        case 7:
                                forget(ipc);
@@ -1879,8 +1892,7 @@ NEWUSR:   if (IsEmptyStr(rc_password)) {
                                break;
 
                        case 85:
-                               scr_printf("All users will be disconnected!  "
-                                          "Really terminate the server? ");
+                               scr_printf("All users will be disconnected!  " "Really terminate the server? ");
                                if (yesno() == 1) {
                                        updatels(ipc);
                                        r = CtdlIPCTerminateServerNow(ipc, aaa);
@@ -1893,19 +1905,15 @@ NEWUSR: if (IsEmptyStr(rc_password)) {
                                break;
 
                        case 86:
-                               scr_printf("Do you really want to schedule a "
-                                          "server shutdown? ");
+                               scr_printf("Do you really want to schedule a " "server shutdown? ");
                                if (yesno() == 1) {
                                        r = CtdlIPCTerminateServerScheduled(ipc, 1, aaa);
                                        if (r / 100 == 2) {
                                                if (atoi(aaa)) {
-                                                       scr_printf(
-                                                                  "The Citadel server will terminate when all users are logged off.\n"
-                                                                  );
+                                                       scr_printf
+                                                           ("The Citadel server will terminate when all users are logged off.\n");
                                                } else {
-                                                       scr_printf(
-                                                                  "The Citadel server will not terminate.\n"
-                                                                  );
+                                                       scr_printf("The Citadel server will not terminate.\n");
                                                }
                                        }
                                }
@@ -1938,7 +1946,7 @@ NEWUSR:   if (IsEmptyStr(rc_password)) {
                        case 91:
                                who_is_online(ipc, 2);
                                break;
-                
+
                        case 80:
                                do_system_configuration(ipc);
                                break;
@@ -2044,79 +2052,79 @@ NEWUSR: if (IsEmptyStr(rc_password)) {
                                page_user(ipc);
                                break;
 
-            case 110:           /* <+> Next room */
-                                gotoroomstep(ipc, 1, 0);
-                            break;
+                       case 110:       /* <+> Next room */
+                               gotoroomstep(ipc, 1, 0);
+                               break;
 
-            case 111:           /* <-> Previous room */
-                 gotoroomstep(ipc, 0, 0);
-                            break;
+                       case 111:       /* <-> Previous room */
+                               gotoroomstep(ipc, 0, 0);
+                               break;
 
-                       case 112:           /* <>> Next floor */
-                 gotofloorstep(ipc, 1, GF_GOTO);
-                            break;
+                       case 112:       /* <>> Next floor */
+                               gotofloorstep(ipc, 1, GF_GOTO);
+                               break;
 
-                       case 113:           /* <<> Previous floor */
-                 gotofloorstep(ipc, 0, GF_GOTO);
-                                break;
+                       case 113:       /* <<> Previous floor */
+                               gotofloorstep(ipc, 0, GF_GOTO);
+                               break;
 
-            case 116:           /* <.> skip to <+> Next room */
-                 gotoroomstep(ipc, 1, 1);
-                            break;
+                       case 116:       /* <.> skip to <+> Next room */
+                               gotoroomstep(ipc, 1, 1);
+                               break;
 
-            case 117:           /* <.> skip to <-> Previous room */
-                 gotoroomstep(ipc, 0, 1);
-                            break;
+                       case 117:       /* <.> skip to <-> Previous room */
+                               gotoroomstep(ipc, 0, 1);
+                               break;
 
-                       case 118:           /* <.> skip to <>> Next floor */
-                 gotofloorstep(ipc, 1, GF_SKIP);
-                            break;
+                       case 118:       /* <.> skip to <>> Next floor */
+                               gotofloorstep(ipc, 1, GF_SKIP);
+                               break;
 
-                       case 119:           /* <.> skip to <<> Previous floor */
-                 gotofloorstep(ipc, 0, GF_SKIP);
-                                break;
+                       case 119:       /* <.> skip to <<> Previous floor */
+                               gotofloorstep(ipc, 0, GF_SKIP);
+                               break;
 
-                       case 114:           
-                 read_config(ipc);
-                                break;
+                       case 114:
+                               read_config(ipc);
+                               break;
 
-                       case 115:           
-                 system_info(ipc);
-                                break;
+                       case 115:
+                               system_info(ipc);
+                               break;
 
-                       case 120:           /* .KAnonymous */
-                        dotknown(ipc, 0, NULL);
-                                break;
+                       case 120:       /* .KAnonymous */
+                               dotknown(ipc, 0, NULL);
+                               break;
 
-                       case 121:           /* .KDirectory */
-                        dotknown(ipc, 1, NULL);
-                                break;
+                       case 121:       /* .KDirectory */
+                               dotknown(ipc, 1, NULL);
+                               break;
 
-                       case 122:           /* .KMatch */
-                        dotknown(ipc, 2, argbuf);
-                                break;
+                       case 122:       /* .KMatch */
+                               dotknown(ipc, 2, argbuf);
+                               break;
 
-                       case 123:           /* .KpreferredOnly */
-                        dotknown(ipc, 3, NULL);
-                                break;
+                       case 123:       /* .KpreferredOnly */
+                               dotknown(ipc, 3, NULL);
+                               break;
 
-                       case 124:           /* .KPrivate */
-                        dotknown(ipc, 4, NULL);
-                                break;
+                       case 124:       /* .KPrivate */
+                               dotknown(ipc, 4, NULL);
+                               break;
 
-                       case 125:           /* .KRead only */
-                        dotknown(ipc, 5, NULL);
-                                break;
+                       case 125:       /* .KRead only */
+                               dotknown(ipc, 5, NULL);
+                               break;
 
-                       case 126:           /* .KShared */
-                        dotknown(ipc, 6, NULL);
-                                break;
+                       case 126:       /* .KShared */
+                               dotknown(ipc, 6, NULL);
+                               break;
 
-                       case 127:           /* Configure POP3 aggregation */
+                       case 127:       /* Configure POP3 aggregation */
                                do_pop3client_configuration(ipc);
                                break;
 
-                       case 128:           /* Configure XML/RSS feed retrieval */
+                       case 128:       /* Configure XML/RSS feed retrieval */
                                do_rssclient_configuration(ipc);
                                break;
 
@@ -2125,7 +2133,7 @@ NEWUSR:   if (IsEmptyStr(rc_password)) {
                        }       /* end switch */
        } while (termn8 == 0);
 
-TERMN8:        scr_printf("%s logged out.", fullname);
+      TERMN8:scr_printf("%s logged out.", fullname);
        termn8 = 0;
        color(ORIGINAL_PAIR);
        scr_printf("\n");
@@ -2145,8 +2153,7 @@ TERMN8:   scr_printf("%s logged out.", fullname);
        for (lp = 0; lp < uglistsize; lp++) {
                free(uglist[lp]);
        }
-    uglistsize = 0;
+       uglistsize = 0;
        goto GSTA;
 
-}      /* end main() */
-
+}                              /* end main() */
index da0f7b9..e67b29c 100644 (file)
@@ -17,58 +17,57 @@ static SSL_CTX *ssl_ctx;
 char arg_encrypt;
 char rc_encrypt;
 
-#endif /* HAVE_OPENSSL */
+#endif                         /* HAVE_OPENSSL */
 
 #ifndef INADDR_NONE
 #define INADDR_NONE 0xffffffff
 #endif
 
-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]="";
-char ctdl_etc_dir[PATH_MAX]="";
+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] = "";
+char ctdl_etc_dir[PATH_MAX] = "";
 char ctdl_home_directory[PATH_MAX] = "";
-char file_citadel_socket[PATH_MAX]="";
-
-char *viewdefs[]={
-        "Messages",
-        "Summary",
-        "Address book",
-        "Calendar",
-        "Tasks"
+char file_citadel_socket[PATH_MAX] = "";
+
+char *viewdefs[] = {
+       "Messages",
+       "Summary",
+       "Address book",
+       "Calendar",
+       "Tasks"
 };
 
-char *axdefs[]={
-        "Deleted",
-        "New User",
-        "Problem User",
-        "Local User",
-        "Network User",
-        "Preferred User",
-        "Admin",
-        "Admin"
-        };
+char *axdefs[] = {
+       "Deleted",
+       "New User",
+       "Problem User",
+       "Local User",
+       "Network User",
+       "Preferred User",
+       "Admin",
+       "Admin"
+};
 
 
-void CtdlIPC_lock(CtdlIPC *ipc)
+void CtdlIPC_lock(CtdlIPC * ipc)
 {
-       if (ipc->network_status_cb) ipc->network_status_cb(1);
+       if (ipc->network_status_cb)
+               ipc->network_status_cb(1);
 }
 
 
-void CtdlIPC_unlock(CtdlIPC *ipc)
+void CtdlIPC_unlock(CtdlIPC * ipc)
 {
-       if (ipc->network_status_cb) ipc->network_status_cb(0);
+       if (ipc->network_status_cb)
+               ipc->network_status_cb(0);
 }
 
-#ifdef __cplusplus
-}
-#endif
 
-
-char *libcitadelclient_version_string(void) {
-        return "libcitadelclient(unnumbered)";
+char *libcitadelclient_version_string(void)
+{
+       return "libcitadelclient(unnumbered)";
 }
 
 
@@ -87,51 +86,45 @@ char *libcitadelclient_version_string(void) {
 #define DBG_PRINT(A) if (dbg==1) fprintf (stderr,"%s : %s \n", #A, A)
 
 
-void calc_dirs_n_files(int relh, int home, const char *relhome, char  *ctdldir, int dbg)
+void calc_dirs_n_files(int relh, int home, const char *relhome, char *ctdldir, int dbg)
 {
-       const charbasedir = "";
+       const char *basedir = "";
        char dirbuffer[PATH_MAX] = "";
 
        StripSlashes(ctdldir, 1);
 
 #ifndef HAVE_RUN_DIR
-       basedir=ctdldir;
+       basedir = ctdldir;
 #else
-       basedir=RUN_DIR;
+       basedir = RUN_DIR;
 #endif
        COMPUTE_DIRECTORY(ctdl_run_dir);
        StripSlashes(ctdl_run_dir, 1);
 
 
 #ifndef HAVE_AUTO_ETC_DIR
-       basedir=ctdldir;
+       basedir = ctdldir;
 #else
-       basedir=AUTO_ETC_DIR;
+       basedir = AUTO_ETC_DIR;
 #endif
        COMPUTE_DIRECTORY(ctdl_autoetc_dir);
        StripSlashes(ctdl_autoetc_dir, 1);
 
 
 #ifndef HAVE_ETC_DIR
-       basedir=ctdldir;
+       basedir = ctdldir;
 #else
-       basedir=ETC_DIR;
+       basedir = ETC_DIR;
 #endif
        COMPUTE_DIRECTORY(ctdl_etc_dir);
        StripSlashes(ctdl_etc_dir, 1);
 
 
 
-       snprintf(file_citadel_rc, 
-                        sizeof file_citadel_rc,
-                        "%scitadel.rc",
-                        ctdl_etc_dir);
+       snprintf(file_citadel_rc, sizeof file_citadel_rc, "%scitadel.rc", ctdl_etc_dir);
        StripSlashes(file_citadel_rc, 0);
 
-       snprintf(file_citadel_socket, 
-                        sizeof file_citadel_socket,
-                               "%scitadel.socket",
-                        ctdl_run_dir);
+       snprintf(file_citadel_socket, sizeof file_citadel_socket, "%scitadel.socket", ctdl_run_dir);
        StripSlashes(file_citadel_socket, 0);
 
        DBG_PRINT(ctdl_run_dir);
@@ -140,11 +133,13 @@ void calc_dirs_n_files(int relh, int home, const char *relhome, char  *ctdldir,
        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;
 }
 
@@ -152,15 +147,15 @@ void CtdlIPC_SetNetworkStatusCallback(CtdlIPC *ipc, void (*hook)(int state)) {
 char instant_msgs = 0;
 
 
-static void serv_read(CtdlIPC *ipc, char *buf, unsigned int bytes);
-static void serv_write(CtdlIPC *ipc, const char *buf, unsigned int nbytes);
+static void serv_read(CtdlIPC * ipc, char *buf, unsigned int bytes);
+static void serv_write(CtdlIPC * ipc, const char *buf, unsigned int nbytes);
 #ifdef HAVE_OPENSSL
-static void serv_read_ssl(CtdlIPC *ipc, char *buf, unsigned int bytes);
-static void serv_write_ssl(CtdlIPC *ipc, const char *buf, unsigned int nbytes);
-static void endtls(SSL *ssl);
-#endif /* HAVE_OPENSSL */
-static void CtdlIPC_getline(CtdlIPC* ipc, char *buf);
-static void CtdlIPC_putline(CtdlIPC *ipc, const char *buf);
+static void serv_read_ssl(CtdlIPC * ipc, char *buf, unsigned int bytes);
+static void serv_write_ssl(CtdlIPC * ipc, const char *buf, unsigned int nbytes);
+static void endtls(SSL * ssl);
+#endif                         /* HAVE_OPENSSL */
+static void CtdlIPC_getline(CtdlIPC * ipc, char *buf);
+static void CtdlIPC_putline(CtdlIPC * ipc, const char *buf);
 
 
 
@@ -169,7 +164,7 @@ const char *svn_revision(void);
 /*
  * Does nothing.  The server should always return 200.
  */
-int CtdlIPCNoop(CtdlIPC *ipc)
+int CtdlIPCNoop(CtdlIPC * ipc)
 {
        char aaa[128];
 
@@ -181,16 +176,19 @@ int CtdlIPCNoop(CtdlIPC *ipc)
  * Does nothing interesting.  The server should always return 200
  * along with your string.
  */
-int CtdlIPCEcho(CtdlIPC *ipc, const char *arg, char *cret)
+int CtdlIPCEcho(CtdlIPC * ipc, const char *arg, char *cret)
 {
        int ret;
        char *aaa;
-       
-       if (!arg) return -2;
-       if (!cret) return -2;
 
-       aaa = (char *)malloc((size_t)(strlen(arg) + 6));
-       if (!aaa) return -1;
+       if (!arg)
+               return -2;
+       if (!cret)
+               return -2;
+
+       aaa = (char *) malloc((size_t) (strlen(arg) + 6));
+       if (!aaa)
+               return -1;
 
        sprintf(aaa, "ECHO %s", arg);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -203,10 +201,10 @@ int CtdlIPCEcho(CtdlIPC *ipc, const char *arg, char *cret)
  * Asks the server to close the connecction.
  * Should always return 200.
  */
-int CtdlIPCQuit(CtdlIPC *ipc)
+int CtdlIPCQuit(CtdlIPC * ipc)
 {
        int ret = 221;          /* Default to successful quit */
-       char aaa[SIZ]; 
+       char aaa[SIZ];
 
        CtdlIPC_lock(ipc);
        if (ipc->sock > -1) {
@@ -231,7 +229,7 @@ int CtdlIPCQuit(CtdlIPC *ipc)
  * Asks the server to log out.  Should always return 200, even if no user
  * was logged in.  The user will not be logged in after this!
  */
-int CtdlIPCLogout(CtdlIPC *ipc)
+int CtdlIPCLogout(CtdlIPC * ipc)
 {
        int ret;
        char aaa[SIZ];
@@ -250,16 +248,19 @@ int CtdlIPCLogout(CtdlIPC *ipc)
  * username is able to log in, with the username correctly spelled in cret.
  * Returns various 500 error codes if the user doesn't exist, etc.
  */
-int CtdlIPCTryLogin(CtdlIPC *ipc, const char *username, char *cret)
+int CtdlIPCTryLogin(CtdlIPC * ipc, const char *username, char *cret)
 {
        int ret;
        char *aaa;
 
-       if (!username) return -2;
-       if (!cret) return -2;
+       if (!username)
+               return -2;
+       if (!cret)
+               return -2;
 
-       aaa = (char *)malloc((size_t)(strlen(username) + 6));
-       if (!aaa) return -1;
+       aaa = (char *) malloc((size_t) (strlen(username) + 6));
+       if (!aaa)
+               return -1;
 
        sprintf(aaa, "USER %s", username);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -272,16 +273,19 @@ int CtdlIPCTryLogin(CtdlIPC *ipc, const char *username, char *cret)
  * Second stage of authentication - provide password.  The server returns
  * 200 and several arguments in cret relating to the user's account.
  */
-int CtdlIPCTryPassword(CtdlIPC *ipc, const char *passwd, char *cret)
+int CtdlIPCTryPassword(CtdlIPC * ipc, const char *passwd, char *cret)
 {
        int ret;
        char *aaa;
 
-       if (!passwd) return -2;
-       if (!cret) return -2;
+       if (!passwd)
+               return -2;
+       if (!cret)
+               return -2;
 
-       aaa = (char *)malloc((size_t)(strlen(passwd) + 6));
-       if (!aaa) return -1;
+       aaa = (char *) malloc((size_t) (strlen(passwd) + 6));
+       if (!aaa)
+               return -1;
 
        sprintf(aaa, "PASS %s", passwd);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -294,16 +298,19 @@ int CtdlIPCTryPassword(CtdlIPC *ipc, const char *passwd, char *cret)
  * Second stage of authentication - provide password.  The server returns
  * 200 and several arguments in cret relating to the user's account.
  */
-int CtdlIPCTryApopPassword(CtdlIPC *ipc, const char *response, char *cret)
+int CtdlIPCTryApopPassword(CtdlIPC * ipc, const char *response, char *cret)
 {
        int ret;
        char *aaa;
 
-       if (!response) return -2;
-       if (!cret) return -2;
+       if (!response)
+               return -2;
+       if (!cret)
+               return -2;
 
-       aaa = (char *)malloc((size_t)(strlen(response) + 6));
-       if (!aaa) return -1;
+       aaa = (char *) malloc((size_t) (strlen(response) + 6));
+       if (!aaa)
+               return -1;
 
        sprintf(aaa, "PAS2 %s", response);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -319,18 +326,21 @@ int CtdlIPCTryApopPassword(CtdlIPC *ipc, const char *response, char *cret)
  * user - intended for use by system administrators to create accounts on
  * behalf of other users.
  */
-int CtdlIPCCreateUser(CtdlIPC *ipc, const char *username, int selfservice, char *cret)
+int CtdlIPCCreateUser(CtdlIPC * ipc, const char *username, int selfservice, char *cret)
 {
        int ret;
        char *aaa;
 
-       if (!username) return -2;
-       if (!cret) return -2;
+       if (!username)
+               return -2;
+       if (!cret)
+               return -2;
 
-       aaa = (char *)malloc((size_t)(strlen(username) + 6));
-       if (!aaa) return -1;
+       aaa = (char *) malloc((size_t) (strlen(username) + 6));
+       if (!aaa)
+               return -1;
 
-       sprintf(aaa, "%s %s", selfservice ? "NEWU" : "CREU",  username);
+       sprintf(aaa, "%s %s", selfservice ? "NEWU" : "CREU", username);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
        free(aaa);
        return ret;
@@ -340,16 +350,19 @@ int CtdlIPCCreateUser(CtdlIPC *ipc, const char *username, int selfservice, char
 /*
  * Changes the user's password.  Returns 200 if changed, errors otherwise.
  */
-int CtdlIPCChangePassword(CtdlIPC *ipc, const char *passwd, char *cret)
+int CtdlIPCChangePassword(CtdlIPC * ipc, const char *passwd, char *cret)
 {
        int ret;
        char *aaa;
 
-       if (!passwd) return -2;
-       if (!cret) return -2;
+       if (!passwd)
+               return -2;
+       if (!cret)
+               return -2;
 
-       aaa = (char *)malloc((size_t)(strlen(passwd) + 6));
-       if (!aaa) return -1;
+       aaa = (char *) malloc((size_t) (strlen(passwd) + 6));
+       if (!aaa)
+               return -1;
 
        sprintf(aaa, "SETP %s", passwd);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -362,21 +375,24 @@ int CtdlIPCChangePassword(CtdlIPC *ipc, const char *passwd, char *cret)
 /* 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 CtdlIPCKnownRooms(CtdlIPC * ipc, enum RoomList which, int floor, struct march **listing, char *cret)
 {
        int ret;
        struct march *march = NULL;
-       static char *proto[] =
-               {"LKRA", "LKRN", "LKRO", "LZRM", "LRMS", "LPRM" };
+       static char *proto[] = { "LKRA", "LKRN", "LKRO", "LZRM", "LRMS", "LPRM" };
        char aaa[SIZ];
        char *bbb = NULL;
        size_t bbb_len;
 
-       if (!listing) return -2;
-       if (*listing) return -2;        /* Free the listing first */
-       if (!cret) return -2;
+       if (!listing)
+               return -2;
+       if (*listing)
+               return -2;      /* Free the listing first */
+       if (!cret)
+               return -2;
        /* if (which < 0 || which > 4) return -2; */
-       if (floor < -1) return -2;      /* Can't validate upper bound, sorry */
+       if (floor < -1)
+               return -2;      /* Can't validate upper bound, sorry */
 
        sprintf(aaa, "%s %d", proto[which], floor);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, &bbb, &bbb_len, cret);
@@ -389,7 +405,7 @@ int CtdlIPCKnownRooms(CtdlIPC *ipc, enum RoomList which, int floor, struct march
                        extract_token(aaa, bbb, 0, '\n', sizeof aaa);
                        a = strlen(aaa);
                        memmove(bbb, bbb + a + 1, strlen(bbb) - a);
-                       mptr = (struct march *) malloc(sizeof (struct march));
+                       mptr = (struct march *) malloc(sizeof(struct march));
                        if (mptr) {
                                mptr->next = NULL;
                                extract_token(mptr->march_name, aaa, 0, '|', sizeof mptr->march_name);
@@ -412,21 +428,26 @@ int CtdlIPCKnownRooms(CtdlIPC *ipc, enum RoomList which, int floor, struct march
                }
        }
        *listing = march;
-       if (bbb) free(bbb);
+       if (bbb)
+               free(bbb);
        return ret;
 }
 
 
 /* GETU */
 /* Caller must free the struct ctdluser; caller may pass an existing one */
-int CtdlIPCGetConfig(CtdlIPC *ipc, struct ctdluser **uret, char *cret)
+int CtdlIPCGetConfig(CtdlIPC * ipc, struct ctdluser **uret, char *cret)
 {
        int ret;
 
-       if (!cret) return -2;
-       if (!uret) return -2;
-       if (!*uret) *uret = (struct ctdluser *)calloc(1, sizeof (struct ctdluser));
-       if (!*uret) return -1;
+       if (!cret)
+               return -2;
+       if (!uret)
+               return -2;
+       if (!*uret)
+               *uret = (struct ctdluser *) calloc(1, sizeof(struct ctdluser));
+       if (!*uret)
+               return -1;
 
        ret = CtdlIPCGenericCommand(ipc, "GETU", NULL, 0, NULL, NULL, cret);
        if (ret / 100 == 2) {
@@ -437,30 +458,32 @@ int CtdlIPCGetConfig(CtdlIPC *ipc, struct ctdluser **uret, char *cret)
 
 
 /* SETU */
-int CtdlIPCSetConfig(CtdlIPC *ipc, struct ctdluser *uret, char *cret)
+int CtdlIPCSetConfig(CtdlIPC * ipc, struct ctdluser *uret, char *cret)
 {
        char aaa[48];
 
-       if (!uret) return -2;
-       if (!cret) return -2;
+       if (!uret)
+               return -2;
+       if (!cret)
+               return -2;
 
-       sprintf(aaa,
-               "SETU 80|24|%d",
-               uret->flags
-       );
+       sprintf(aaa, "SETU 80|24|%d", uret->flags);
        return CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
 }
 
 
 /* RENU */
-int CtdlIPCRenameUser(CtdlIPC *ipc, char *oldname, char *newname, char *cret)
+int CtdlIPCRenameUser(CtdlIPC * ipc, char *oldname, char *newname, char *cret)
 {
        int ret;
        char cmd[256];
 
-       if (!oldname) return -2;
-       if (!newname) return -2;
-       if (!cret) return -2;
+       if (!oldname)
+               return -2;
+       if (!newname)
+               return -2;
+       if (!cret)
+               return -2;
 
        snprintf(cmd, sizeof cmd, "RENU %s|%s", oldname, newname);
        ret = CtdlIPCGenericCommand(ipc, cmd, NULL, 0, NULL, NULL, cret);
@@ -469,26 +492,29 @@ int CtdlIPCRenameUser(CtdlIPC *ipc, char *oldname, char *newname, char *cret)
 
 
 /* GOTO */
-int CtdlIPCGotoRoom(CtdlIPC *ipc, const char *room, const char *passwd,
-               struct ctdlipcroom **rret, char *cret)
+int CtdlIPCGotoRoom(CtdlIPC * ipc, const char *room, const char *passwd, struct ctdlipcroom **rret, char *cret)
 {
        int ret;
        char *aaa;
 
-       if (!cret) return -2;
-       if (!rret) return -2;
-       if (!*rret) *rret = (struct ctdlipcroom *)calloc(1, sizeof (struct ctdlipcroom));
-       if (!*rret) return -1;
+       if (!cret)
+               return -2;
+       if (!rret)
+               return -2;
+       if (!*rret)
+               *rret = (struct ctdlipcroom *) calloc(1, sizeof(struct ctdlipcroom));
+       if (!*rret)
+               return -1;
 
        if (passwd) {
-               aaa = (char *)malloc(strlen(room) + strlen(passwd) + 7);
+               aaa = (char *) malloc(strlen(room) + strlen(passwd) + 7);
                if (!aaa) {
                        free(*rret);
                        return -1;
                }
                sprintf(aaa, "GOTO %s|%s", room, passwd);
        } else {
-               aaa = (char *)malloc(strlen(room) + 6);
+               aaa = (char *) malloc(strlen(room) + 6);
                if (!aaa) {
                        free(*rret);
                        return -1;
@@ -524,41 +550,41 @@ int CtdlIPCGotoRoom(CtdlIPC *ipc, const char *room, const char *passwd,
 /* 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" };
+       static char *proto[] = { "ALL", "OLD", "NEW", "LAST", "FIRST", "GT", "LT" };
        char aaa[33];
        char *bbb = NULL;
        size_t bbb_len;
 
-       if (!cret) return -2;
-       if (!mret) return -2;
-       if (*mret) return -2;
-       if (which < 0 || which > 6) return -2;
+       if (!cret)
+               return -2;
+       if (!mret)
+               return -2;
+       if (*mret)
+               return -2;
+       if (which < 0 || which > 6)
+               return -2;
 
        if (which <= 2)
-               sprintf(aaa, "MSGS %s||%d", proto[which],
-                               (mtemplate) ? 1 : 0);
+               sprintf(aaa, "MSGS %s||%d", proto[which], (mtemplate) ? 1 : 0);
        else
-               sprintf(aaa, "MSGS %s|%d|%d", proto[which], whicharg,
-                               (mtemplate) ? 1 : 0);
-       if (mtemplate) count = strlen(mtemplate);
+               sprintf(aaa, "MSGS %s|%d|%d", proto[which], whicharg, (mtemplate) ? 1 : 0);
+       if (mtemplate)
+               count = strlen(mtemplate);
        ret = CtdlIPCGenericCommand(ipc, aaa, mtemplate, count, &bbb, &bbb_len, cret);
        if (ret / 100 != 1)
                return ret;
        count = 0;
-       *mret = (unsigned long *)calloc(1, sizeof(unsigned long));
+       *mret = (unsigned long *) calloc(1, sizeof(unsigned long));
        if (!*mret)
                return -1;
        while (bbb && strlen(bbb)) {
                extract_token(aaa, bbb, 0, '\n', sizeof aaa);
                remove_token(bbb, 0, '\n');
-               *mret = (unsigned long *)realloc(*mret, (size_t)((count + 2) *
-                                       sizeof (unsigned long)));
+               *mret = (unsigned long *) realloc(*mret, (size_t) ((count + 2) * sizeof(unsigned long)));
                if (*mret) {
                        (*mret)[count++] = atol(aaa);
                        (*mret)[count] = 0L;
@@ -566,14 +592,14 @@ int CtdlIPCGetMessages(CtdlIPC *ipc, enum MessageList which, int whicharg,
                        break;
                }
        }
-       if (bbb) free(bbb);
+       if (bbb)
+               free(bbb);
        return ret;
 }
 
 
 /* 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];
@@ -583,11 +609,16 @@ int CtdlIPCGetSingleMessage(CtdlIPC *ipc, long msgnum, int headers, int as_mime,
        char multipart_prefix[128];
        char encoding[256];
 
-       if (!cret) return -1;
-       if (!mret) return -1;
-       if (!*mret) *mret = (struct ctdlipcmessage *)calloc(1, sizeof (struct ctdlipcmessage));
-       if (!*mret) return -1;
-       if (!msgnum) return -1;
+       if (!cret)
+               return -1;
+       if (!mret)
+               return -1;
+       if (!*mret)
+               *mret = (struct ctdlipcmessage *) calloc(1, sizeof(struct ctdlipcmessage));
+       if (!*mret)
+               return -1;
+       if (!msgnum)
+               return -1;
 
        strcpy(encoding, "");
        strcpy(mret[0]->content_type, "");
@@ -626,23 +657,20 @@ int CtdlIPCGetSingleMessage(CtdlIPC *ipc, long msgnum, int headers, int as_mime,
                                 */
                                else if (!strncasecmp(aaa, "pref=", 5)) {
                                        extract_token(multipart_prefix, &aaa[5], 1, '|', sizeof multipart_prefix);
-                                       if (!strcasecmp(multipart_prefix,
-                                          "multipart/alternative")) {
+                                       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")) {
+                                       if (!strcasecmp(multipart_prefix, "multipart/alternative")) {
                                                ++multipart_hunting;
                                        }
                                }
 
                                else if (!strncasecmp(aaa, "part=", 5)) {
                                        struct parts *ptr, *chain;
-       
-                                       ptr = (struct parts *)calloc(1, sizeof (struct parts));
+
+                                       ptr = (struct parts *) calloc(1, sizeof(struct parts));
                                        if (ptr) {
 
                                                /* Fill the buffers for the caller */
@@ -663,12 +691,9 @@ int CtdlIPCGetSingleMessage(CtdlIPC *ipc, long msgnum, int headers, int as_mime,
 
                                                /* Now handle multipart/alternative */
                                                if (multipart_hunting > 0) {
-                                                       if ( (!strcasecmp(ptr->mimetype,
-                                                            "text/plain"))
-                                                          || (!strcasecmp(ptr->mimetype,
-                                                             "text/html")) ) {
-                                                               strcpy(mret[0]->mime_chosen,
-                                                                       ptr->number);
+                                                       if ((!strcasecmp(ptr->mimetype, "text/plain"))
+                                                           || (!strcasecmp(ptr->mimetype, "text/html"))) {
+                                                               strcpy(mret[0]->mime_chosen, ptr->number);
                                                        }
                                                }
 
@@ -714,14 +739,13 @@ int CtdlIPCGetSingleMessage(CtdlIPC *ipc, long msgnum, int headers, int as_mime,
                }
                if (strlen(bbb)) {
 
-                       if ( (!strcasecmp(encoding, "base64")) || (!strcasecmp(encoding, "quoted-printable")) ) {
+                       if ((!strcasecmp(encoding, "base64")) || (!strcasecmp(encoding, "quoted-printable"))) {
                                char *ccc = NULL;
                                int bytes_decoded = 0;
                                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;
@@ -730,10 +754,10 @@ int CtdlIPCGetSingleMessage(CtdlIPC *ipc, long msgnum, int headers, int as_mime,
                        }
 
                        /* FIXME: Strip trailing whitespace */
-                       bbb = (char *)realloc(bbb, (size_t)(strlen(bbb) + 1));
+                       bbb = (char *) realloc(bbb, (size_t) (strlen(bbb) + 1));
 
                } else {
-                       bbb = (char *)realloc(bbb, 1);
+                       bbb = (char *) realloc(bbb, 1);
                        *bbb = '\0';
                }
                mret[0]->text = bbb;
@@ -743,14 +767,17 @@ 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;
 
-       if (!cret) return -2;
-       if (!listing) return -2;
-       if (*listing) return -2;
+       if (!cret)
+               return -2;
+       if (!listing)
+               return -2;
+       if (*listing)
+               return -2;
 
        ret = CtdlIPCGenericCommand(ipc, "WHOK", NULL, 0, listing, &bytes, cret);
        return ret;
@@ -758,14 +785,15 @@ 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;
        char buf[SIZ];
 
-       if (!cret) return -2;
+       if (!cret)
+               return -2;
 
        ret = CtdlIPCGenericCommand(ipc, "INFO", NULL, 0, &listing, &bytes, cret);
        if (ret / 100 == 1) {
@@ -775,68 +803,94 @@ int CtdlIPCServerInfo(CtdlIPC *ipc, char *cret)
                        extract_token(buf, listing, 0, '\n', sizeof buf);
                        remove_token(listing, 0, '\n');
                        switch (line++) {
-                       case 0:         ipc->ServInfo.pid = atoi(buf);
-                                       break;
-                       case 1:         strcpy(ipc->ServInfo.nodename,buf);
-                                       break;
-                       case 2:         strcpy(ipc->ServInfo.humannode,buf);
-                                       break;
-                       case 3:         strcpy(ipc->ServInfo.fqdn,buf);
-                                       break;
-                       case 4:         strcpy(ipc->ServInfo.software,buf);
-                                       break;
-                       case 5:         ipc->ServInfo.rev_level = atoi(buf);
-                                       break;
-                       case 6:         strcpy(ipc->ServInfo.site_location,buf);
-                                       break;
-                       case 7:         strcpy(ipc->ServInfo.sysadm,buf);
-                                       break;
-                       case 9:         strcpy(ipc->ServInfo.moreprompt,buf);
-                                       break;
-                       case 10:        ipc->ServInfo.ok_floors = atoi(buf);
-                                       break;
-                       case 11:        ipc->ServInfo.paging_level = atoi(buf);
-                                       break;
-                       case 13:        ipc->ServInfo.supports_qnop = atoi(buf);
-                                       break;
-                       case 14:        ipc->ServInfo.supports_ldap = atoi(buf);
-                                       break;
-                       case 15:        ipc->ServInfo.newuser_disabled = atoi(buf);
-                                       break;
-                       case 16:        strcpy(ipc->ServInfo.default_cal_zone, buf);
-                                       break;
-                       case 17:        ipc->ServInfo.load_avg = atof(buf);
-                                       break;
-                       case 18:        ipc->ServInfo.worker_avg = atof(buf);
-                                       break;
-                       case 19:        ipc->ServInfo.thread_count = atoi(buf);
-                                       break;
-                       case 20:        ipc->ServInfo.has_sieve = atoi(buf);
-                                       break;
-                       case 21:        ipc->ServInfo.fulltext_enabled = atoi(buf);
-                                       break;
-                       case 22:        strcpy(ipc->ServInfo.svn_revision, buf);
-                                       break;
-                       case 24:        ipc->ServInfo.guest_logins = atoi(buf);
-                                       break;
+                       case 0:
+                               ipc->ServInfo.pid = atoi(buf);
+                               break;
+                       case 1:
+                               strcpy(ipc->ServInfo.nodename, buf);
+                               break;
+                       case 2:
+                               strcpy(ipc->ServInfo.humannode, buf);
+                               break;
+                       case 3:
+                               strcpy(ipc->ServInfo.fqdn, buf);
+                               break;
+                       case 4:
+                               strcpy(ipc->ServInfo.software, buf);
+                               break;
+                       case 5:
+                               ipc->ServInfo.rev_level = atoi(buf);
+                               break;
+                       case 6:
+                               strcpy(ipc->ServInfo.site_location, buf);
+                               break;
+                       case 7:
+                               strcpy(ipc->ServInfo.sysadm, buf);
+                               break;
+                       case 9:
+                               strcpy(ipc->ServInfo.moreprompt, buf);
+                               break;
+                       case 10:
+                               ipc->ServInfo.ok_floors = atoi(buf);
+                               break;
+                       case 11:
+                               ipc->ServInfo.paging_level = atoi(buf);
+                               break;
+                       case 13:
+                               ipc->ServInfo.supports_qnop = atoi(buf);
+                               break;
+                       case 14:
+                               ipc->ServInfo.supports_ldap = atoi(buf);
+                               break;
+                       case 15:
+                               ipc->ServInfo.newuser_disabled = atoi(buf);
+                               break;
+                       case 16:
+                               strcpy(ipc->ServInfo.default_cal_zone, buf);
+                               break;
+                       case 17:
+                               ipc->ServInfo.load_avg = atof(buf);
+                               break;
+                       case 18:
+                               ipc->ServInfo.worker_avg = atof(buf);
+                               break;
+                       case 19:
+                               ipc->ServInfo.thread_count = atoi(buf);
+                               break;
+                       case 20:
+                               ipc->ServInfo.has_sieve = atoi(buf);
+                               break;
+                       case 21:
+                               ipc->ServInfo.fulltext_enabled = atoi(buf);
+                               break;
+                       case 22:
+                               strcpy(ipc->ServInfo.svn_revision, buf);
+                               break;
+                       case 24:
+                               ipc->ServInfo.guest_logins = atoi(buf);
+                               break;
                        }
                }
 
        }
-       if (listing) free(listing);
+       if (listing)
+               free(listing);
        return ret;
 }
 
 
 /* RDIR */
-int CtdlIPCReadDirectory(CtdlIPC *ipc, char **listing, char *cret)
+int CtdlIPCReadDirectory(CtdlIPC * ipc, char **listing, char *cret)
 {
        int ret;
        size_t bytes;
 
-       if (!cret) return -2;
-       if (!listing) return -2;
-       if (*listing) return -2;
+       if (!cret)
+               return -2;
+       if (!listing)
+               return -2;
+       if (*listing)
+               return -2;
 
        ret = CtdlIPCGenericCommand(ipc, "RDIR", NULL, 0, listing, &bytes, cret);
        return ret;
@@ -846,17 +900,17 @@ 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];
 
-       if (!cret) return -2;
+       if (!cret)
+               return -2;
 
        if (msgnum) {
                sprintf(aaa, "SLRP %ld", msgnum);
-       }
-       else {
+       } else {
                sprintf(aaa, "SLRP HIGHEST");
        }
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -865,16 +919,19 @@ 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;
 
-       if (!cret) return -2;
-       if (!username) return -2;
+       if (!cret)
+               return -2;
+       if (!username)
+               return -2;
 
-       aaa = (char *)malloc(strlen(username) + 6);
-       if (!aaa) return -1;
+       aaa = (char *) malloc(strlen(username) + 6);
+       if (!aaa)
+               return -1;
 
        sprintf(aaa, "INVT %s", username);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -884,15 +941,17 @@ 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;
 
-       if (!cret) return -1;
-       if (!username) return -1;
+       if (!cret)
+               return -1;
+       if (!username)
+               return -1;
 
-       aaa = (char *)malloc(strlen(username) + 6);
+       aaa = (char *) malloc(strlen(username) + 6);
 
        sprintf(aaa, "KICK %s", username);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -902,14 +961,18 @@ 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) return -2;
-       if (!qret) return -2;
-       if (!*qret) *qret = (struct ctdlroom *)calloc(1, sizeof (struct ctdlroom));
-       if (!*qret) return -1;
+       if (!cret)
+               return -2;
+       if (!qret)
+               return -2;
+       if (!*qret)
+               *qret = (struct ctdlroom *) calloc(1, sizeof(struct ctdlroom));
+       if (!*qret)
+               return -1;
 
        ret = CtdlIPCGenericCommand(ipc, "GETR", NULL, 0, NULL, NULL, cret);
        if (ret / 100 == 2) {
@@ -928,22 +991,23 @@ int CtdlIPCGetRoomAttributes(CtdlIPC *ipc, struct ctdlroom **qret, char *cret)
 
 /* SETR */
 /* set forget to kick all users out of room */
-int CtdlIPCSetRoomAttributes(CtdlIPC *ipc, int forget, struct ctdlroom *qret, char *cret)
+int CtdlIPCSetRoomAttributes(CtdlIPC * ipc, int forget, struct ctdlroom *qret, char *cret)
 {
        int ret;
        char *aaa;
 
-       if (!cret) return -2;
-       if (!qret) return -2;
+       if (!cret)
+               return -2;
+       if (!qret)
+               return -2;
 
-       aaa = (char *)malloc(strlen(qret->QRname) + strlen(qret->QRpasswd) +
-                       strlen(qret->QRdirname) + 64);
-       if (!aaa) return -1;
+       aaa = (char *) malloc(strlen(qret->QRname) + strlen(qret->QRpasswd) + strlen(qret->QRdirname) + 64);
+       if (!aaa)
+               return -1;
 
        sprintf(aaa, "SETR %s|%s|%s|%d|%d|%d|%d|%d|%d",
-                       qret->QRname, qret->QRpasswd, qret->QRdirname,
-                       qret->QRflags, forget, qret->QRfloor, qret->QRorder,
-                       qret->QRdefaultview, qret->QRflags2);
+               qret->QRname, qret->QRpasswd, qret->QRdirname,
+               qret->QRflags, forget, qret->QRfloor, qret->QRorder, qret->QRdefaultview, qret->QRflags2);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
        free(aaa);
        return ret;
@@ -951,25 +1015,29 @@ int CtdlIPCSetRoomAttributes(CtdlIPC *ipc, int forget, struct ctdlroom *qret, ch
 
 
 /* GETA */
-int CtdlIPCGetRoomAide(CtdlIPC *ipc, char *cret)
+int CtdlIPCGetRoomAide(CtdlIPC * ipc, char *cret)
 {
-       if (!cret) return -1;
+       if (!cret)
+               return -1;
 
        return CtdlIPCGenericCommand(ipc, "GETA", NULL, 0, NULL, NULL, cret);
 }
 
 
 /* SETA */
-int CtdlIPCSetRoomAide(CtdlIPC *ipc, const char *username, char *cret)
+int CtdlIPCSetRoomAide(CtdlIPC * ipc, const char *username, char *cret)
 {
        int ret;
        char *aaa;
 
-       if (!cret) return -2;
-       if (!username) return -2;
+       if (!cret)
+               return -2;
+       if (!username)
+               return -2;
 
-       aaa = (char *)malloc(strlen(username) + 6);
-       if (!aaa) return -1;
+       aaa = (char *) malloc(strlen(username) + 6);
+       if (!aaa)
+               return -1;
 
        sprintf(aaa, "SETA %s", username);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -979,58 +1047,65 @@ 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;
 
-       if (!cret) return -2;
-       if (!mr) return -2;
+       if (!cret)
+               return -2;
+       if (!mr)
+               return -2;
 
        if (mr->references) {
-               for (ptr=mr->references; *ptr != 0; ++ptr) {
-                       if (*ptr == '|') *ptr = '!';
+               for (ptr = mr->references; *ptr != 0; ++ptr) {
+                       if (*ptr == '|')
+                               *ptr = '!';
                }
        }
 
        snprintf(cmd, sizeof cmd,
-                       "ENT0 %d|%s|%d|%d|%s|%s||||||%s|", flag, mr->recipient,
-                       mr->anonymous, mr->type, mr->subject, mr->author, mr->references);
-       ret = CtdlIPCGenericCommand(ipc, cmd, mr->text, strlen(mr->text), NULL,
-                       NULL, cret);
+                "ENT0 %d|%s|%d|%d|%s|%s||||||%s|", flag, mr->recipient,
+                mr->anonymous, mr->type, mr->subject, mr->author, mr->references);
+       ret = CtdlIPCGenericCommand(ipc, cmd, mr->text, strlen(mr->text), NULL, NULL, cret);
        if ((flag == 0) && (subject_required != NULL)) {
                /* Is the server strongly recommending that the user enter a message subject? */
                if ((cret[3] != '\0') && (cret[4] != '\0')) {
                        *subject_required = extract_int(&cret[4], 1);
                }
 
-               
+
        }
        return ret;
 }
 
 
 /* RINF */
-int CtdlIPCRoomInfo(CtdlIPC *ipc, char **iret, char *cret)
+int CtdlIPCRoomInfo(CtdlIPC * ipc, char **iret, char *cret)
 {
        size_t bytes;
 
-       if (!cret) return -2;
-       if (!iret) return -2;
-       if (*iret) return -2;
+       if (!cret)
+               return -2;
+       if (!iret)
+               return -2;
+       if (*iret)
+               return -2;
 
        return CtdlIPCGenericCommand(ipc, "RINF", NULL, 0, iret, &bytes, cret);
 }
 
 
 /* DELE */
-int CtdlIPCDeleteMessage(CtdlIPC *ipc, long msgnum, char *cret)
+int CtdlIPCDeleteMessage(CtdlIPC * ipc, long msgnum, char *cret)
 {
        char aaa[64];
 
-       if (!cret) return -2;
-       if (!msgnum) return -2;
+       if (!cret)
+               return -2;
+       if (!msgnum)
+               return -2;
 
        sprintf(aaa, "DELE %ld", msgnum);
        return CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -1038,17 +1113,21 @@ int CtdlIPCDeleteMessage(CtdlIPC *ipc, long msgnum, char *cret)
 
 
 /* MOVE */
-int CtdlIPCMoveMessage(CtdlIPC *ipc, int copy, long msgnum, const char *destroom, char *cret)
+int CtdlIPCMoveMessage(CtdlIPC * ipc, int copy, long msgnum, const char *destroom, char *cret)
 {
        int ret;
        char *aaa;
 
-       if (!cret) return -2;
-       if (!destroom) return -2;
-       if (!msgnum) return -2;
+       if (!cret)
+               return -2;
+       if (!destroom)
+               return -2;
+       if (!msgnum)
+               return -2;
 
-       aaa = (char *)malloc(strlen(destroom) + 28);
-       if (!aaa) return -1;
+       aaa = (char *) malloc(strlen(destroom) + 28);
+       if (!aaa)
+               return -1;
 
        sprintf(aaa, "MOVE %ld|%s|%d", msgnum, destroom, copy);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -1058,11 +1137,12 @@ int CtdlIPCMoveMessage(CtdlIPC *ipc, int copy, long msgnum, const char *destroom
 
 
 /* KILL */
-int CtdlIPCDeleteRoom(CtdlIPC *ipc, int for_real, char *cret)
+int CtdlIPCDeleteRoom(CtdlIPC * ipc, int for_real, char *cret)
 {
        char aaa[64];
 
-       if (!cret) return -2;
+       if (!cret)
+               return -2;
 
        sprintf(aaa, "KILL %d", for_real);
        return CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -1070,25 +1150,26 @@ 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;
 
-       if (!cret) return -2;
-       if (!roomname) return -2;
+       if (!cret)
+               return -2;
+       if (!roomname)
+               return -2;
 
        if (password) {
-               aaa = (char *)malloc(strlen(roomname) + strlen(password) + 40);
-               if (!aaa) return -1;
-               sprintf(aaa, "CRE8 %d|%s|%d|%s|%d", for_real, roomname, type,
-                               password, floor);
+               aaa = (char *) malloc(strlen(roomname) + strlen(password) + 40);
+               if (!aaa)
+                       return -1;
+               sprintf(aaa, "CRE8 %d|%s|%d|%s|%d", for_real, roomname, type, password, floor);
        } else {
-               aaa = (char *)malloc(strlen(roomname) + 40);
-               if (!aaa) return -1;
-               sprintf(aaa, "CRE8 %d|%s|%d||%d", for_real, roomname, type,
-                               floor);
+               aaa = (char *) malloc(strlen(roomname) + 40);
+               if (!aaa)
+                       return -1;
+               sprintf(aaa, "CRE8 %d|%s|%d||%d", for_real, roomname, type, floor);
        }
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
        free(aaa);
@@ -1097,28 +1178,34 @@ int CtdlIPCCreateRoom(CtdlIPC *ipc, int for_real, const char *roomname, int type
 
 
 /* FORG */
-int CtdlIPCForgetRoom(CtdlIPC *ipc, char *cret)
+int CtdlIPCForgetRoom(CtdlIPC * ipc, char *cret)
 {
-       if (!cret) return -2;
+       if (!cret)
+               return -2;
 
        return CtdlIPCGenericCommand(ipc, "FORG", NULL, 0, NULL, NULL, cret);
 }
 
 
 /* MESG */
-int CtdlIPCSystemMessage(CtdlIPC *ipc, const char *message, char **mret, char *cret)
+int CtdlIPCSystemMessage(CtdlIPC * ipc, const char *message, char **mret, char *cret)
 {
        int ret;
        char *aaa;
        size_t bytes;
 
-       if (!cret) return -2;
-       if (!mret) return -2;
-       if (*mret) return -2;
-       if (!message) return -2;
+       if (!cret)
+               return -2;
+       if (!mret)
+               return -2;
+       if (*mret)
+               return -2;
+       if (!message)
+               return -2;
 
-       aaa = (char *)malloc(strlen(message) + 6);
-       if (!aaa) return -1;
+       aaa = (char *) malloc(strlen(message) + 6);
+       if (!aaa)
+               return -1;
 
        sprintf(aaa, "MESG %s", message);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, mret, &bytes, cret);
@@ -1128,30 +1215,35 @@ int CtdlIPCSystemMessage(CtdlIPC *ipc, const char *message, char **mret, char *c
 
 
 /* GNUR */
-int CtdlIPCNextUnvalidatedUser(CtdlIPC *ipc, char *cret)
+int CtdlIPCNextUnvalidatedUser(CtdlIPC * ipc, char *cret)
 {
-       if (!cret) return -2;
+       if (!cret)
+               return -2;
 
        return CtdlIPCGenericCommand(ipc, "GNUR", NULL, 0, NULL, NULL, cret);
 }
 
 
 /* GREG */
-int CtdlIPCGetUserRegistration(CtdlIPC *ipc, const char *username, char **rret, char *cret)
+int CtdlIPCGetUserRegistration(CtdlIPC * ipc, const char *username, char **rret, char *cret)
 {
        int ret;
        char *aaa;
        size_t bytes;
 
-       if (!cret) return -2;
-       if (!rret) return -2;
-       if (*rret) return -2;
+       if (!cret)
+               return -2;
+       if (!rret)
+               return -2;
+       if (*rret)
+               return -2;
 
        if (username)
-               aaa = (char *)malloc(strlen(username) + 6);
+               aaa = (char *) malloc(strlen(username) + 6);
        else
-               aaa = (char *)malloc(12);
-       if (!aaa) return -1;
+               aaa = (char *) malloc(12);
+       if (!aaa)
+               return -1;
 
        if (username)
                sprintf(aaa, "GREG %s", username);
@@ -1164,17 +1256,21 @@ int CtdlIPCGetUserRegistration(CtdlIPC *ipc, const char *username, char **rret,
 
 
 /* VALI */
-int CtdlIPCValidateUser(CtdlIPC *ipc, const char *username, int axlevel, char *cret)
+int CtdlIPCValidateUser(CtdlIPC * ipc, const char *username, int axlevel, char *cret)
 {
        int ret;
        char *aaa;
 
-       if (!cret) return -2;
-       if (!username) return -2;
-       if (axlevel < AxDeleted || axlevel > AxAideU) return -2;
+       if (!cret)
+               return -2;
+       if (!username)
+               return -2;
+       if (axlevel < AxDeleted || axlevel > AxAideU)
+               return -2;
 
-       aaa = (char *)malloc(strlen(username) + 17);
-       if (!aaa) return -1;
+       aaa = (char *) malloc(strlen(username) + 17);
+       if (!aaa)
+               return -1;
 
        sprintf(aaa, "VALI %s|%d", username, axlevel);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -1184,12 +1280,14 @@ int CtdlIPCValidateUser(CtdlIPC *ipc, const char *username, int axlevel, char *c
 
 
 /* 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) return -1;
-       if (!info) return -1;
+       if (!cret)
+               return -1;
+       if (!info)
+               return -1;
 
        sprintf(aaa, "EINF %d", for_real);
        return CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -1197,44 +1295,51 @@ 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;
 
-       if (!cret) return -1;
-       if (!listing) return -1;
-       if (*listing) return -1;
-       if (!searchstring) return -1;
+       if (!cret)
+               return -1;
+       if (!listing)
+               return -1;
+       if (*listing)
+               return -1;
+       if (!searchstring)
+               return -1;
 
        cmd = malloc(strlen(searchstring) + 10);
        sprintf(cmd, "LIST %s", searchstring);
 
        ret = CtdlIPCGenericCommand(ipc, cmd, NULL, 0, listing, &bytes, cret);
        free(cmd);
-       return(ret);
+       return (ret);
 }
 
 
 /* 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) return -1;
+       if (!cret)
+               return -1;
+       if (!info)
+               return -1;
 
-       return CtdlIPCGenericCommand(ipc, "REGI", info, strlen(info),
-                       NULL, NULL, cret);
+       return CtdlIPCGenericCommand(ipc, "REGI", info, strlen(info), NULL, NULL, cret);
 }
 
 
 /* CHEK */
-int CtdlIPCMiscCheck(CtdlIPC *ipc, struct ctdlipcmisc *chek, char *cret)
+int CtdlIPCMiscCheck(CtdlIPC * ipc, struct ctdlipcmisc *chek, char *cret)
 {
        int ret;
 
-       if (!cret) return -1;
-       if (!chek) return -1;
+       if (!cret)
+               return -1;
+       if (!chek)
+               return -1;
 
        ret = CtdlIPCGenericCommand(ipc, "CHEK", NULL, 0, NULL, NULL, cret);
        if (ret / 100 == 2) {
@@ -1247,16 +1352,19 @@ 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;
 
-       if (!cret) return -2;
-       if (!filename) return -2;
-       
-       aaa = (char *)malloc(strlen(filename) + 6);
-       if (!aaa) return -1;
+       if (!cret)
+               return -2;
+       if (!filename)
+               return -2;
+
+       aaa = (char *) malloc(strlen(filename) + 6);
+       if (!aaa)
+               return -1;
 
        sprintf(aaa, "DELF %s", filename);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -1266,17 +1374,21 @@ 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;
 
-       if (!cret) return -2;
-       if (!filename) return -2;
-       if (!destroom) return -2;
+       if (!cret)
+               return -2;
+       if (!filename)
+               return -2;
+       if (!destroom)
+               return -2;
 
-       aaa = (char *)malloc(strlen(filename) + strlen(destroom) + 7);
-       if (!aaa) return -1;
+       aaa = (char *) malloc(strlen(filename) + strlen(destroom) + 7);
+       if (!aaa)
+               return -1;
 
        sprintf(aaa, "MOVF %s|%s", filename, destroom);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -1286,14 +1398,17 @@ int CtdlIPCMoveFile(CtdlIPC *ipc, const char *filename, const char *destroom, ch
 
 
 /* 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;
 
-       if (!cret) return -1;
-       if (!listing) return -1;
-       if (*listing) return -1;
+       if (!cret)
+               return -1;
+       if (!listing)
+               return -1;
+       if (*listing)
+               return -1;
 
        *stamp = CtdlIPCServerTime(ipc, cret);
        if (!*stamp)
@@ -1304,11 +1419,8 @@ 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)
+int CtdlIPCFileDownload(CtdlIPC * ipc, const char *filename, void **buf, size_t resume, void (*progress_gauge_callback)
+                        (CtdlIPC *, unsigned long, unsigned long), char *cret)
 {
        int ret;
        size_t bytes;
@@ -1316,14 +1428,20 @@ int CtdlIPCFileDownload(CtdlIPC *ipc, const char *filename, void **buf,
        char mimetype[SIZ];
        char *aaa;
 
-       if (!cret) return -2;
-       if (!filename) return -2;
-       if (!buf) return -2;
-       if (*buf) return -2;
-       if (ipc->downloading) return -2;
+       if (!cret)
+               return -2;
+       if (!filename)
+               return -2;
+       if (!buf)
+               return -2;
+       if (*buf)
+               return -2;
+       if (ipc->downloading)
+               return -2;
 
-       aaa = (char *)malloc(strlen(filename) + 6);
-       if (!aaa) return -1;
+       aaa = (char *) malloc(strlen(filename) + 6);
+       if (!aaa)
+               return -1;
 
        sprintf(aaa, "OPEN %s", filename);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -1334,28 +1452,23 @@ int CtdlIPCFileDownload(CtdlIPC *ipc, const char *filename, void **buf,
                last_mod = extract_int(cret, 1);
                extract_token(mimetype, cret, 2, '|', sizeof mimetype);
 
-               ret = CtdlIPCReadDownload(ipc, buf, bytes, resume,
-                                       progress_gauge_callback, cret);
+               ret = CtdlIPCReadDownload(ipc, buf, bytes, resume, progress_gauge_callback, cret);
                /*
-               ret = CtdlIPCHighSpeedReadDownload(ipc, buf, bytes, resume,
-                                       progress_gauge_callback, cret);
-               */
+                  ret = CtdlIPCHighSpeedReadDownload(ipc, buf, bytes, resume,
+                  progress_gauge_callback, cret);
+                */
 
                ret = CtdlIPCEndDownload(ipc, cret);
                if (ret / 100 == 2)
-                       sprintf(cret, "%d|%ld|%s|%s", (int)bytes, last_mod,
-                                       filename, mimetype);
+                       sprintf(cret, "%d|%ld|%s|%s", (int) bytes, last_mod, filename, mimetype);
        }
        return ret;
 }
 
 
 /* OPNA */
-int CtdlIPCAttachmentDownload(CtdlIPC *ipc, long msgnum, const char *part,
-               void **buf,
-               void (*progress_gauge_callback)
-                       (CtdlIPC*, unsigned long, unsigned long),
-               char *cret)
+int CtdlIPCAttachmentDownload(CtdlIPC * ipc, long msgnum, const char *part, void **buf, void (*progress_gauge_callback)
+                              (CtdlIPC *, unsigned long, unsigned long), char *cret)
 {
        int ret;
        size_t bytes;
@@ -1364,12 +1477,18 @@ int CtdlIPCAttachmentDownload(CtdlIPC *ipc, long msgnum, const char *part,
        char mimetype[SIZ];
        char aaa[SIZ];
 
-       if (!cret) return -2;
-       if (!buf) return -2;
-       if (*buf) return -2;
-       if (!part) return -2;
-       if (!msgnum) return -2;
-       if (ipc->downloading) return -2;
+       if (!cret)
+               return -2;
+       if (!buf)
+               return -2;
+       if (*buf)
+               return -2;
+       if (!part)
+               return -2;
+       if (!msgnum)
+               return -2;
+       if (ipc->downloading)
+               return -2;
 
        sprintf(aaa, "OPNA %ld|%s", msgnum, part);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -1383,18 +1502,15 @@ int CtdlIPCAttachmentDownload(CtdlIPC *ipc, long msgnum, const char *part,
                ret = CtdlIPCHighSpeedReadDownload(ipc, buf, bytes, 0, progress_gauge_callback, cret);
                ret = CtdlIPCEndDownload(ipc, cret);
                if (ret / 100 == 2)
-                       sprintf(cret, "%d|%ld|%s|%s", (int)bytes, last_mod,
-                                       filename, mimetype);
+                       sprintf(cret, "%d|%ld|%s|%s", (int) bytes, last_mod, filename, mimetype);
        }
        return ret;
 }
 
 
 /* OIMG */
-int CtdlIPCImageDownload(CtdlIPC *ipc, const char *filename, void **buf,
-               void (*progress_gauge_callback)
-                       (CtdlIPC*, unsigned long, unsigned long),
-               char *cret)
+int CtdlIPCImageDownload(CtdlIPC * ipc, const char *filename, void **buf, void (*progress_gauge_callback)
+                         (CtdlIPC *, unsigned long, unsigned long), char *cret)
 {
        int ret;
        size_t bytes;
@@ -1402,14 +1518,20 @@ int CtdlIPCImageDownload(CtdlIPC *ipc, const char *filename, void **buf,
        char mimetype[SIZ];
        char *aaa;
 
-       if (!cret) return -1;
-       if (!buf) return -1;
-       if (*buf) return -1;
-       if (!filename) return -1;
-       if (ipc->downloading) return -1;
+       if (!cret)
+               return -1;
+       if (!buf)
+               return -1;
+       if (*buf)
+               return -1;
+       if (!filename)
+               return -1;
+       if (ipc->downloading)
+               return -1;
 
-       aaa = (char *)malloc(strlen(filename) + 6);
-       if (!aaa) return -1;
+       aaa = (char *) malloc(strlen(filename) + 6);
+       if (!aaa)
+               return -1;
 
        sprintf(aaa, "OIMG %s", filename);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -1423,19 +1545,15 @@ int CtdlIPCImageDownload(CtdlIPC *ipc, const char *filename, void **buf,
                ret = CtdlIPCHighSpeedReadDownload(ipc, buf, bytes, 0, progress_gauge_callback, cret);
                ret = CtdlIPCEndDownload(ipc, cret);
                if (ret / 100 == 2)
-                       sprintf(cret, "%d|%ld|%s|%s", (int)bytes, last_mod,
-                                       filename, mimetype);
+                       sprintf(cret, "%d|%ld|%s|%s", (int) bytes, last_mod, filename, mimetype);
        }
        return ret;
 }
 
 
 /* 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)
+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)
 {
        int ret;
        char *aaa;
@@ -1444,26 +1562,34 @@ int CtdlIPCFileUpload(CtdlIPC *ipc, const char *save_as, const char *comment,
        const char *MimeType;
        long len;
 
-       if (!cret) return -1;
-       if (!save_as) return -1;
-       if (!comment) return -1;
-       if (!path) return -1;
-       if (!*path) return -1;
-       if (ipc->uploading) return -1;
+       if (!cret)
+               return -1;
+       if (!save_as)
+               return -1;
+       if (!comment)
+               return -1;
+       if (!path)
+               return -1;
+       if (!*path)
+               return -1;
+       if (ipc->uploading)
+               return -1;
 
        uploadFP = fopen(path, "r");
-       if (!uploadFP) return -2;
+       if (!uploadFP)
+               return -2;
 
        len = fread(&MimeTestBuf[0], 1, 64, uploadFP);
-       rewind (uploadFP);
-       if (len < 0) 
+       rewind(uploadFP);
+       if (len < 0)
                return -3;
 
        MimeType = GuessMimeType(&MimeTestBuf[0], len);
-       aaa = (char *)malloc(strlen(save_as) + strlen(MimeType) + strlen(comment) + 7);
-       if (!aaa) return -1;
+       aaa = (char *) malloc(strlen(save_as) + strlen(MimeType) + strlen(comment) + 7);
+       if (!aaa)
+               return -1;
 
-       sprintf(aaa, "UOPN %s|%s|%s", save_as, MimeType,  comment);
+       sprintf(aaa, "UOPN %s|%s|%s", save_as, MimeType, comment);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
        free(aaa);
        if (ret / 100 == 2) {
@@ -1477,11 +1603,8 @@ int CtdlIPCFileUpload(CtdlIPC *ipc, const char *save_as, const char *comment,
 
 
 /* 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)
+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)
 {
        int ret;
        FILE *uploadFP;
@@ -1490,21 +1613,28 @@ int CtdlIPCImageUpload(CtdlIPC *ipc, int for_real, const char *path,
        const char *MimeType;
        long len;
 
-       if (!cret) return -1;
-       if (!save_as) return -1;
-       if (!path && for_real) return -1;
-       if (!*path && for_real) return -1;
-       if (ipc->uploading) return -1;
+       if (!cret)
+               return -1;
+       if (!save_as)
+               return -1;
+       if (!path && for_real)
+               return -1;
+       if (!*path && for_real)
+               return -1;
+       if (ipc->uploading)
+               return -1;
 
-       aaa = (char *)malloc(strlen(save_as) + 17);
-       if (!aaa) return -1;
+       aaa = (char *) malloc(strlen(save_as) + 17);
+       if (!aaa)
+               return -1;
 
        uploadFP = fopen(path, "r");
-       if (!uploadFP) return -2;
+       if (!uploadFP)
+               return -2;
 
        len = fread(&MimeTestBuf[0], 1, 64, uploadFP);
-       rewind (uploadFP);
-       if (len < 0) 
+       rewind(uploadFP);
+       if (len < 0)
                return -3;
        MimeType = GuessMimeType(&MimeTestBuf[0], 64);
 
@@ -1522,16 +1652,19 @@ int CtdlIPCImageUpload(CtdlIPC *ipc, int for_real, const char *path,
 
 
 /* QUSR */
-int CtdlIPCQueryUsername(CtdlIPC *ipc, const char *username, char *cret)
+int CtdlIPCQueryUsername(CtdlIPC * ipc, const char *username, char *cret)
 {
        int ret;
        char *aaa;
 
-       if (!cret) return -2;
-       if (!username) return -2;
+       if (!cret)
+               return -2;
+       if (!username)
+               return -2;
 
-       aaa = (char *)malloc(strlen(username) + 6);
-       if (!aaa) return -1;
+       aaa = (char *) malloc(strlen(username) + 6);
+       if (!aaa)
+               return -1;
 
        sprintf(aaa, "QUSR %s", username);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -1541,26 +1674,31 @@ 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) return -2;
-       if (!listing) return -2;
-       if (*listing) return -2;
+       if (!cret)
+               return -2;
+       if (!listing)
+               return -2;
+       if (*listing)
+               return -2;
 
        return CtdlIPCGenericCommand(ipc, "LFLR", NULL, 0, listing, &bytes, 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];
 
-       if (!cret) return -2;
-       if (!name) return -2;
+       if (!cret)
+               return -2;
+       if (!name)
+               return -2;
 
        sprintf(aaa, "CFLR %s|%d", name, for_real);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -1569,12 +1707,14 @@ 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) return -1;
-       if (floornum < 0) return -1;
+       if (!cret)
+               return -1;
+       if (floornum < 0)
+               return -1;
 
        sprintf(aaa, "KFLR %d|%d", floornum, for_real);
        return CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -1582,14 +1722,17 @@ 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];
 
-       if (!cret) return -2;
-       if (!floorname) return -2;
-       if (floornum < 0) return -2;
+       if (!cret)
+               return -2;
+       if (!floorname)
+               return -2;
+       if (floornum < 0)
+               return -2;
 
        sprintf(aaa, "EFLR %d|%s", floornum, floorname);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -1603,27 +1746,26 @@ int CtdlIPCEditFloor(CtdlIPC *ipc, int floornum, const char *floorname, char *cr
  * You only need to fill out hostname, the defaults will be used if any of the
  * 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 CtdlIPCIdentifySoftware(CtdlIPC * ipc, int developerid, int clientid,
+                           int revision, const char *software_name, const char *hostname, char *cret)
 {
        int ret;
        char *aaa;
 
-       if (developerid < 0 || clientid < 0 || revision < 0 ||
-           !software_name) {
+       if (developerid < 0 || clientid < 0 || revision < 0 || !software_name) {
                developerid = 8;
                clientid = 0;
                revision = CLIENT_VERSION - 600;
                software_name = "Citadel (libcitadel)";
        }
-       if (!hostname) return -2;
+       if (!hostname)
+               return -2;
 
-       aaa = (char *)malloc(strlen(software_name) + strlen(hostname) + 29);
-       if (!aaa) return -1;
+       aaa = (char *) malloc(strlen(software_name) + strlen(hostname) + 29);
+       if (!aaa)
+               return -1;
 
-       sprintf(aaa, "IDEN %d|%d|%d|%s|%s", developerid, clientid,
-                       revision, software_name, hostname);
+       sprintf(aaa, "IDEN %d|%d|%d|%s|%s", developerid, clientid, revision, software_name, hostname);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
        free(aaa);
        return ret;
@@ -1631,22 +1773,23 @@ 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;
 
-       if (!cret) return -2;
-       if (!username) return -2;
+       if (!cret)
+               return -2;
+       if (!username)
+               return -2;
 
-       aaa = (char *)malloc(strlen(username) + 8);
-       if (!aaa) return -1;
+       aaa = (char *) malloc(strlen(username) + 8);
+       if (!aaa)
+               return -1;
 
        if (text) {
                sprintf(aaa, "SEXP %s|-", username);
-               ret = CtdlIPCGenericCommand(ipc, aaa, text, strlen(text),
-                               NULL, NULL, cret);
+               ret = CtdlIPCGenericCommand(ipc, aaa, text, strlen(text), NULL, NULL, cret);
        } else {
                sprintf(aaa, "SEXP %s||", username);
                ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -1657,13 +1800,16 @@ int CtdlIPCSendInstantMessage(CtdlIPC *ipc, const char *username, const char *te
 
 
 /* GEXP */
-int CtdlIPCGetInstantMessage(CtdlIPC *ipc, char **listing, char *cret)
+int CtdlIPCGetInstantMessage(CtdlIPC * ipc, char **listing, char *cret)
 {
        size_t bytes;
 
-       if (!cret) return -2;
-       if (!listing) return -2;
-       if (*listing) return -2;
+       if (!cret)
+               return -2;
+       if (!listing)
+               return -2;
+       if (*listing)
+               return -2;
 
        return CtdlIPCGenericCommand(ipc, "GEXP", NULL, 0, listing, &bytes, cret);
 }
@@ -1671,11 +1817,12 @@ 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) return -2;
+       if (!cret)
+               return -2;
 
        sprintf(aaa, "DEXP %d", mode);
        return CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -1683,30 +1830,36 @@ 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) return -2;
+       if (!cret)
+               return -2;
+       if (!bio)
+               return -2;
 
-       return CtdlIPCGenericCommand(ipc, "EBIO", bio, strlen(bio),
-                       NULL, NULL, cret);
+       return CtdlIPCGenericCommand(ipc, "EBIO", bio, strlen(bio), NULL, NULL, 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;
 
-       if (!cret) return -2;
-       if (!username) return -2;
-       if (!listing) return -2;
-       if (*listing) return -2;
+       if (!cret)
+               return -2;
+       if (!username)
+               return -2;
+       if (!listing)
+               return -2;
+       if (*listing)
+               return -2;
 
-       aaa = (char *)malloc(strlen(username) + 6);
-       if (!aaa) return -1;
+       aaa = (char *) malloc(strlen(username) + 6);
+       if (!aaa)
+               return -1;
 
        sprintf(aaa, "RBIO %s", username);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, listing, &bytes, cret);
@@ -1716,24 +1869,28 @@ int CtdlIPCGetBio(CtdlIPC *ipc, const char *username, char **listing, char *cret
 
 
 /* LBIO */
-int CtdlIPCListUsersWithBios(CtdlIPC *ipc, char **listing, char *cret)
+int CtdlIPCListUsersWithBios(CtdlIPC * ipc, char **listing, char *cret)
 {
        size_t bytes;
 
-       if (!cret) return -2;
-       if (!listing) return -2;
-       if (*listing) return -2;
+       if (!cret)
+               return -2;
+       if (!listing)
+               return -2;
+       if (*listing)
+               return -2;
 
        return CtdlIPCGenericCommand(ipc, "LBIO", NULL, 0, listing, &bytes, cret);
 }
 
 
 /* STEL */
-int CtdlIPCStealthMode(CtdlIPC *ipc, int mode, char *cret)
+int CtdlIPCStealthMode(CtdlIPC * ipc, int mode, char *cret)
 {
        char aaa[64];
 
-       if (!cret) return -1;
+       if (!cret)
+               return -1;
 
        sprintf(aaa, "STEL %d", mode ? 1 : 0);
        return CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -1741,11 +1898,12 @@ 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) return -1;
+       if (!cret)
+               return -1;
 
        sprintf(aaa, "TERM %d", sid);
        return CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -1753,20 +1911,22 @@ 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;
+       if (!cret)
+               return -1;
 
        return CtdlIPCGenericCommand(ipc, "DOWN", NULL, 0, NULL, NULL, cret);
 }
 
 
 /* SCDN */
-int CtdlIPCTerminateServerScheduled(CtdlIPC *ipc, int mode, char *cret)
+int CtdlIPCTerminateServerScheduled(CtdlIPC * ipc, int mode, char *cret)
 {
        char aaa[16];
 
-       if (!cret) return -1;
+       if (!cret)
+               return -1;
 
        sprintf(aaa, "SCDN %d", mode ? 1 : 0);
        return CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -1774,18 +1934,21 @@ 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;
 
-       if (!cret) return -2;
-       if (!text) return -2;
-       if (!filename) return -2;
+       if (!cret)
+               return -2;
+       if (!text)
+               return -2;
+       if (!filename)
+               return -2;
 
-       aaa = (char *)malloc(strlen(filename) + 6);
-       if (!aaa) return -1;
+       aaa = (char *) malloc(strlen(filename) + 6);
+       if (!aaa)
+               return -1;
 
        sprintf(aaa, "EMSG %s", filename);
        ret = CtdlIPCGenericCommand(ipc, aaa, text, strlen(text), NULL, NULL, cret);
@@ -1795,16 +1958,19 @@ int CtdlIPCEnterSystemMessage(CtdlIPC *ipc, const char *filename, const char *te
 
 
 /* HCHG */
-int CtdlIPCChangeHostname(CtdlIPC *ipc, const char *hostname, char *cret)
+int CtdlIPCChangeHostname(CtdlIPC * ipc, const char *hostname, char *cret)
 {
        int ret;
        char *aaa;
 
-       if (!cret) return -2;
-       if (!hostname) return -2;
+       if (!cret)
+               return -2;
+       if (!hostname)
+               return -2;
 
-       aaa = (char *)malloc(strlen(hostname) + 6);
-       if (!aaa) return -1;
+       aaa = (char *) malloc(strlen(hostname) + 6);
+       if (!aaa)
+               return -1;
 
        sprintf(aaa, "HCHG %s", hostname);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -1814,16 +1980,19 @@ int CtdlIPCChangeHostname(CtdlIPC *ipc, const char *hostname, char *cret)
 
 
 /* RCHG */
-int CtdlIPCChangeRoomname(CtdlIPC *ipc, const char *roomname, char *cret)
+int CtdlIPCChangeRoomname(CtdlIPC * ipc, const char *roomname, char *cret)
 {
        int ret;
        char *aaa;
 
-       if (!cret) return -2;
-       if (!roomname) return -2;
+       if (!cret)
+               return -2;
+       if (!roomname)
+               return -2;
 
-       aaa = (char *)malloc(strlen(roomname) + 6);
-       if (!aaa) return -1;
+       aaa = (char *) malloc(strlen(roomname) + 6);
+       if (!aaa)
+               return -1;
 
        sprintf(aaa, "RCHG %s", roomname);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -1833,16 +2002,19 @@ int CtdlIPCChangeRoomname(CtdlIPC *ipc, const char *roomname, char *cret)
 
 
 /* UCHG */
-int CtdlIPCChangeUsername(CtdlIPC *ipc, const char *username, char *cret)
+int CtdlIPCChangeUsername(CtdlIPC * ipc, const char *username, char *cret)
 {
        int ret;
        char *aaa;
 
-       if (!cret) return -2;
-       if (!username) return -2;
+       if (!cret)
+               return -2;
+       if (!username)
+               return -2;
 
-       aaa = (char *)malloc(strlen(username) + 6);
-       if (!aaa) return -1;
+       aaa = (char *) malloc(strlen(username) + 6);
+       if (!aaa)
+               return -1;
 
        sprintf(aaa, "UCHG %s", username);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -1853,7 +2025,7 @@ int CtdlIPCChangeUsername(CtdlIPC *ipc, const char *username, char *cret)
 
 /* 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;
@@ -1869,15 +2041,19 @@ 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];
 
-       if (!cret) return -2;
-       if (!uret) return -2;
-       if (!*uret) *uret = (struct ctdluser *)calloc(1, sizeof(struct ctdluser));
-       if (!*uret) return -1;
+       if (!cret)
+               return -2;
+       if (!uret)
+               return -2;
+       if (!*uret)
+               *uret = (struct ctdluser *) calloc(1, sizeof(struct ctdluser));
+       if (!*uret)
+               return -1;
 
        sprintf(aaa, "AGUP %s", who);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -1898,21 +2074,23 @@ 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;
 
-       if (!cret) return -2;
-       if (!uret) return -2;
+       if (!cret)
+               return -2;
+       if (!uret)
+               return -2;
 
-       aaa = (char *)malloc(strlen(uret->fullname) + strlen(uret->password) + 84);
-       if (!aaa) return -1;
+       aaa = (char *) malloc(strlen(uret->fullname) + strlen(uret->password) + 84);
+       if (!aaa)
+               return -1;
 
        sprintf(aaa, "ASUP %s|%s|%d|%ld|%ld|%d|%ld|%ld|%d",
                uret->fullname, uret->password, uret->flags, uret->timescalled,
-               uret->posted, uret->axlevel, uret->usernum, uret->lastcall, uret->USuserpurge
-       );
+               uret->posted, uret->axlevel, uret->usernum, uret->lastcall, uret->USuserpurge);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
        free(aaa);
        return ret;
@@ -1920,7 +2098,7 @@ int CtdlIPCAideSetUserParameters(CtdlIPC *ipc, const struct ctdluser *uret, char
 
 
 /* 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];
@@ -1943,14 +2121,17 @@ int CtdlIPCAideGetEmailAddresses(CtdlIPC *ipc, const char *who, char *target_buf
 
 
 /* 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;
 
-       if (!who) return -2;
-       if (!emailaddrs) return -2;
-       if (!cret) return -2;
+       if (!who)
+               return -2;
+       if (!emailaddrs)
+               return -2;
+       if (!cret)
+               return -2;
 
        sprintf(aaa, "ASEA %s", who);
        ret = CtdlIPCGenericCommand(ipc, aaa, emailaddrs, 0, NULL, NULL, cret);
@@ -1961,8 +2142,7 @@ int CtdlIPCAideSetEmailAddresses(CtdlIPC *ipc, const char *who, char *emailaddrs
 /* 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),
@@ -1973,12 +2153,17 @@ int CtdlIPCGetMessageExpirationPolicy(CtdlIPC *ipc, GPEXWhichPolicy which,
        char cmd[256];
        int ret;
 
-       if (!cret) return -2;
-       if (!policy) return -2;
-       if (!*policy) *policy = (struct ExpirePolicy *)calloc(1, sizeof(struct ExpirePolicy));
-       if (!*policy) return -1;
-       if (which < 0 || which > 3) return -2;
-       
+       if (!cret)
+               return -2;
+       if (!policy)
+               return -2;
+       if (!*policy)
+               *policy = (struct ExpirePolicy *) calloc(1, sizeof(struct ExpirePolicy));
+       if (!*policy)
+               return -1;
+       if (which < 0 || which > 3)
+               return -2;
+
        sprintf(cmd, "GPEX %s", proto[which]);
        ret = CtdlIPCGenericCommand(ipc, cmd, NULL, 0, NULL, NULL, cret);
        if (ret / 100 == 2) {
@@ -1992,63 +2177,74 @@ int CtdlIPCGetMessageExpirationPolicy(CtdlIPC *ipc, GPEXWhichPolicy which,
 /* 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" };
 
-       if (!cret) return -2;
-       if (which < 0 || which > 3) return -2;
-       if (!policy) return -2;
-       if (policy->expire_mode < 0 || policy->expire_mode > 3) return -2;
-       if (policy->expire_mode >= 2 && policy->expire_value < 1) return -2;
+       if (!cret)
+               return -2;
+       if (which < 0 || which > 3)
+               return -2;
+       if (!policy)
+               return -2;
+       if (policy->expire_mode < 0 || policy->expire_mode > 3)
+               return -2;
+       if (policy->expire_mode >= 2 && policy->expire_value < 1)
+               return -2;
 
-       sprintf(aaa, "SPEX %s|%d|%d", whichvals[which],
-                       policy->expire_mode, policy->expire_value);
+       sprintf(aaa, "SPEX %s|%d|%d", whichvals[which], policy->expire_mode, policy->expire_value);
        return CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
 }
 
 
 /* CONF GET */
-int CtdlIPCGetSystemConfig(CtdlIPC *ipc, char **listing, char *cret)
+int CtdlIPCGetSystemConfig(CtdlIPC * ipc, char **listing, char *cret)
 {
        size_t bytes;
 
-       if (!cret) return -2;
-       if (!listing) return -2;
-       if (*listing) return -2;
+       if (!cret)
+               return -2;
+       if (!listing)
+               return -2;
+       if (*listing)
+               return -2;
 
-       return CtdlIPCGenericCommand(ipc, "CONF GET", NULL, 0,
-                       listing, &bytes, cret);
+       return CtdlIPCGenericCommand(ipc, "CONF GET", NULL, 0, listing, &bytes, 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) return -2;
+       if (!cret)
+               return -2;
+       if (!listing)
+               return -2;
 
-       return CtdlIPCGenericCommand(ipc, "CONF SET", listing, strlen(listing),
-                       NULL, NULL, cret);
+       return CtdlIPCGenericCommand(ipc, "CONF SET", listing, strlen(listing), NULL, NULL, 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;
 
-       if (!cret) return -2;
-       if (!mimetype) return -2;
-       if (!listing) return -2;
-       if (*listing) return -2;
+       if (!cret)
+               return -2;
+       if (!mimetype)
+               return -2;
+       if (!listing)
+               return -2;
+       if (*listing)
+               return -2;
 
        aaa = malloc(strlen(mimetype) + 13);
-       if (!aaa) return -1;
+       if (!aaa)
+               return -1;
        sprintf(aaa, "CONF GETSYS|%s", mimetype);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, listing, &bytes, cret);
        free(aaa);
@@ -2057,17 +2253,21 @@ int CtdlIPCGetSystemConfigByType(CtdlIPC *ipc, const char *mimetype, char **list
 
 
 /* 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;
 
-       if (!cret) return -2;
-       if (!mimetype) return -2;
-       if (!listing) return -2;
+       if (!cret)
+               return -2;
+       if (!mimetype)
+               return -2;
+       if (!listing)
+               return -2;
 
        aaa = malloc(strlen(mimetype) + 13);
-       if (!aaa) return -1;
+       if (!aaa)
+               return -1;
        sprintf(aaa, "CONF PUTSYS|%s", mimetype);
        ret = CtdlIPCGenericCommand(ipc, aaa, listing, strlen(listing), NULL, NULL, cret);
        free(aaa);
@@ -2076,35 +2276,42 @@ 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) return -2;
-       if (!listing) return -2;
-       if (*listing) return -2;
+       if (!cret)
+               return -2;
+       if (!listing)
+               return -2;
+       if (*listing)
+               return -2;
 
        return CtdlIPCGenericCommand(ipc, "GNET", NULL, 0, listing, &bytes, 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) return -2;
+       if (!cret)
+               return -2;
+       if (!listing)
+               return -2;
 
        return CtdlIPCGenericCommand(ipc, "SNET", listing, strlen(listing), NULL, NULL, cret);
 }
 
 
 /* REQT */
-int CtdlIPCRequestClientLogout(CtdlIPC *ipc, int session, char *cret)
+int CtdlIPCRequestClientLogout(CtdlIPC * ipc, int session, char *cret)
 {
        char aaa[64];
 
-       if (!cret) return -2;
-       if (session < 0) return -2;
+       if (!cret)
+               return -2;
+       if (session < 0)
+               return -2;
 
        sprintf(aaa, "REQT %d", session);
        return CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -2112,12 +2319,14 @@ 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) return -2;
-       if (msgnum < 0) return -2;
+       if (!cret)
+               return -2;
+       if (msgnum < 0)
+               return -2;
 
        sprintf(aaa, "SEEN %ld|%d", msgnum, seen ? 1 : 0);
        return CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -2125,7 +2334,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;
@@ -2142,7 +2351,7 @@ int CtdlIPCStartEncryption(CtdlIPC *ipc, char *cret)
        }
        /* Pointless flag waving */
 #if SSLEAY_VERSION_NUMBER >= 0x0922
-       SSL_set_session_id_context(temp_ssl, (const unsigned char*) "Citadel SID", 14);
+       SSL_set_session_id_context(temp_ssl, (const unsigned char *) "Citadel SID", 14);
 #endif
 
        /* Associate network connection with SSL object */
@@ -2172,18 +2381,17 @@ int CtdlIPCStartEncryption(CtdlIPC *ipc, char *cret)
        ipc->ssl = temp_ssl;
 
        error_printf("Encrypting with %s cipher %s\n",
-               SSL_CIPHER_get_version(SSL_get_current_cipher(ipc->ssl)),
-               SSL_CIPHER_get_name(SSL_get_current_cipher(ipc->ssl))
-       );
+                    SSL_CIPHER_get_version(SSL_get_current_cipher(ipc->ssl)), SSL_CIPHER_get_name(SSL_get_current_cipher(ipc->ssl))
+           );
        return r;
 #else
        return 0;
-#endif /* HAVE_OPENSSL */
+#endif                         /* HAVE_OPENSSL */
 }
 
 
 #ifdef HAVE_OPENSSL
-static void endtls(SSL *ssl)
+static void endtls(SSL * ssl)
 {
        if (ssl) {
                SSL_shutdown(ssl);
@@ -2194,16 +2402,19 @@ 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;
 
-       if (!address) return -2;
-       if (!cret) return -2;
+       if (!address)
+               return -2;
+       if (!cret)
+               return -2;
 
-       aaa = (char *)malloc(strlen(address) + 6);
-       if (!aaa) return -1;
+       aaa = (char *) malloc(strlen(address) + 6);
+       if (!aaa)
+               return -1;
 
        sprintf(aaa, "QDIR %s", address);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
@@ -2213,11 +2424,12 @@ 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) return -2;
+       if (!cret)
+               return -2;
        sprintf(aaa, "IPGM %d", secret);
        return CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
 }
@@ -2231,7 +2443,7 @@ int CtdlIPCInternalProgram(CtdlIPC *ipc, int secret, char *cret)
 
 
 /* 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;
@@ -2247,7 +2459,7 @@ char *CtdlIPCReadListing(CtdlIPC *ipc, char *dest)
 
        while (CtdlIPC_getline(ipc, aaa), strcmp(aaa, "000")) {
                linelength = strlen(aaa);
-               ret = (char *)realloc(ret, (size_t)(length + linelength + 2));
+               ret = (char *) realloc(ret, (size_t) (length + linelength + 2));
                if (ret) {
                        strcpy(&ret[length], aaa);
                        length += linelength;
@@ -2255,16 +2467,16 @@ char *CtdlIPCReadListing(CtdlIPC *ipc, char *dest)
                }
        }
 
-       return(ret);
+       return (ret);
 }
 
 
 /* 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);
+       text = (char *) malloc(strlen(listing) + 6);
        if (text) {
                strcpy(text, listing);
                while (text[strlen(text) - 1] == '\n')
@@ -2284,27 +2496,30 @@ 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];
 
-       if (!buf) return 0;
-       if (!cret) return 0;
-       if (bytes < 1) return 0;
+       if (!buf)
+               return 0;
+       if (!cret)
+               return 0;
+       if (bytes < 1)
+               return 0;
 
        CtdlIPC_lock(ipc);
-       sprintf(aaa, "READ %d|%d", (int)offset, (int)bytes);
+       sprintf(aaa, "READ %d|%d", (int) offset, (int) bytes);
        CtdlIPC_putline(ipc, aaa);
        CtdlIPC_getline(ipc, aaa);
        if (aaa[0] != '6')
                strcpy(cret, &aaa[4]);
        else {
                len = extract_long(&aaa[4], 0);
-               *buf = (void *)realloc(*buf, (size_t)(offset + len));
+               *buf = (void *) realloc(*buf, (size_t) (offset + len));
                if (*buf) {
                        /* I know what I'm doing */
-                       serv_read(ipc, ((char *)(*buf) + offset), len);
+                       serv_read(ipc, ((char *) (*buf) + offset), len);
                } else {
                        /* We have to read regardless */
                        serv_read(ipc, aaa, len);
@@ -2317,12 +2532,14 @@ 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) return -2;
-       if (!ipc->downloading) return -2;
+       if (!cret)
+               return -2;
+       if (!ipc->downloading)
+               return -2;
 
        ret = CtdlIPCGenericCommand(ipc, "CLOS", NULL, 0, NULL, NULL, cret);
        if (ret / 100 == 2)
@@ -2332,10 +2549,11 @@ 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];
-       
+
        snprintf(cmd, sizeof cmd, "MSGP %s", formats);
        ret = CtdlIPCGenericCommand(ipc, cmd, NULL, 0, NULL, NULL, cret);
        return ret;
@@ -2344,17 +2562,19 @@ 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)
+int CtdlIPCReadDownload(CtdlIPC * ipc, void **buf, size_t bytes, size_t resume, void (*progress_gauge_callback)
+                        (CtdlIPC *, unsigned long, unsigned long), char *cret)
 {
        size_t len;
 
-       if (!cret) return -1;
-       if (!buf) return -1;
-       if (*buf) return -1;
-       if (!ipc->downloading) return -1;
+       if (!cret)
+               return -1;
+       if (!buf)
+               return -1;
+       if (*buf)
+               return -1;
+       if (!ipc->downloading)
+               return -1;
 
        len = resume;
        if (progress_gauge_callback)
@@ -2375,24 +2595,26 @@ 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)
+int CtdlIPCHighSpeedReadDownload(CtdlIPC * ipc, void **buf, size_t bytes, size_t resume, void (*progress_gauge_callback)
+                                 (CtdlIPC *, unsigned long, unsigned long), char *cret)
 {
        size_t len;
-       int calls;      /* How many calls in the pipeline */
-       int i;          /* iterator */
+       int calls;              /* How many calls in the pipeline */
+       int i;                  /* iterator */
        char aaa[4096];
 
-       if (!cret) return -1;
-       if (!buf) return -1;
-       if (*buf) return -1;
-       if (!ipc->downloading) return -1;
+       if (!cret)
+               return -1;
+       if (!buf)
+               return -1;
+       if (*buf)
+               return -1;
+       if (!ipc->downloading)
+               return -1;
 
-       *buf = (void *)realloc(*buf, bytes - resume);
-       if (!*buf) return -1;
+       *buf = (void *) realloc(*buf, bytes - resume);
+       if (!*buf)
+               return -1;
 
        len = 0;
        CtdlIPC_lock(ipc);
@@ -2401,11 +2623,12 @@ int CtdlIPCHighSpeedReadDownload(CtdlIPC *ipc, void **buf, size_t bytes,
 
        /* How many calls will be in the pipeline? */
        calls = (bytes - resume) / 4096;
-       if ((bytes - resume) % 4096) calls++;
+       if ((bytes - resume) % 4096)
+               calls++;
 
        /* Send all requests at once */
        for (i = 0; i < calls; i++) {
-               sprintf(aaa, "READ %d|4096", (int)(i * 4096 + resume) );
+               sprintf(aaa, "READ %d|4096", (int) (i * 4096 + resume));
                CtdlIPC_putline(ipc, aaa);
        }
 
@@ -2417,7 +2640,7 @@ int CtdlIPCHighSpeedReadDownload(CtdlIPC *ipc, void **buf, size_t bytes,
                else {
                        len = extract_long(&aaa[4], 0);
                        /* I know what I'm doing */
-                       serv_read(ipc, ((char *)(*buf) + (i * 4096)), len);
+                       serv_read(ipc, ((char *) (*buf) + (i * 4096)), len);
                }
                if (progress_gauge_callback)
                        progress_gauge_callback(ipc, i * 4096 + len, bytes);
@@ -2428,13 +2651,15 @@ int CtdlIPCHighSpeedReadDownload(CtdlIPC *ipc, void **buf, size_t bytes,
 
 
 /* UCLS */
-int CtdlIPCEndUpload(CtdlIPC *ipc, int discard, char *cret)
+int CtdlIPCEndUpload(CtdlIPC * ipc, int discard, char *cret)
 {
        int ret;
        char cmd[8];
 
-       if (!cret) return -1;
-       if (!ipc->uploading) return -1;
+       if (!cret)
+               return -1;
+       if (!ipc->uploading)
+               return -1;
 
        sprintf(cmd, "UCLS %d", discard ? 0 : 1);
        ret = CtdlIPCGenericCommand(ipc, cmd, NULL, 0, NULL, NULL, cret);
@@ -2444,10 +2669,8 @@ 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)
+int CtdlIPCWriteUpload(CtdlIPC * ipc, FILE * uploadFP, void (*progress_gauge_callback)
+                       (CtdlIPC *, unsigned long, unsigned long), char *cret)
 {
        int ret = -1;
        size_t offset = 0;
@@ -2457,7 +2680,8 @@ int CtdlIPCWriteUpload(CtdlIPC *ipc, FILE *uploadFP,
        FILE *fd = uploadFP;
        int ferr;
 
-       if (!cret) return -1;
+       if (!cret)
+               return -1;
 
        fseek(fd, 0L, SEEK_END);
        bytes = ftell(fd);
@@ -2472,23 +2696,24 @@ int CtdlIPCWriteUpload(CtdlIPC *ipc, FILE *uploadFP,
                /* Read some data in */
                to_write = fread(buf, 1, 4096, fd);
                if (!to_write) {
-                       if (feof(fd) || ferror(fd)) break;
+                       if (feof(fd) || ferror(fd))
+                               break;
                }
-               sprintf(aaa, "WRIT %d", (int)to_write);
+               sprintf(aaa, "WRIT %d", (int) to_write);
                CtdlIPC_putline(ipc, aaa);
                CtdlIPC_getline(ipc, aaa);
                strcpy(cret, &aaa[4]);
                ret = atoi(aaa);
                if (aaa[0] == '7') {
                        to_write = extract_long(&aaa[4], 0);
-                       
+
                        serv_write(ipc, buf, to_write);
                        offset += to_write;
                        if (progress_gauge_callback)
                                progress_gauge_callback(ipc, offset, bytes);
                        /* Detect short reads and back up if needed */
                        /* offset will never be negative anyway */
-                       fseek(fd, (signed)offset, SEEK_SET);
+                       fseek(fd, (signed) offset, SEEK_SET);
                } else {
                        break;
                }
@@ -2528,16 +2753,17 @@ int CtdlIPCWriteUpload(CtdlIPC *ipc, FILE *uploadFP,
  * 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;
 
-       if (!command) return -2;
-       if (!proto_response) return -2;
+       if (!command)
+               return -2;
+       if (!proto_response)
+               return -2;
 
        CtdlIPC_lock(ipc);
        CtdlIPC_putline(ipc, command);
@@ -2548,21 +2774,21 @@ int CtdlIPCGenericCommand(CtdlIPC *ipc,
                ret = atoi(proto_response);
                strcpy(proto_response, &proto_response[4]);
                switch (ret / 100) {
-               default:                        /* Unknown, punt */
-               case 2:                         /* OK */
-               case 3:                         /* MORE_DATA */
-               case 5:                         /* ERROR */
+               default:        /* Unknown, punt */
+               case 2: /* OK */
+               case 3: /* MORE_DATA */
+               case 5: /* ERROR */
                        /* Don't need to do anything */
                        break;
-               case 1:                         /* LISTING_FOLLOWS */
+               case 1: /* LISTING_FOLLOWS */
                        if (to_receive && !*to_receive && bytes_to_receive) {
                                *to_receive = CtdlIPCReadListing(ipc, NULL);
-                       } else { /* Drain */
-                               while (CtdlIPC_getline(ipc, buf), strcmp(buf, "000")) ;
+                       } else {        /* Drain */
+                               while (CtdlIPC_getline(ipc, buf), strcmp(buf, "000"));
                                ret = -ret;
                        }
                        break;
-               case 4:                         /* SEND_LISTING */
+               case 4: /* SEND_LISTING */
                        if (to_send) {
                                CtdlIPCSendListing(ipc, to_send);
                        } else {
@@ -2571,17 +2797,15 @@ int CtdlIPCGenericCommand(CtdlIPC *ipc,
                                ret = -ret;
                        }
                        break;
-               case 6:                         /* BINARY_FOLLOWS */
+               case 6: /* BINARY_FOLLOWS */
                        if (to_receive && !*to_receive && bytes_to_receive) {
-                               *bytes_to_receive =
-                                       extract_long(proto_response, 0);
+                               *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 {
-                                       serv_read(ipc, *to_receive,
-                                                       *bytes_to_receive);
+                                       serv_read(ipc, *to_receive, *bytes_to_receive);
                                }
                        } else {
                                /* Drain */
@@ -2596,7 +2820,7 @@ int CtdlIPCGenericCommand(CtdlIPC *ipc,
                                ret = -ret;
                        }
                        break;
-               case 7:                         /* SEND_BINARY */
+               case 7: /* SEND_BINARY */
                        if (to_send && bytes_to_send) {
                                serv_write(ipc, to_send, bytes_to_send);
                        } else if (bytes_to_send) {
@@ -2611,9 +2835,9 @@ int CtdlIPCGenericCommand(CtdlIPC *ipc,
                                }
                                serv_write(ipc, buf, fake);
                                ret = -ret;
-                       } /* else who knows?  DANGER WILL ROBINSON */
+                       }       /* else who knows?  DANGER WILL ROBINSON */
                        break;
-               case 8:                         /* START_CHAT_MODE */
+               case 8: /* START_CHAT_MODE */
                        if (!strncasecmp(command, "CHAT", 4)) {
                                /* Don't call chatmode with generic! */
                                CtdlIPC_putline(ipc, "/quit");
@@ -2627,17 +2851,15 @@ int CtdlIPCGenericCommand(CtdlIPC *ipc,
                                        CtdlIPC_putline(ipc, "000");
                                        ret = -ret;
                                }
-                               if (to_receive && !*to_receive
-                                               && bytes_to_receive) {
+                               if (to_receive && !*to_receive && bytes_to_receive) {
                                        *to_receive = CtdlIPCReadListing(ipc, NULL);
-                               } else { /* Drain */
-                                       while (CtdlIPC_getline(ipc, buf),
-                                                       strcmp(buf, "000")) ;
+                               } else {        /* Drain */
+                                       while (CtdlIPC_getline(ipc, buf), strcmp(buf, "000"));
                                        ret = -ret;
                                }
                        }
                        break;
-               case 9:                         /* ASYNC_MSG */
+               case 9: /* ASYNC_MSG */
                        /* CtdlIPCDoAsync(ret, proto_response); */
                        free(CtdlIPCReadListing(ipc, NULL));    /* STUB FIXME */
                        break;
@@ -2663,10 +2885,10 @@ static int tcp_connectsock(char *host, char *service)
        int sock = (-1);
 
        if ((host == NULL) || IsEmptyStr(host)) {
-               service = DEFAULT_HOST ;
+               service = DEFAULT_HOST;
        }
        if ((service == NULL) || IsEmptyStr(service)) {
-               service = DEFAULT_PORT ;
+               service = DEFAULT_PORT;
        }
 
        memset(&hints, 0x00, sizeof(hints));
@@ -2678,13 +2900,12 @@ static int tcp_connectsock(char *host, char *service)
         * Handle numeric IPv4 and IPv6 addresses
         */
        rc = inet_pton(AF_INET, host, &serveraddr);
-       if (rc == 1) {                                          /* dotted quad */
+       if (rc == 1) {          /* dotted quad */
                hints.ai_family = AF_INET;
                hints.ai_flags |= AI_NUMERICHOST;
-       }
-       else {
+       } else {
                rc = inet_pton(AF_INET6, host, &serveraddr);
-               if (rc == 1) {                                  /* IPv6 address */
+               if (rc == 1) {  /* IPv6 address */
                        hints.ai_family = AF_INET6;
                        hints.ai_flags |= AI_NUMERICHOST;
                }
@@ -2694,7 +2915,7 @@ static int tcp_connectsock(char *host, char *service)
 
        rc = getaddrinfo(host, service, &hints, &res);
        if (rc != 0) {
-               return(-1);
+               return (-1);
        }
 
        /*
@@ -2702,18 +2923,18 @@ static int tcp_connectsock(char *host, char *service)
         */
        for (ai = res; ai != NULL; ai = ai->ai_next) {
                sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
-               if (sock < 0) return(-1);
+               if (sock < 0)
+                       return (-1);
 
                rc = connect(sock, ai->ai_addr, ai->ai_addrlen);
                if (rc >= 0) {
-                       return(sock);           /* Connected! */
-               }
-               else {
-                       close(sock);            /* Failed.  Close the socket to avoid fd leak! */
+                       return (sock);  /* Connected! */
+               } else {
+                       close(sock);    /* Failed.  Close the socket to avoid fd leak! */
                }
        }
 
-       return(-1);
+       return (-1);
 }
 
 
@@ -2750,7 +2971,7 @@ static int uds_connectsock(int *isLocal, char *sockpath)
 /*
  * input binary data from socket
  */
-static void serv_read(CtdlIPC *ipc, char *buf, unsigned int bytes)
+static void serv_read(CtdlIPC * ipc, char *buf, unsigned int bytes)
 {
        unsigned int len, rlen;
 
@@ -2775,7 +2996,7 @@ static void serv_read(CtdlIPC *ipc, char *buf, unsigned int bytes)
 /*
  * send binary to server
  */
-void serv_write(CtdlIPC *ipc, const char *buf, unsigned int nbytes)
+void serv_write(CtdlIPC * ipc, const char *buf, unsigned int nbytes)
 {
        unsigned int bytes_written = 0;
        int retval;
@@ -2787,8 +3008,7 @@ void serv_write(CtdlIPC *ipc, const char *buf, unsigned int nbytes)
        }
 #endif
        while (bytes_written < nbytes) {
-               retval = write(ipc->sock, &buf[bytes_written],
-                              nbytes - bytes_written);
+               retval = write(ipc->sock, &buf[bytes_written], nbytes - bytes_written);
                if (retval < 1) {
                        connection_died(ipc, 0);
                        return;
@@ -2802,7 +3022,7 @@ void serv_write(CtdlIPC *ipc, const char *buf, unsigned int nbytes)
 /*
  * input binary data from encrypted connection
  */
-static void serv_read_ssl(CtdlIPC* ipc, char *buf, unsigned int bytes)
+static void serv_read_ssl(CtdlIPC * ipc, char *buf, unsigned int bytes)
 {
        int len, rlen;
        char junk[1];
@@ -2820,8 +3040,7 @@ static void serv_read_ssl(CtdlIPC* ipc, char *buf, unsigned int bytes)
                        long errval;
 
                        errval = SSL_get_error(ipc->ssl, rlen);
-                       if (errval == SSL_ERROR_WANT_READ ||
-                                       errval == SSL_ERROR_WANT_WRITE) {
+                       if (errval == SSL_ERROR_WANT_READ || errval == SSL_ERROR_WANT_WRITE) {
                                sleep(1);
                                continue;
                        }
@@ -2836,8 +3055,7 @@ static void serv_read_ssl(CtdlIPC* ipc, char *buf, unsigned int bytes)
                                return;
                        }
  ***/
-                       error_printf("SSL_read in serv_read: %s\n",
-                                       ERR_reason_error_string(ERR_peek_error()));
+                       error_printf("SSL_read in serv_read: %s\n", ERR_reason_error_string(ERR_peek_error()));
                        connection_died(ipc, 1);
                        return;
                }
@@ -2849,7 +3067,7 @@ static void serv_read_ssl(CtdlIPC* ipc, char *buf, unsigned int bytes)
 /*
  * send binary to server encrypted
  */
-static void serv_write_ssl(CtdlIPC *ipc, const char *buf, unsigned int nbytes)
+static void serv_write_ssl(CtdlIPC * ipc, const char *buf, unsigned int nbytes)
 {
        unsigned int bytes_written = 0;
        int retval;
@@ -2862,25 +3080,20 @@ static void serv_write_ssl(CtdlIPC *ipc, const char *buf, unsigned int nbytes)
                                ERR_print_errors_fp(stderr);
                        }
                }
-               retval = SSL_write(ipc->ssl, &buf[bytes_written],
-                               nbytes - bytes_written);
+               retval = SSL_write(ipc->ssl, &buf[bytes_written], nbytes - bytes_written);
                if (retval < 1) {
                        long errval;
 
                        errval = SSL_get_error(ipc->ssl, retval);
-                       if (errval == SSL_ERROR_WANT_READ ||
-                                       errval == SSL_ERROR_WANT_WRITE) {
+                       if (errval == SSL_ERROR_WANT_READ || errval == SSL_ERROR_WANT_WRITE) {
                                sleep(1);
                                continue;
                        }
-                       if (errval == SSL_ERROR_ZERO_RETURN ||
-                                       errval == SSL_ERROR_SSL) {
-                               serv_write(ipc, &buf[bytes_written],
-                                               nbytes - bytes_written);
+                       if (errval == SSL_ERROR_ZERO_RETURN || errval == SSL_ERROR_SSL) {
+                               serv_write(ipc, &buf[bytes_written], nbytes - bytes_written);
                                return;
                        }
-                       error_printf("SSL_write in serv_write: %s\n",
-                                       ERR_reason_error_string(ERR_peek_error()));
+                       error_printf("SSL_write in serv_write: %s\n", ERR_reason_error_string(ERR_peek_error()));
                        connection_died(ipc, 1);
                        return;
                }
@@ -2896,7 +3109,7 @@ static void CtdlIPC_init_OpenSSL(void)
        int a;
        const SSL_METHOD *ssl_method;
        DH *dh;
-       
+
        /* already done init */
        if (ssl_ctx) {
                return;
@@ -2940,11 +3153,10 @@ static void CtdlIPC_init_OpenSSL(void)
        DH_free(dh);
 }
 
-#endif /* HAVE_OPENSSL */
+#endif                         /* HAVE_OPENSSL */
 
 
-int
-ReadNetworkChunk(CtdlIPC* ipc)
+int ReadNetworkChunk(CtdlIPC * ipc)
 {
        fd_set read_fd;
        int ret = 0;
@@ -2956,44 +3168,41 @@ ReadNetworkChunk(CtdlIPC* ipc)
        tv.tv_usec = 1000;
        /*tries = 0; */
        n = 0;
-       while (1)
-       {
-               errno=0;
+       while (1) {
+               errno = 0;
                FD_ZERO(&read_fd);
                FD_SET(ipc->sock, &read_fd);
-               ret = select(ipc->sock+1, &read_fd, NULL, NULL,  &tv);
-               
+               ret = select(ipc->sock + 1, &read_fd, NULL, NULL, &tv);
+
                if (ret > 0) {
-                       
+
                        *(ipc->BufPtr) = '\0';
-                       n = recv(ipc->sock, ipc->BufPtr, ipc->BufSize  - (ipc->BufPtr - ipc->Buf) - 1, 0);
+                       n = recv(ipc->sock, ipc->BufPtr, ipc->BufSize - (ipc->BufPtr - ipc->Buf) - 1, 0);
                        if (n > 0) {
-                               ipc->BufPtr[n]='\0';
+                               ipc->BufPtr[n] = '\0';
                                ipc->BufUsed += n;
                                return n;
-                       }
-                       else 
+                       } else
                                return n;
-               }
-               else if (ret < 0) {
+               } else if (ret < 0) {
                        if (!(errno == EINTR || errno == EAGAIN))
-                               error_printf( "\nselect failed: %d %s\n", err, strerror(err));
+                               error_printf("\nselect failed: %d %s\n", err, strerror(err));
                        return -1;
-               }/*
-               else {
-                       tries ++;
-                       if (tries >= 10)
-                       n = read(ipc->sock, ipc->BufPtr, ipc->BufSize  - (ipc->BufPtr - ipc->Buf) - 1);
-                       if (n > 0) {
-                               ipc->BufPtr[n]='\0';
-                               ipc->BufUsed += n;
-                               return n;
-                       }
-                       else {
-                               connection_died(ipc, 0);
-                               return -1;
-                       }
-                       }*/
+               }               /*
+                                  else {
+                                  tries ++;
+                                  if (tries >= 10)
+                                  n = read(ipc->sock, ipc->BufPtr, ipc->BufSize  - (ipc->BufPtr - ipc->Buf) - 1);
+                                  if (n > 0) {
+                                  ipc->BufPtr[n]='\0';
+                                  ipc->BufUsed += n;
+                                  return n;
+                                  }
+                                  else {
+                                  connection_died(ipc, 0);
+                                  return -1;
+                                  }
+                                  } */
        }
 }
 
@@ -3002,141 +3211,132 @@ ReadNetworkChunk(CtdlIPC* ipc)
  */
 #ifdef CHUNKED_READ
 
-static void CtdlIPC_getline(CtdlIPC* ipc, char *buf)
+static void CtdlIPC_getline(CtdlIPC * ipc, char *buf)
 {
        int i, ntries;
        char *aptr, *bptr, *aeptr, *beptr;
 
-//     error_printf("---\n");
+//      error_printf("---\n");
 
        beptr = buf + SIZ;
 #if defined(HAVE_OPENSSL)
-       if (ipc->ssl) {
-               
+       if (ipc->ssl) {
+
                /* Read one character at a time. */
-               for (i = 0;; i++) {
-                       serv_read(ipc, &buf[i], 1);
-                       if (buf[i] == '\n' || i == (SIZ-1))
-                               break;
-               }
-               
+               for (i = 0;; i++) {
+                       serv_read(ipc, &buf[i], 1);
+                       if (buf[i] == '\n' || i == (SIZ - 1))
+                               break;
+               }
+
                /* If we got a long line, discard characters until the newline. */
-               if (i == (SIZ-1))
-                       while (buf[i] != '\n')
-                               serv_read(ipc, &buf[i], 1);
-               
+               if (i == (SIZ - 1))
+                       while (buf[i] != '\n')
+                               serv_read(ipc, &buf[i], 1);
+
                /* Strip the trailing newline (and carriage return, if present) */
-               if (i>=0 && buf[i] == 10) buf[i--] = 0;
-               if (i>=0 && buf[i] == 13) buf[i--] = 0;
-       }
-       else
+               if (i >= 0 && buf[i] == 10)
+                       buf[i--] = 0;
+               if (i >= 0 && buf[i] == 13)
+                       buf[i--] = 0;
+       } else
 #endif
        {
-               if (ipc->Buf == NULL)
-               {
+               if (ipc->Buf == NULL) {
                        ipc->BufSize = SIZ;
-                       ipc->Buf = (char*) malloc(ipc->BufSize + 10);
+                       ipc->Buf = (char *) malloc(ipc->BufSize + 10);
                        *(ipc->Buf) = '\0';
                        ipc->BufPtr = ipc->Buf;
                }
 
                ntries = 0;
-//             while ((ipc->BufUsed == 0)||(ntries++ > 10))
+//              while ((ipc->BufUsed == 0)||(ntries++ > 10))
                if (ipc->BufUsed == 0)
                        ReadNetworkChunk(ipc);
 
-////           if (ipc->BufUsed != 0) while (1)
+////            if (ipc->BufUsed != 0) while (1)
                bptr = buf;
 
-               while (1)
-               {
+               while (1) {
                        aptr = ipc->BufPtr;
                        aeptr = ipc->Buf + ipc->BufSize;
-                       while ((aptr < aeptr) && 
-                              (bptr < beptr) &&
-                              (*aptr != '\0') && 
-                              (*aptr != '\n'))
+                       while ((aptr < aeptr) && (bptr < beptr) && (*aptr != '\0') && (*aptr != '\n'))
                                *(bptr++) = *(aptr++);
-                       if ((*aptr == '\n') && (aptr < aeptr))
-                       {
+                       if ((*aptr == '\n') && (aptr < aeptr)) {
                                /* Terminate it right, remove the line breaks */
                                while ((aptr < aeptr) && ((*aptr == '\n') || (*aptr == '\r')))
-                                       aptr ++;
-                               while ((aptr < aeptr ) && (*(aptr + 1) == '\0') )
-                                       aptr ++;
+                                       aptr++;
+                               while ((aptr < aeptr) && (*(aptr + 1) == '\0'))
+                                       aptr++;
                                *(bptr++) = '\0';
-//                             fprintf(stderr, "parsing %d %d %d - %d %d %d %s\n", ipc->BufPtr - ipc->Buf, aptr - ipc->BufPtr, ipc->BufUsed , *aptr, *(aptr-1), *(aptr+1), buf);
-                               if ((bptr > buf + 1) && (*(bptr-1) == '\r'))
+//                              fprintf(stderr, "parsing %d %d %d - %d %d %d %s\n", ipc->BufPtr - ipc->Buf, aptr - ipc->BufPtr, ipc->BufUsed , *aptr, *(aptr-1), *(aptr+1), buf);
+                               if ((bptr > buf + 1) && (*(bptr - 1) == '\r'))
                                        *(--bptr) = '\0';
-                               
+
                                /* is there more in the buffer we need to read later? */
-                               if (ipc->Buf + ipc->BufUsed > aptr)
-                               {
+                               if (ipc->Buf + ipc->BufUsed > aptr) {
                                        ipc->BufPtr = aptr;
-                               }
-                               else
-                               {
+                               } else {
                                        ipc->BufUsed = 0;
                                        ipc->BufPtr = ipc->Buf;
                                }
-//                             error_printf("----bla6\n");
+//                              error_printf("----bla6\n");
                                return;
-                               
-                       }/* should we move our read stuf to the bufferstart so we have more space at the end? */
-                       else if ((ipc->BufPtr != ipc->Buf) && 
-                                (ipc->BufUsed > (ipc->BufSize  - (ipc->BufSize / 4))))
-                       {
+
+                       } /* should we move our read stuf to the bufferstart so we have more space at the end? */
+                       else if ((ipc->BufPtr != ipc->Buf) && (ipc->BufUsed > (ipc->BufSize - (ipc->BufSize / 4)))) {
                                size_t NewBufSize = ipc->BufSize * 2;
                                int delta = (ipc->BufPtr - ipc->Buf);
                                char *NewBuf;
 
                                /* if the line would end after our buffer, we should use a bigger buffer. */
-                               NewBuf = (char *)malloc (NewBufSize + 10);
-                               memcpy (NewBuf, ipc->BufPtr, ipc->BufUsed - delta);
+                               NewBuf = (char *) malloc(NewBufSize + 10);
+                               memcpy(NewBuf, ipc->BufPtr, ipc->BufUsed - delta);
                                free(ipc->Buf);
                                ipc->Buf = ipc->BufPtr = NewBuf;
                                ipc->BufUsed -= delta;
                                ipc->BufSize = NewBufSize;
                        }
-                       if (ReadNetworkChunk(ipc) <0)
-                       {
-//                             error_printf("----bla\n");
+                       if (ReadNetworkChunk(ipc) < 0) {
+//                              error_printf("----bla\n");
                                return;
                        }
                }
-///            error_printf("----bl45761%s\nipc->BufUsed");
+///             error_printf("----bl45761%s\nipc->BufUsed");
        }
-//     error_printf("----bla1\n");
+//      error_printf("----bla1\n");
 }
 
-#else  /* CHUNKED_READ */
+#else                          /* CHUNKED_READ */
 
-static void CtdlIPC_getline(CtdlIPC* ipc, char *buf)
+static void CtdlIPC_getline(CtdlIPC * ipc, char *buf)
 {
        int i;
 
        /* Read one character at a time. */
        for (i = 0;; i++) {
                serv_read(ipc, &buf[i], 1);
-               if (buf[i] == '\n' || i == (SIZ-1))
+               if (buf[i] == '\n' || i == (SIZ - 1))
                        break;
        }
 
        /* If we got a long line, discard characters until the newline. */
-       if (i == (SIZ-1))
+       if (i == (SIZ - 1))
                while (buf[i] != '\n')
                        serv_read(ipc, &buf[i], 1);
 
        /* Strip the trailing newline (and carriage return, if present) */
-       if (i>=0 && buf[i] == 10) buf[i--] = 0;
-       if (i>=0 && buf[i] == 13) buf[i--] = 0;
+       if (i >= 0 && buf[i] == 10)
+               buf[i--] = 0;
+       if (i >= 0 && buf[i] == 13)
+               buf[i--] = 0;
 }
 
 
-#endif /* CHUNKED_READ */
+#endif                         /* CHUNKED_READ */
 
 
-void CtdlIPC_chat_recv(CtdlIPC* ipc, char* buf)
+void CtdlIPC_chat_recv(CtdlIPC * ipc, char *buf)
 {
        CtdlIPC_getline(ipc, buf);
 }
@@ -3144,7 +3344,7 @@ void CtdlIPC_chat_recv(CtdlIPC* ipc, char* buf)
 /*
  * send line to server - implemented in terms of serv_write()
  */
-static void CtdlIPC_putline(CtdlIPC *ipc, const char *buf)
+static void CtdlIPC_putline(CtdlIPC * ipc, const char *buf)
 {
        char *cmd = NULL;
        int len;
@@ -3166,7 +3366,7 @@ static void CtdlIPC_putline(CtdlIPC *ipc, const char *buf)
        ipc->last_command_sent = time(NULL);
 }
 
-void CtdlIPC_chat_send(CtdlIPC* ipc, const char* buf)
+void CtdlIPC_chat_send(CtdlIPC * ipc, const char *buf)
 {
        CtdlIPC_putline(ipc, buf);
 }
@@ -3175,13 +3375,13 @@ void CtdlIPC_chat_send(CtdlIPC* ipc, const char* buf)
 /*
  * attach to server
  */
-CtdlIPCCtdlIPC_new(int argc, char **argv, char *hostbuf, char *portbuf)
+CtdlIPC *CtdlIPC_new(int argc, char **argv, char *hostbuf, char *portbuf)
 {
        int a;
        char cithost[SIZ];
        char citport[SIZ];
        char sockpath[SIZ];
-       CtdlIPCipc;
+       CtdlIPC *ipc;
 
        ipc = malloc(sizeof(struct _CtdlIPC));
        if (!ipc) {
@@ -3191,8 +3391,8 @@ CtdlIPC* CtdlIPC_new(int argc, char **argv, char *hostbuf, char *portbuf)
        ipc->ssl = NULL;
        CtdlIPC_init_OpenSSL();
 #endif
-       ipc->sock = -1;                 /* Not connected */
-       ipc->isLocal = 0;               /* Not local, of course! */
+       ipc->sock = -1;         /* Not connected */
+       ipc->isLocal = 0;       /* Not local, of course! */
        ipc->downloading = 0;
        ipc->uploading = 0;
        ipc->last_command_sent = 0L;
@@ -3221,12 +3421,12 @@ CtdlIPC* CtdlIPC_new(int argc, char **argv, char *hostbuf, char *portbuf)
                } else if (a == 2) {
                        strcpy(citport, argv[a]);
                } else {
-                       error_printf("%s: usage: ",argv[0]);
-                       error_printf("%s [host] [port] ",argv[0]);
+                       error_printf("%s: usage: ", argv[0]);
+                       error_printf("%s [host] [port] ", argv[0]);
                        free(ipc);
                        errno = EINVAL;
                        return 0;
-               }
+               }
        }
 
        if ((!strcmp(cithost, "localhost")) || (!strcmp(cithost, "127.0.0.1"))) {
@@ -3237,8 +3437,7 @@ CtdlIPC* CtdlIPC_new(int argc, char **argv, char *hostbuf, char *portbuf)
        if (!strcmp(cithost, UDS)) {
                if (!strcasecmp(citport, DEFAULT_PORT)) {
                        snprintf(sockpath, sizeof sockpath, "%s", file_citadel_socket);
-               }
-               else {
+               } else {
                        snprintf(sockpath, sizeof sockpath, "%s/%s", citport, "citadel.socket");
                }
                printf("[%s]\n", sockpath);
@@ -3247,8 +3446,10 @@ CtdlIPC* CtdlIPC_new(int argc, char **argv, char *hostbuf, char *portbuf)
                        free(ipc);
                        return 0;
                }
-               if (hostbuf != NULL) strcpy(hostbuf, cithost);
-               if (portbuf != NULL) strcpy(portbuf, sockpath);
+               if (hostbuf != NULL)
+                       strcpy(hostbuf, cithost);
+               if (portbuf != NULL)
+                       strcpy(portbuf, sockpath);
                strcpy(ipc->ip_hostname, "");
                strcpy(ipc->ip_address, "");
                return ipc;
@@ -3270,18 +3471,16 @@ CtdlIPC* CtdlIPC_new(int argc, char **argv, char *hostbuf, char *portbuf)
        ipc->ip_hostname[0] = 0;
        ipc->ip_address[0] = 0;
 
-       getpeername(ipc->sock, (struct sockaddr *)&clientaddr, &addrlen);
-       getnameinfo((struct sockaddr *)&clientaddr, addrlen,
-               ipc->ip_hostname, sizeof ipc->ip_hostname, NULL, 0, 0
-       );
-       getnameinfo((struct sockaddr *)&clientaddr, addrlen,
-               ipc->ip_address, sizeof ipc->ip_address, NULL, 0, NI_NUMERICHOST
-       );
+       getpeername(ipc->sock, (struct sockaddr *) &clientaddr, &addrlen);
+       getnameinfo((struct sockaddr *) &clientaddr, addrlen, ipc->ip_hostname, sizeof ipc->ip_hostname, NULL, 0, 0);
+       getnameinfo((struct sockaddr *) &clientaddr, addrlen, ipc->ip_address, sizeof ipc->ip_address, NULL, 0, NI_NUMERICHOST);
 
        /* stuff other things elsewhere */
 
-       if (hostbuf != NULL) strcpy(hostbuf, cithost);
-       if (portbuf != NULL) strcpy(portbuf, citport);
+       if (hostbuf != NULL)
+               strcpy(hostbuf, cithost);
+       if (portbuf != NULL)
+               strcpy(portbuf, citport);
        return ipc;
 }
 
@@ -3289,7 +3488,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) {
@@ -3303,7 +3502,7 @@ void CtdlIPC_delete(CtdlIPC* ipc)
                ipc->sock = -1;
        }
        if (ipc->Buf != NULL)
-               free (ipc->Buf);
+               free(ipc->Buf);
        ipc->Buf = NULL;
        ipc->BufPtr = NULL;
        free(ipc);
@@ -3314,7 +3513,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;
@@ -3327,7 +3526,7 @@ void CtdlIPC_delete_ptr(CtdlIPC** pipc)
  * FIXME: This is only used in chat mode; eliminate it when chat mode gets
  * rewritten...
  */
-int CtdlIPC_getsockfd(CtdlIPC* ipc)
+int CtdlIPC_getsockfd(CtdlIPC * ipc)
 {
        return ipc->sock;
 }
@@ -3339,7 +3538,7 @@ int CtdlIPC_getsockfd(CtdlIPC* ipc)
  * FIXME: This is only used in chat mode; eliminate it when chat mode gets
  * rewritten...
  */
-char CtdlIPC_get(CtdlIPC* ipc)
+char CtdlIPC_get(CtdlIPC * ipc)
 {
        char buf[2];
        char ch;
index e725f02..b8f621b 100644 (file)
@@ -19,7 +19,7 @@
 extern char temp[];
 char last_paged[SIZ] = "";
 
-void chatmode(CtdlIPC *ipc)
+void chatmode(CtdlIPC * ipc)
 {
        char wbuf[SIZ];
        char buf[SIZ];
@@ -46,7 +46,7 @@ void chatmode(CtdlIPC *ipc)
 
        strcpy(buf, "");
        strcpy(wbuf, "");
-       strcpy(last_user, ""); 
+       strcpy(last_user, "");
        color(BRIGHT_YELLOW);
        scr_printf("\n");
        scr_printf("> ");
@@ -138,7 +138,7 @@ void chatmode(CtdlIPC *ipc)
                snprintf(buf, sizeof buf, "RCHT poll|%d", seq);
                CtdlIPC_chat_send(ipc, buf);
                CtdlIPC_chat_recv(ipc, response);
-       
+
                if (response[0] == '1') {
                        seq = extract_int(&response[4], 0);
                        extract_token(c_user, &response[4], 2, '|', sizeof c_user);
@@ -180,7 +180,7 @@ void chatmode(CtdlIPC *ipc)
 /*
  * send an instant message
  */
-void page_user(CtdlIPC *ipc)
+void page_user(CtdlIPC * ipc)
 {
        char buf[SIZ], touser[SIZ], msg[SIZ];
        FILE *pagefp;
@@ -234,7 +234,7 @@ void page_user(CtdlIPC *ipc)
 }
 
 
-void quiet_mode(CtdlIPC *ipc)
+void quiet_mode(CtdlIPC * ipc)
 {
        static int quiet = 0;
        char cret[SIZ];
@@ -243,16 +243,14 @@ void quiet_mode(CtdlIPC *ipc)
        r = CtdlIPCEnableInstantMessageReceipt(ipc, !quiet, cret);
        if (r / 100 == 2) {
                quiet = !quiet;
-               scr_printf("Quiet mode %sabled (%sother users may page you)\n",
-                               (quiet) ? "en" : "dis",
-                               (quiet) ? "no " : "");
+               scr_printf("Quiet mode %sabled (%sother users may page you)\n", (quiet) ? "en" : "dis", (quiet) ? "no " : "");
        } 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];
@@ -262,8 +260,7 @@ void stealth_mode(CtdlIPC *ipc)
        if (r / 100 == 2) {
                stealth = !stealth;
                scr_printf("Stealth mode %sabled (you are %s)\n",
-                               (stealth) ? "en" : "dis",
-                               (stealth) ? "invisible" : "listed as online");
+                          (stealth) ? "en" : "dis", (stealth) ? "invisible" : "listed as online");
        } else {
                scr_printf("Unable to change stealth mode: %s\n", cret);
        }
index 2337736..522ec88 100644 (file)
 
 #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());
-       if (p == NULL) strcpy(pwfile, "");
+       if (p == NULL)
+               strcpy(pwfile, "");
        snprintf(pwfile, n, PWFILENAME, p->pw_dir);
 }
 
@@ -30,11 +32,8 @@ 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;
@@ -46,10 +45,12 @@ void get_stored_password(
        strcpy(password, "");
 
        determine_pwfilename(pwfile, sizeof pwfile);
-       if (IsEmptyStr(pwfile)) return;
+       if (IsEmptyStr(pwfile))
+               return;
 
        fp = fopen(pwfile, "r");
-       if (fp == NULL) return;
+       if (fp == NULL)
+               return;
        while (fgets(buf64, sizeof buf64, fp) != NULL) {
                CtdlDecodeBase64(buf, buf64, sizeof(buf64));
                extract_token(hostbuf, buf, 0, '|', sizeof hostbuf);
@@ -71,11 +72,8 @@ void get_stored_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;
@@ -84,13 +82,16 @@ void set_stored_password(
        char hostbuf[256], portbuf[256], ubuf[256], pbuf[256];
 
        determine_pwfilename(pwfile, sizeof pwfile);
-       if (IsEmptyStr(pwfile)) return;
+       if (IsEmptyStr(pwfile))
+               return;
 
        oldfp = fopen(pwfile, "r");
-       if (oldfp == NULL) oldfp = fopen("/dev/null", "r");
+       if (oldfp == NULL)
+               oldfp = fopen("/dev/null", "r");
        unlink(pwfile);
        fp = fopen(pwfile, "w");
-       if (fp == NULL) fp = fopen("/dev/null", "w");
+       if (fp == NULL)
+               fp = fopen("/dev/null", "w");
        while (fgets(buf64, sizeof buf64, oldfp) != NULL) {
                CtdlDecodeBase64(buf, buf64, sizeof(buf64));
                extract_token(hostbuf, buf, 0, '|', sizeof hostbuf);
@@ -98,17 +99,15 @@ void set_stored_password(
                extract_token(ubuf, buf, 2, '|', sizeof ubuf);
                extract_token(pbuf, buf, 3, '|', sizeof pbuf);
 
-               if ( (strcasecmp(hostbuf, host)) 
-                  || (strcasecmp(portbuf, port)) ) {
-                       snprintf(buf, sizeof buf, "%s|%s|%s|%s|",
-                               hostbuf, portbuf, ubuf, pbuf);
+               if ((strcasecmp(hostbuf, host))
+                   || (strcasecmp(portbuf, port))) {
+                       snprintf(buf, sizeof buf, "%s|%s|%s|%s|", hostbuf, portbuf, ubuf, pbuf);
                        CtdlEncodeBase64(buf64, buf, strlen(buf), 0);
                        fprintf(fp, "%s\n", buf64);
                }
        }
        if (!IsEmptyStr(username)) {
-               snprintf(buf, sizeof buf, "%s|%s|%s|%s|",
-                       host, port, username, password);
+               snprintf(buf, sizeof buf, "%s|%s|%s|%s|", host, port, username, password);
                CtdlEncodeBase64(buf64, buf, strlen(buf), 0);
                fprintf(fp, "%s\n", buf64);
        }
@@ -121,17 +120,13 @@ void set_stored_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, "", "");
                }
        }
index 9a68488..bdd2dc4 100644 (file)
@@ -27,403 +27,380 @@ char *helpnames[] = {
 
 char *helptexts[] = {
 
-"                          Citadel Help Menu\n"
-"  \n"
-" ?         Help. (Typing a '?' will give you a menu almost anywhere)\n"
-" A         Abandon this room where you stopped reading, goto next room.\n"
-" C         Chat (multiuser chat, where available)\n"
-" D         Prints directory, if there is one in the current room.\n"
-" E         Enter a message.\n"
-" F         Read all messages in the room, forward.\n"
-" G         Goto next room which has UNREAD messages.\n"
-" H         Help. Same as '?'\n"
-" I         Reads the Information file for this room.\n"
-" K         List of Known rooms.\n"
-" L         Reads the last five messages in the room.\n"
-" N         Reads all new messages in the room.\n"
-" O         Reads all old messages, backwards.\n"
-" P         Page another user (send an instant message)\n"
-" R         Reads all messages in the room, in reverse order.\n"
-" S         Skips current room without making its messages old.\n"
-" T         Terminate (logout)\n"
-" U         Ungoto (returns to the last room you were in)\n"
-" W         Displays who is currently logged in.\n"
-" X         Toggle eXpert mode (menus and help blurbs on/off)\n"
-" Z         Zap (forget) room. (Removes the room from your list)\n"
-" + -       Goto next, previous room on current floor.\n"
-" > <       Goto next, previous floor.\n"
-" *         Enter any locally installed 'doors'.\n"
-"   \n"
-" 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  .<H>elp ?    for additional help *** \n"
-
-,
-
-"The following commands are available only to Admins.  A subset of these\n"
-"commands are available to room aides when they are currently in the room\n"
-"they are room aide for.\n"
-"\n"
-" <.> <A>dmin <K>ill this room   (Delete the current room)\n"
-" <.> <A>dmin <E>dit this room   (Edit the current room's parameters)\n"
-" <.> <A>dmin <W>ho knows room   (List users with access to this room)\n"
-" <.> <A>dmin edit <U>ser        (Change user's access level, password, etc.)\n"
-" <.> <A>dmin <V>alidate new users   (Process new user registrations)\n"
-" <.> <A>dmin enter <I>nfo file      (Create/change this room's banner)\n"
-" <.> <A>dmin <R>oom <I>nvite user   (Grant access to an invitation-only room)\n"
-" <.> <A>dmin <R>oom <K>ick out user (Revoke access to an invitation-only room)\n"
-" <.> <A>dmin <F>ile <D>elete        (Delete a file from the room's directory)\n"
-" <.> <A>dmin <F>ile <S>end over net (Transmit a file to another node)\n"
-" <.> <A>dmin <F>ile <M>ove          (Move a file to another room's directory)\n"
-" <.> <A>dmin <M>essage edit:        (Edit system banners)\n"
-" <.> <A>dmin <P>ost                 (Post a message on behalf of another user)\n"
-" <.> <A>dmin <S>ystem configuration <G>eneral   (Edit global site config)\n"
-" <.> <A>dmin <S>ystem configuration <I>nternet  (Edit Internet domains)\n"
-" <.> <A>dmin <S>ystem configuration check <M>essage base   (Internal checks)\n"
-" <.> <A>dmin <S>ystem configuration <N>etwork   (Netting with other Citadels)\n"
-" <.> <A>dmin <S>ystem configuration network <F>ilter list\n"
-" <.> <A>dmin <T>erminate server <N>ow          (Shut down Citadel server now)\n"
-" <.> <A>dmin <T>erminate server <S>cheduled    (Shut down Citadel server later)\n"
-" <.> <A>dmin mailing <L>ist recipients         (For mailing list rooms)\n"
-" <.> <A>dmin mailing list <D>igest recipients  (For mailing list rooms)\n"
-" <.> <A>dmin <N>etwork room sharing     (Replication with other Citadels)\n"
-" \n"
-" In addition, the <M>ove and <D>elete commands are available at the\n"
-"message prompt.\n"
-
-,
-
-" Floors\n"
-" ------\n"
-"   Floors in Citadel are used to group rooms into related subject areas,\n"
-"just as rooms are used to group messages into manageable groups.\n"
-" \n"
-"   You, as a user, do NOT have to use floors.  If you choose not to, you suffer\n"
-"no penalty; you will not lose access to any rooms.  You may use .EC or ;C (the\n"
-"latter is easier to use) to decide if you want to use floors.  Feel free to\n"
-"experiment.\n"
-" \n"
-"   Floor options are accessed two ways.  First, if you are in floor mode, the\n"
-"<G>oto and <S>kip commands take you to the next room with new messages on the\n"
-"current floor; if there are none left, then the system will automatically\n"
-"switch floors (and let you know) and put you in the first room with new messages\n"
-"on that level.  (Notice that your pattern of basic use of Citadel therefore\n"
-"doesn't really change.)\n"
-" \n"
-"   Direct access to floor options is via the use of a ';' command.\n"
-"The following commands are currently available (more can be\n"
-"added if needed):\n"
-" \n"
-" <;C>onfigure\n"
-" This command toggles your floor mode.\n"
-" \n"
-" <;G>oto FLOORNAME\n"
-" This command causes the system to take you to the named floor.\n"
-" \n"
-" <;K>nown rooms on floors\n"
-" List all rooms on all floors.  This is a very readable way to get a list of\n"
-"all rooms on the system.\n"
-" \n"
-" <;S>kip FLOORNAME\n"
-" This command causes the system to mark all rooms on the current floor as\n"
-"Skipped and takes you to the floor that you specify.\n"
-" \n"
-" <;Z>Forget floor\n"
-"   This command causes you to forget all the rooms currently on the current\n"
-"floor.  Unfortunately, it doesn't apply to rooms that are subsequently created\n"
-"or moved to this floor.  (Sorry.)\n"
-" \n"
-"   Feel free to experiment, you can't hurt yourself or the system with the\n"
-"floor stuff unless you ZForget a floor by accident.\n"
-
-,
-
-"                  New User's Introduction to the site\n"
-"  \n"
-" This is an introduction to the Citadel BBS concept.  It is intended\n"
-"for new users so that they can more easily become acquainted to using\n"
-"Citadel when accessing it in the form of a text-based BBS.  Of\n"
-"course, old users might learn something new each time they read\n"
-"through it.\n"
-" \n"
-" Full help for the BBS commands can be obtained by typing <.H>elp SUMMARY\n"
-"  \n"
-" The CITADEL BBS room concept\n"
-" ----------------------------\n"
-"   The term BBS stands for 'Bulletin Board System'.  The analogy is\n"
-"appropriate: one posts messages so that others may read them.  In\n"
-"order to organize the posts, people can post in different areas of the\n"
-"BBS, called rooms.\n"
-"   In order to post in a certain room, you need to be 'in' that room.\n"
-"Your current prompt is usually the room that you are in, followed the\n"
-"greater-than-sign, such as:\n"
-" \n"
-" Lobby>\n"
-" \n"
-" The easiest way to traverse the room structure is with the 'Goto'\n"
-"command, on the 'G' key.  Pressing 'G' will take you to the next room\n"
-"in the 'march list' (see below) that has new messages in it.  You can\n"
-"read these new messages with the 'N' key.\n"
-" Once you've 'Gotoed' every room in the system (or all of the ones\n"
-"you choose to read) you return to the 'Lobby,' the first and last room\n"
-"in the system.  If new messages get posted to rooms you've already\n"
-"read during your session you will be brought BACK to those rooms so\n"
-"you can read them.\n"
-" \n"
-" March List\n"
-" ----------\n"
-"   All the room names are stored in a march list, which is just a\n"
-"list containing all the room names.  When you <G>oto or <S>kip a\n"
-"room, you are placed in the next room in your march list THAT HAS NEW\n"
-"MESSAGES.  If you have no new messages in any of the rooms on your\n"
-"march list, you will keep going to the Lobby>.  You can choose not to\n"
-"read certain rooms (that don't interest you) by 'Z'apping them.  When\n"
-"you <Z>ap a room, you are merely deleting it from your march list (but\n"
-"not from anybody else's).\n"
-" \n"
-"   You can use the <.G>oto (note the period before the G.  You can also use\n"
-"<J>ump on some systems) to go to any room in the\n"
-"system.  You don't have to type in the complete name of a room to\n"
-"'jump' to it; you merely need to type in enough to distinguish it from\n"
-"the other rooms.  Left-aligned matches carry a heavier weight, so if you\n"
-"typed (for example) '.Goto TECH', you might be taken to a room called\n"
-"'Tech Area>' even if it found a room called 'Biotech/Ethics>' first.\n"
-" \n"
-"  To return to a room you have previously <Z>apped, use the <.G>oto command\n"
-"to enter it, and it will be re-inserted into your march list.  In the case\n"
-"of returning to Zapped rooms, you must type the room name in its entirety.\n"
-"REMEMBER, rooms with no new messages will not show on your\n"
-"march list!  You must <.G>oto to a room with no new messages.\n"
-"Incidentally, you cannot change the order of the rooms on your march list.\n"
-"It's the same for everybody.\n"
-" \n"
-" Special rooms\n"
-" -------------\n"
-"   There are two special rooms on a Citadel that you should know about.\n"
-"  \n"
-"   The first is the Lobby>.  It's used for system announcements and other\n"
-"such administrativia.  You cannot <Z>ap the Lobby>.  Each time you first\n"
-"login, you will be placed in the Lobby>.\n"
-" \n"
-"   The second is Mail>.  In Mail>, when you post a messages, you are\n"
-"prompted to enter the screen name of the person who you want to send the\n"
-"message to.  Only the person who you send the message to can read the\n"
-"message.  NO ONE else can read it, not even the admins.  Mail> is the\n"
-"first room on the march list, and is un-<Z>appable, so you can be sure\n"
-"that the person will get the message.\n"
-"   \n"
-" System admins\n"
-" -------------\n"
-"   These people, along with the room admins, keep the site running smoothly.\n"
-"\n"
-"   Among the many things that admins do are: create rooms, delete\n"
-"rooms, set access levels, invite users, check registration, grant\n"
-"room admin status, and countless other things.  They have access to the\n"
-"Aide> room, a special room only for admins.\n"
-" \n"
-"   If you enter a mail message to 'Sysop' it will be placed in the\n"
-"Aide> room so that the next admin online will read it and deal with it.\n"
-"Admins cannot <Z>ap rooms.  All the rooms are always on each admin's\n"
-"march list.  Admins can read *any* and *every* room, but they *CAN* *NOT*\n"
-"read other users' Mail!\n"
-"  \n"
-" Room admins\n"
-" -----------\n"
-"   Room admins are granted special privileges in specific rooms.\n"
-"They are *NOT* true system admins; their power extends only over the\n"
-"rooms that they control, and they answer to the system admins.\n"
-"  \n"
-"   A room admin's job is to keep the topic of the their room on track,\n"
-"with nudges in the right direction now and then.  A room admin can also\n"
-"move an off topic post to another room, or delete a post, if he/she\n"
-"feels it is necessary. \n"
-"  \n"
-"   Currently, very few rooms have room admins.  Most rooms do not need\n"
-"their own specific room admin.  Being a room admin requires a certain\n"
-"amount of trust, due to the additional privileges granted.\n"
-"  \n"
-" Citadel messages\n"
-" ----------------\n"
-"   Most of the time, the BBS code does not print a lot of messages\n"
-"to your screen.  This is a great benefit once you become familiar\n"
-"with the system, because you do not have endless menus and screens\n"
-"to navigate through.  nevertheless, there are some messages which you\n"
-"might see from time to time.\n"
-"  \n"
-"  'There were messages posted while you were entering.'\n"
-"  \n"
-"   This is also known as 'simulposting.'  When you start entering a \n"
-"message, the system knows where you last left off.  When you save\n"
-"your message, the system checks to see if any messages were entered\n"
-"while you were typing.  This is so that you know whether you need\n"
-"to go back and re-read the last few messages.  This message may appear\n"
-"in any room.\n"
-"   \n"
-" '*** You have new mail'\n"
-"  \n"
-"   This message is essentially the same as the above message, but can\n"
-"appear at any time.  It simply means that new mail has arrived for you while\n"
-"you are logged in.  Simply go to the Mail> room to read it.\n"
-"  \n"
-" Who list\n"
-" --------\n"
-"   The <W>ho command shows you the names of all users who are currently\n"
-"online.  It also shows you the name of the room they are currently in.  If\n"
-"they are in any type of private room, however, the room name will simply\n"
-"display as '<private room>'.  Along with this information is displayed the\n"
-"name of the host computer the user is logged in from.\n"
-
-,
-
-"To send mail on this system, go to the Mail> room (using the command .G Mail)\n"
-"and press E to enter a message.  You will be prompted with:\n"
-" \n"
-" Enter Recipient:\n"
-" \n"
-"   At this point you may enter the name of another user on the system.  Private\n"
-"mail is only readable by the sender and recipient.  There is no need to delete\n"
-"mail after it is read; it will scroll out automatically.\n"
-"  \n"
-"   To send mail to another user on the Citadel network, simply type the\n"
-"user's name, followed by @ and then the system name. For example,\n"
-"  \n"
-" Enter Recipient: Joe Schmoe @ citadrool\n"
-"  \n"
-"  If your account is enabled for Internet mail, you can also send email to\n"
-"anyone on the Internet here.  Simply enter their address at the prompt:\n"
-"  \n"
-" Enter Recipient: ajc@herring.fishnet.com\n"
-
-,
-
-"  Welcome to the network. Messages entered in a network room will appear in\n"
-"that room on all other systems carrying it (The name of the room, however,\n"
-"may be different on other systems).\n"
-
-,
-
-"   Citadel is the premier 'online community' (i.e. Bulletin Board System)\n"
-"software.  It runs on all POSIX-compliant systems, including Linux.  It is an\n"
-"advanced client/server application, and is being actively maintained.\n"
-" \n"
-"   For more info, visit UNCENSORED! BBS at uncensored.citadel.org\n"
-
-,
-
-"Extended commands are available using the period ( . ) key. To use\n"
-"a dot command, press the . key, and then enter the first letter of\n"
-"each word in the command. The words will appear as you enter the keys.\n"
-"You can also backspace over partially entered commands. The following\n"
-"commands are available:\n"
-"\n"
-" <.> <H>elp:    Displays help files.  Type .H followed by a help file\n"
-"                name.  You are now reading <.H>elp SUMMARY\n"
-" \n"
-" <.> <G>oto:    Jumps directly to the room you specify.  You can also\n"
-"                type a partial room name, just enough to make it unique,\n"
-"                and it'll find the room you're looking for.  As with the\n"
-"                regular <G>oto command, messages in the current room will\n"
-"                be marked as read.\n"
-" \n"
-" <.> <S>kip, goto:    This is similar to <.G>oto, except it doesn't mark\n"
-"                      messages in the current room as read.\n"
-" \n"
-" <.> list <Z>apped rooms      Shows all rooms you've <Z>apped (forgotten)\n"
-"\n"
-"  \n"
-" Terminate (logoff) commands:\n"
-" \n"
-" <.> <T>erminate and <Q>uit               Log off and disconnect.\n"
-" <.> <T>erminate and <S>tay online        Log in as a different user.\n"
-" \n"
-" \n"
-" Read commands:\n"
-"\n"
-" <.> <R>ead <N>ew messages                Same as <N>ew\n"
-" <.> <R>ead <O>ld msgs reverse            Same as <O>ld\n"
-" <.> <R>ead <L>ast five msgs              Same as <L>ast5\n"
-" <.> read <L>ast:                         Allows you to specify how many\n"
-"                                          messages you wish to read.\n"
-"\n"
-" <.> <R>ead <U>ser listing:               Lists all users on the system if\n"
-"                                          you just hit enter, otherwise\n"
-"                                          you can specify a partial match\n"
-"\n"
-" <.> <R>ead <T>extfile formatted          File 'download' commands.\n"
-" <.> <R>ead file using <X>modem   \n"
-" <.> <R>ead file using <Y>modem   \n"
-" <.> <R>ead file using <Z>modem   \n"
-" <.> <R>ead <F>ile unformatted   \n"
-" <.> <R>ead <D>irectory   \n"
-"\n"
-" <.> <R>ead <I>nfo file                   Read the room info file.\n"
-" <.> <R>ead <B>io                         Read other users' 'bio' files.\n"
-" <.> <R>ead <C>onfiguration               Display your 'preferences'.\n"
-" <.> <R>ead <S>ystem info                 Display system statistics.\n"
-"\n"
-" \n"
-" Enter commands:\n"
-"\n"
-" <.> <E>nter <M>essage                    Post a message in this room.\n"
-" <.> <E>nter message with <E>ditor        Post using a full-screen editor.\n"
-" <.> <E>nter <A>SCII message              Post 'raw' (use this when 'pasting'\n"
-"                                          a message from your clipboard).\n"
-"\n"
-" <.> <E>nter <P>assword                   Change your password.\n"
-" <.> <E>nter <C>onfiguration              Change your 'preferences'.\n"
-" <.> <E>nter a new <R>oom                 Create a new room.\n"
-" <.> <E>nter re<G>istration               Register (name, address, etc.)\n"
-" <.> <E>nter <B>io                        Enter/change your 'bio' file.\n"
-"\n"
-" <.> <E>nter <T>extfile                   File 'upload' commands.\n"
-" <.> <E>nter file using <X>modem   \n"
-" <.> <E>nter file using <Y>modem   \n"
-" <.> <E>nter file using <Z>modem   \n"
-"  \n"
-"  \n"
-"  Wholist commands:\n"
-" \n"
-" <.> <W>holist <L>ong             Same as <W>ho is online, but displays\n"
-"                                  more detailed information.\n"
-" <.> <W>holist <R>oomname         Masquerade your room name (other users\n"
-"                                  see the name you enter rather than the\n"
-"                                  actual name of the room you're in)\n"
-" <.> <W>holist <H>ostname         Masquerade your host name\n"
-" <.> <E>nter <U>sername           Masquerade your user name (Admins only)\n"
-" <.> <W>holist <S>tealth mode     Enter/exit 'stealth mode' (when in stealth\n"
-"                                  mode you are invisible on the wholist)\n"
-" \n"
-" \n"
-" Floor commands (if using floor mode)\n"
-" ;<C>onfigure floor mode            - turn floor mode on or off\n"
-" ;<G>oto floor:                     - jump to a specific floor\n"
-" ;<K>nown rooms                     - list all rooms on all floors\n"
-" ;<S>kip to floor:                  - skip current floor, jump to another\n"
-" ;<Z>ap floor                       - zap (forget) all rooms on this floor\n"
-" \n"
-" \n"
-" Administrative commands: \n"
-" \n"
-" <.> <A>dmin <K>ill this room   \n"
-" <.> <A>dmin <E>dit this room   \n"
-" <.> <A>dmin <W>ho knows room   \n"
-" <.> <A>dmin edit <U>ser   \n"
-" <.> <A>dmin <V>alidate new users   \n"
-" <.> <A>dmin enter <I>nfo file   \n"
-" <.> <A>dmin <R>oom <I>nvite user  \n"
-" <.> <A>dmin <R>oom <K>ick out user  \n"
-" <.> <A>dmin <F>ile <D>elete  \n"
-" <.> <A>dmin <F>ile <S>end over net  \n"
-" <.> <A>dmin <F>ile <M>ove  \n"
-" <.> <A>dmin <M>essage edit:   \n"
-" <.> <A>dmin <P>ost   \n"
-" <.> <A>dmin <S>ystem configuration   \n"
-" <.> <A>dmin <T>erminate server <N>ow\n"
-" <.> <A>dmin <T>erminate server <S>cheduled\n"
-
+       "                          Citadel Help Menu\n"
+           "  \n"
+           " ?         Help. (Typing a '?' will give you a menu almost anywhere)\n"
+           " A         Abandon this room where you stopped reading, goto next room.\n"
+           " C         Chat (multiuser chat, where available)\n"
+           " D         Prints directory, if there is one in the current room.\n"
+           " E         Enter a message.\n"
+           " F         Read all messages in the room, forward.\n"
+           " G         Goto next room which has UNREAD messages.\n"
+           " H         Help. Same as '?'\n"
+           " I         Reads the Information file for this room.\n"
+           " K         List of Known rooms.\n"
+           " L         Reads the last five messages in the room.\n"
+           " N         Reads all new messages in the room.\n"
+           " O         Reads all old messages, backwards.\n"
+           " P         Page another user (send an instant message)\n"
+           " R         Reads all messages in the room, in reverse order.\n"
+           " S         Skips current room without making its messages old.\n"
+           " T         Terminate (logout)\n"
+           " U         Ungoto (returns to the last room you were in)\n"
+           " W         Displays who is currently logged in.\n"
+           " X         Toggle eXpert mode (menus and help blurbs on/off)\n"
+           " Z         Zap (forget) room. (Removes the room from your list)\n"
+           " + -       Goto next, previous room on current floor.\n"
+           " > <       Goto next, previous floor.\n"
+           " *         Enter any locally installed 'doors'.\n"
+           "   \n"
+           " 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  .<H>elp ?    for additional help *** \n",
+
+       "The following commands are available only to Admins.  A subset of these\n"
+           "commands are available to room aides when they are currently in the room\n"
+           "they are room aide for.\n"
+           "\n"
+           " <.> <A>dmin <K>ill this room   (Delete the current room)\n"
+           " <.> <A>dmin <E>dit this room   (Edit the current room's parameters)\n"
+           " <.> <A>dmin <W>ho knows room   (List users with access to this room)\n"
+           " <.> <A>dmin edit <U>ser        (Change user's access level, password, etc.)\n"
+           " <.> <A>dmin <V>alidate new users   (Process new user registrations)\n"
+           " <.> <A>dmin enter <I>nfo file      (Create/change this room's banner)\n"
+           " <.> <A>dmin <R>oom <I>nvite user   (Grant access to an invitation-only room)\n"
+           " <.> <A>dmin <R>oom <K>ick out user (Revoke access to an invitation-only room)\n"
+           " <.> <A>dmin <F>ile <D>elete        (Delete a file from the room's directory)\n"
+           " <.> <A>dmin <F>ile <S>end over net (Transmit a file to another node)\n"
+           " <.> <A>dmin <F>ile <M>ove          (Move a file to another room's directory)\n"
+           " <.> <A>dmin <M>essage edit:        (Edit system banners)\n"
+           " <.> <A>dmin <P>ost                 (Post a message on behalf of another user)\n"
+           " <.> <A>dmin <S>ystem configuration <G>eneral   (Edit global site config)\n"
+           " <.> <A>dmin <S>ystem configuration <I>nternet  (Edit Internet domains)\n"
+           " <.> <A>dmin <S>ystem configuration check <M>essage base   (Internal checks)\n"
+           " <.> <A>dmin <S>ystem configuration <N>etwork   (Netting with other Citadels)\n"
+           " <.> <A>dmin <S>ystem configuration network <F>ilter list\n"
+           " <.> <A>dmin <T>erminate server <N>ow          (Shut down Citadel server now)\n"
+           " <.> <A>dmin <T>erminate server <S>cheduled    (Shut down Citadel server later)\n"
+           " <.> <A>dmin mailing <L>ist recipients         (For mailing list rooms)\n"
+           " <.> <A>dmin mailing list <D>igest recipients  (For mailing list rooms)\n"
+           " <.> <A>dmin <N>etwork room sharing     (Replication with other Citadels)\n"
+           " \n" " In addition, the <M>ove and <D>elete commands are available at the\n" "message prompt.\n",
+
+       " Floors\n"
+           " ------\n"
+           "   Floors in Citadel are used to group rooms into related subject areas,\n"
+           "just as rooms are used to group messages into manageable groups.\n"
+           " \n"
+           "   You, as a user, do NOT have to use floors.  If you choose not to, you suffer\n"
+           "no penalty; you will not lose access to any rooms.  You may use .EC or ;C (the\n"
+           "latter is easier to use) to decide if you want to use floors.  Feel free to\n"
+           "experiment.\n"
+           " \n"
+           "   Floor options are accessed two ways.  First, if you are in floor mode, the\n"
+           "<G>oto and <S>kip commands take you to the next room with new messages on the\n"
+           "current floor; if there are none left, then the system will automatically\n"
+           "switch floors (and let you know) and put you in the first room with new messages\n"
+           "on that level.  (Notice that your pattern of basic use of Citadel therefore\n"
+           "doesn't really change.)\n"
+           " \n"
+           "   Direct access to floor options is via the use of a ';' command.\n"
+           "The following commands are currently available (more can be\n"
+           "added if needed):\n"
+           " \n"
+           " <;C>onfigure\n"
+           " This command toggles your floor mode.\n"
+           " \n"
+           " <;G>oto FLOORNAME\n"
+           " This command causes the system to take you to the named floor.\n"
+           " \n"
+           " <;K>nown rooms on floors\n"
+           " List all rooms on all floors.  This is a very readable way to get a list of\n"
+           "all rooms on the system.\n"
+           " \n"
+           " <;S>kip FLOORNAME\n"
+           " This command causes the system to mark all rooms on the current floor as\n"
+           "Skipped and takes you to the floor that you specify.\n"
+           " \n"
+           " <;Z>Forget floor\n"
+           "   This command causes you to forget all the rooms currently on the current\n"
+           "floor.  Unfortunately, it doesn't apply to rooms that are subsequently created\n"
+           "or moved to this floor.  (Sorry.)\n"
+           " \n"
+           "   Feel free to experiment, you can't hurt yourself or the system with the\n"
+           "floor stuff unless you ZForget a floor by accident.\n",
+
+       "                  New User's Introduction to the site\n"
+           "  \n"
+           " This is an introduction to the Citadel BBS concept.  It is intended\n"
+           "for new users so that they can more easily become acquainted to using\n"
+           "Citadel when accessing it in the form of a text-based BBS.  Of\n"
+           "course, old users might learn something new each time they read\n"
+           "through it.\n"
+           " \n"
+           " Full help for the BBS commands can be obtained by typing <.H>elp SUMMARY\n"
+           "  \n"
+           " The CITADEL BBS room concept\n"
+           " ----------------------------\n"
+           "   The term BBS stands for 'Bulletin Board System'.  The analogy is\n"
+           "appropriate: one posts messages so that others may read them.  In\n"
+           "order to organize the posts, people can post in different areas of the\n"
+           "BBS, called rooms.\n"
+           "   In order to post in a certain room, you need to be 'in' that room.\n"
+           "Your current prompt is usually the room that you are in, followed the\n"
+           "greater-than-sign, such as:\n"
+           " \n"
+           " Lobby>\n"
+           " \n"
+           " The easiest way to traverse the room structure is with the 'Goto'\n"
+           "command, on the 'G' key.  Pressing 'G' will take you to the next room\n"
+           "in the 'march list' (see below) that has new messages in it.  You can\n"
+           "read these new messages with the 'N' key.\n"
+           " Once you've 'Gotoed' every room in the system (or all of the ones\n"
+           "you choose to read) you return to the 'Lobby,' the first and last room\n"
+           "in the system.  If new messages get posted to rooms you've already\n"
+           "read during your session you will be brought BACK to those rooms so\n"
+           "you can read them.\n"
+           " \n"
+           " March List\n"
+           " ----------\n"
+           "   All the room names are stored in a march list, which is just a\n"
+           "list containing all the room names.  When you <G>oto or <S>kip a\n"
+           "room, you are placed in the next room in your march list THAT HAS NEW\n"
+           "MESSAGES.  If you have no new messages in any of the rooms on your\n"
+           "march list, you will keep going to the Lobby>.  You can choose not to\n"
+           "read certain rooms (that don't interest you) by 'Z'apping them.  When\n"
+           "you <Z>ap a room, you are merely deleting it from your march list (but\n"
+           "not from anybody else's).\n"
+           " \n"
+           "   You can use the <.G>oto (note the period before the G.  You can also use\n"
+           "<J>ump on some systems) to go to any room in the\n"
+           "system.  You don't have to type in the complete name of a room to\n"
+           "'jump' to it; you merely need to type in enough to distinguish it from\n"
+           "the other rooms.  Left-aligned matches carry a heavier weight, so if you\n"
+           "typed (for example) '.Goto TECH', you might be taken to a room called\n"
+           "'Tech Area>' even if it found a room called 'Biotech/Ethics>' first.\n"
+           " \n"
+           "  To return to a room you have previously <Z>apped, use the <.G>oto command\n"
+           "to enter it, and it will be re-inserted into your march list.  In the case\n"
+           "of returning to Zapped rooms, you must type the room name in its entirety.\n"
+           "REMEMBER, rooms with no new messages will not show on your\n"
+           "march list!  You must <.G>oto to a room with no new messages.\n"
+           "Incidentally, you cannot change the order of the rooms on your march list.\n"
+           "It's the same for everybody.\n"
+           " \n"
+           " Special rooms\n"
+           " -------------\n"
+           "   There are two special rooms on a Citadel that you should know about.\n"
+           "  \n"
+           "   The first is the Lobby>.  It's used for system announcements and other\n"
+           "such administrativia.  You cannot <Z>ap the Lobby>.  Each time you first\n"
+           "login, you will be placed in the Lobby>.\n"
+           " \n"
+           "   The second is Mail>.  In Mail>, when you post a messages, you are\n"
+           "prompted to enter the screen name of the person who you want to send the\n"
+           "message to.  Only the person who you send the message to can read the\n"
+           "message.  NO ONE else can read it, not even the admins.  Mail> is the\n"
+           "first room on the march list, and is un-<Z>appable, so you can be sure\n"
+           "that the person will get the message.\n"
+           "   \n"
+           " System admins\n"
+           " -------------\n"
+           "   These people, along with the room admins, keep the site running smoothly.\n"
+           "\n"
+           "   Among the many things that admins do are: create rooms, delete\n"
+           "rooms, set access levels, invite users, check registration, grant\n"
+           "room admin status, and countless other things.  They have access to the\n"
+           "Aide> room, a special room only for admins.\n"
+           " \n"
+           "   If you enter a mail message to 'Sysop' it will be placed in the\n"
+           "Aide> room so that the next admin online will read it and deal with it.\n"
+           "Admins cannot <Z>ap rooms.  All the rooms are always on each admin's\n"
+           "march list.  Admins can read *any* and *every* room, but they *CAN* *NOT*\n"
+           "read other users' Mail!\n"
+           "  \n"
+           " Room admins\n"
+           " -----------\n"
+           "   Room admins are granted special privileges in specific rooms.\n"
+           "They are *NOT* true system admins; their power extends only over the\n"
+           "rooms that they control, and they answer to the system admins.\n"
+           "  \n"
+           "   A room admin's job is to keep the topic of the their room on track,\n"
+           "with nudges in the right direction now and then.  A room admin can also\n"
+           "move an off topic post to another room, or delete a post, if he/she\n"
+           "feels it is necessary. \n"
+           "  \n"
+           "   Currently, very few rooms have room admins.  Most rooms do not need\n"
+           "their own specific room admin.  Being a room admin requires a certain\n"
+           "amount of trust, due to the additional privileges granted.\n"
+           "  \n"
+           " Citadel messages\n"
+           " ----------------\n"
+           "   Most of the time, the BBS code does not print a lot of messages\n"
+           "to your screen.  This is a great benefit once you become familiar\n"
+           "with the system, because you do not have endless menus and screens\n"
+           "to navigate through.  nevertheless, there are some messages which you\n"
+           "might see from time to time.\n"
+           "  \n"
+           "  'There were messages posted while you were entering.'\n"
+           "  \n"
+           "   This is also known as 'simulposting.'  When you start entering a \n"
+           "message, the system knows where you last left off.  When you save\n"
+           "your message, the system checks to see if any messages were entered\n"
+           "while you were typing.  This is so that you know whether you need\n"
+           "to go back and re-read the last few messages.  This message may appear\n"
+           "in any room.\n"
+           "   \n"
+           " '*** You have new mail'\n"
+           "  \n"
+           "   This message is essentially the same as the above message, but can\n"
+           "appear at any time.  It simply means that new mail has arrived for you while\n"
+           "you are logged in.  Simply go to the Mail> room to read it.\n"
+           "  \n"
+           " Who list\n"
+           " --------\n"
+           "   The <W>ho command shows you the names of all users who are currently\n"
+           "online.  It also shows you the name of the room they are currently in.  If\n"
+           "they are in any type of private room, however, the room name will simply\n"
+           "display as '<private room>'.  Along with this information is displayed the\n"
+           "name of the host computer the user is logged in from.\n",
+
+       "To send mail on this system, go to the Mail> room (using the command .G Mail)\n"
+           "and press E to enter a message.  You will be prompted with:\n"
+           " \n"
+           " Enter Recipient:\n"
+           " \n"
+           "   At this point you may enter the name of another user on the system.  Private\n"
+           "mail is only readable by the sender and recipient.  There is no need to delete\n"
+           "mail after it is read; it will scroll out automatically.\n"
+           "  \n"
+           "   To send mail to another user on the Citadel network, simply type the\n"
+           "user's name, followed by @ and then the system name. For example,\n"
+           "  \n"
+           " Enter Recipient: Joe Schmoe @ citadrool\n"
+           "  \n"
+           "  If your account is enabled for Internet mail, you can also send email to\n"
+           "anyone on the Internet here.  Simply enter their address at the prompt:\n"
+           "  \n" " Enter Recipient: ajc@herring.fishnet.com\n",
+
+       "  Welcome to the network. Messages entered in a network room will appear in\n"
+           "that room on all other systems carrying it (The name of the room, however,\n" "may be different on other systems).\n",
+
+       "   Citadel is the premier 'online community' (i.e. Bulletin Board System)\n"
+           "software.  It runs on all POSIX-compliant systems, including Linux.  It is an\n"
+           "advanced client/server application, and is being actively maintained.\n"
+           " \n" "   For more info, visit UNCENSORED! BBS at uncensored.citadel.org\n",
+
+       "Extended commands are available using the period ( . ) key. To use\n"
+           "a dot command, press the . key, and then enter the first letter of\n"
+           "each word in the command. The words will appear as you enter the keys.\n"
+           "You can also backspace over partially entered commands. The following\n"
+           "commands are available:\n"
+           "\n"
+           " <.> <H>elp:    Displays help files.  Type .H followed by a help file\n"
+           "                name.  You are now reading <.H>elp SUMMARY\n"
+           " \n"
+           " <.> <G>oto:    Jumps directly to the room you specify.  You can also\n"
+           "                type a partial room name, just enough to make it unique,\n"
+           "                and it'll find the room you're looking for.  As with the\n"
+           "                regular <G>oto command, messages in the current room will\n"
+           "                be marked as read.\n"
+           " \n"
+           " <.> <S>kip, goto:    This is similar to <.G>oto, except it doesn't mark\n"
+           "                      messages in the current room as read.\n"
+           " \n"
+           " <.> list <Z>apped rooms      Shows all rooms you've <Z>apped (forgotten)\n"
+           "\n"
+           "  \n"
+           " Terminate (logoff) commands:\n"
+           " \n"
+           " <.> <T>erminate and <Q>uit               Log off and disconnect.\n"
+           " <.> <T>erminate and <S>tay online        Log in as a different user.\n"
+           " \n"
+           " \n"
+           " Read commands:\n"
+           "\n"
+           " <.> <R>ead <N>ew messages                Same as <N>ew\n"
+           " <.> <R>ead <O>ld msgs reverse            Same as <O>ld\n"
+           " <.> <R>ead <L>ast five msgs              Same as <L>ast5\n"
+           " <.> read <L>ast:                         Allows you to specify how many\n"
+           "                                          messages you wish to read.\n"
+           "\n"
+           " <.> <R>ead <U>ser listing:               Lists all users on the system if\n"
+           "                                          you just hit enter, otherwise\n"
+           "                                          you can specify a partial match\n"
+           "\n"
+           " <.> <R>ead <T>extfile formatted          File 'download' commands.\n"
+           " <.> <R>ead file using <X>modem   \n"
+           " <.> <R>ead file using <Y>modem   \n"
+           " <.> <R>ead file using <Z>modem   \n"
+           " <.> <R>ead <F>ile unformatted   \n"
+           " <.> <R>ead <D>irectory   \n"
+           "\n"
+           " <.> <R>ead <I>nfo file                   Read the room info file.\n"
+           " <.> <R>ead <B>io                         Read other users' 'bio' files.\n"
+           " <.> <R>ead <C>onfiguration               Display your 'preferences'.\n"
+           " <.> <R>ead <S>ystem info                 Display system statistics.\n"
+           "\n"
+           " \n"
+           " Enter commands:\n"
+           "\n"
+           " <.> <E>nter <M>essage                    Post a message in this room.\n"
+           " <.> <E>nter message with <E>ditor        Post using a full-screen editor.\n"
+           " <.> <E>nter <A>SCII message              Post 'raw' (use this when 'pasting'\n"
+           "                                          a message from your clipboard).\n"
+           "\n"
+           " <.> <E>nter <P>assword                   Change your password.\n"
+           " <.> <E>nter <C>onfiguration              Change your 'preferences'.\n"
+           " <.> <E>nter a new <R>oom                 Create a new room.\n"
+           " <.> <E>nter re<G>istration               Register (name, address, etc.)\n"
+           " <.> <E>nter <B>io                        Enter/change your 'bio' file.\n"
+           "\n"
+           " <.> <E>nter <T>extfile                   File 'upload' commands.\n"
+           " <.> <E>nter file using <X>modem   \n"
+           " <.> <E>nter file using <Y>modem   \n"
+           " <.> <E>nter file using <Z>modem   \n"
+           "  \n"
+           "  \n"
+           "  Wholist commands:\n"
+           " \n"
+           " <.> <W>holist <L>ong             Same as <W>ho is online, but displays\n"
+           "                                  more detailed information.\n"
+           " <.> <W>holist <R>oomname         Masquerade your room name (other users\n"
+           "                                  see the name you enter rather than the\n"
+           "                                  actual name of the room you're in)\n"
+           " <.> <W>holist <H>ostname         Masquerade your host name\n"
+           " <.> <E>nter <U>sername           Masquerade your user name (Admins only)\n"
+           " <.> <W>holist <S>tealth mode     Enter/exit 'stealth mode' (when in stealth\n"
+           "                                  mode you are invisible on the wholist)\n"
+           " \n"
+           " \n"
+           " Floor commands (if using floor mode)\n"
+           " ;<C>onfigure floor mode            - turn floor mode on or off\n"
+           " ;<G>oto floor:                     - jump to a specific floor\n"
+           " ;<K>nown rooms                     - list all rooms on all floors\n"
+           " ;<S>kip to floor:                  - skip current floor, jump to another\n"
+           " ;<Z>ap floor                       - zap (forget) all rooms on this floor\n"
+           " \n"
+           " \n"
+           " Administrative commands: \n"
+           " \n"
+           " <.> <A>dmin <K>ill this room   \n"
+           " <.> <A>dmin <E>dit this room   \n"
+           " <.> <A>dmin <W>ho knows room   \n"
+           " <.> <A>dmin edit <U>ser   \n"
+           " <.> <A>dmin <V>alidate new users   \n"
+           " <.> <A>dmin enter <I>nfo file   \n"
+           " <.> <A>dmin <R>oom <I>nvite user  \n"
+           " <.> <A>dmin <R>oom <K>ick out user  \n"
+           " <.> <A>dmin <F>ile <D>elete  \n"
+           " <.> <A>dmin <F>ile <S>end over net  \n"
+           " <.> <A>dmin <F>ile <M>ove  \n"
+           " <.> <A>dmin <M>essage edit:   \n"
+           " <.> <A>dmin <P>ost   \n"
+           " <.> <A>dmin <S>ystem configuration   \n"
+           " <.> <A>dmin <T>erminate server <N>ow\n" " <.> <A>dmin <T>erminate server <S>cheduled\n"
 };
 
 
@@ -446,7 +423,7 @@ int rc_remember_passwords;
 int rc_ansi_color;
 int rc_color_use_bg;
 int rc_prompt_control = 0;
-time_t rc_idle_threshold = (time_t)900;
+time_t rc_idle_threshold = (time_t) 900;
 char rc_url_cmd[SIZ];
 char rc_open_cmd[SIZ];
 char rc_gotmail_cmd[SIZ];
@@ -462,9 +439,9 @@ 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 */
+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 */
 
 
 
@@ -472,7 +449,8 @@ int enable_color = 0;                       /* nonzero for ANSI color */
 /*
  * If an interesting key has been pressed, return its value, otherwise 0
  */
-char was_a_key_pressed(void) {
+char was_a_key_pressed(void)
+{
        fd_set rfds;
        struct timeval tv;
        int the_character;
@@ -482,7 +460,7 @@ char was_a_key_pressed(void) {
        FD_SET(0, &rfds);
        tv.tv_sec = 0;
        tv.tv_usec = 0;
-       retval = select(1, &rfds, NULL, NULL, &tv); 
+       retval = select(1, &rfds, NULL, NULL, &tv);
 
        /* Careful!  Disable keepalives during keyboard polling; we're probably
         * in the middle of a data transfer from the server, in which case
@@ -492,11 +470,10 @@ char was_a_key_pressed(void) {
                set_keepalives(KA_NO);
                the_character = inkey();
                set_keepalives(KA_YES);
-       }
-       else {
+       } else {
                the_character = 0;
        }
-       return(the_character);
+       return (the_character);
 }
 
 
@@ -528,19 +505,19 @@ void print_instant(void)
                color(BRIGHT_RED);
                scr_printf("\r---");
        }
-       
+
        while (instant_msgs != 0) {
                r = CtdlIPCGetInstantMessage(ipc_for_signal_handlers, &listing, buf);
                if (r / 100 != 1)
                        return;
-       
+
                instant_msgs = extract_int(buf, 0);
                timestamp = extract_long(buf, 1);
                flags = extract_int(buf, 2);
                extract_token(sender, buf, 3, '|', sizeof sender);
                extract_token(node, buf, 4, '|', sizeof node);
                strcpy(last_paged, sender);
-       
+
                localtime_r(&timestamp, &stamp);
 
                /* If the page is a Logoff Request, honor it. */
@@ -548,14 +525,13 @@ void print_instant(void)
                        termn8 = 1;
                        return;
                }
-       
+
                if (!IsEmptyStr(rc_exp_cmd)) {
                        outpipe = popen(rc_exp_cmd, "w");
                        if (outpipe != NULL) {
                                /* Header derived from flags */
                                if (flags & 2)
-                                       fprintf(outpipe,
-                                              "Please log off now, as requested ");
+                                       fprintf(outpipe, "Please log off now, as requested ");
                                else if (flags & 1)
                                        fprintf(outpipe, "Broadcast message ");
                                else if (flags & 4)
@@ -564,16 +540,11 @@ void print_instant(void)
                                        fprintf(outpipe, "Message ");
                                /* Timestamp.  Can this be improved? */
                                if (stamp.tm_hour == 0 || stamp.tm_hour == 12)
-                                       fprintf(outpipe, "at 12:%02d%cm",
-                                               stamp.tm_min, 
-                                               stamp.tm_hour ? 'p' : 'a');
-                               else if (stamp.tm_hour > 12)            /* pm */
-                                       fprintf(outpipe, "at %d:%02dpm",
-                                               stamp.tm_hour - 12,
-                                               stamp.tm_min);
-                               else                                    /* am */
-                                       fprintf(outpipe, "at %d:%02dam",
-                                               stamp.tm_hour, stamp.tm_min);
+                                       fprintf(outpipe, "at 12:%02d%cm", stamp.tm_min, stamp.tm_hour ? 'p' : 'a');
+                               else if (stamp.tm_hour > 12)    /* pm */
+                                       fprintf(outpipe, "at %d:%02dpm", stamp.tm_hour - 12, stamp.tm_min);
+                               else    /* am */
+                                       fprintf(outpipe, "at %d:%02dam", stamp.tm_hour, stamp.tm_min);
                                fprintf(outpipe, " from %s", sender);
                                if (strncmp(ipc_for_signal_handlers->ServInfo.nodename, node, 32))
                                        fprintf(outpipe, " @%s", node);
@@ -596,24 +567,22 @@ void print_instant(void)
                        scr_printf("Chat request ");
                else
                        scr_printf("Message ");
-       
+
                /* Timestamp.  Can this be improved? */
-               if (stamp.tm_hour == 0 || stamp.tm_hour == 12)/* 12am/12pm */
-                       scr_printf("at 12:%02d%cm", stamp.tm_min, 
-                               stamp.tm_hour ? 'p' : 'a');
-               else if (stamp.tm_hour > 12)                    /* pm */
-                       scr_printf("at %d:%02dpm",
-                               stamp.tm_hour - 12, stamp.tm_min);
-               else                                            /* am */
+               if (stamp.tm_hour == 0 || stamp.tm_hour == 12)  /* 12am/12pm */
+                       scr_printf("at 12:%02d%cm", stamp.tm_min, stamp.tm_hour ? 'p' : 'a');
+               else if (stamp.tm_hour > 12)    /* pm */
+                       scr_printf("at %d:%02dpm", stamp.tm_hour - 12, stamp.tm_min);
+               else            /* am */
                        scr_printf("at %d:%02dam", stamp.tm_hour, stamp.tm_min);
-               
+
                /* Sender */
                scr_printf(" from %s", sender);
-       
+
                /* Remote node, if any */
                if (strncmp(ipc_for_signal_handlers->ServInfo.nodename, node, 32))
                        scr_printf(" @%s", node);
-       
+
                scr_printf(":\n");
                fmout(screenwidth, NULL, listing, NULL, 0);
                free(listing);
@@ -636,7 +605,8 @@ void set_keepalives(int s)
  */
 
 static time_t idlet = 0;
-static void really_do_keepalive(void) {
+static void really_do_keepalive(void)
+{
 
        time(&idlet);
 
@@ -655,8 +625,7 @@ static void really_do_keepalive(void) {
                        if (ok_to_interrupt == 1) {
                                scr_printf("\r%64s\r", "");
                                print_instant();
-                               scr_printf("%s%c ", room_name,
-                                      room_prompt(room_flags));
+                               scr_printf("%s%c ", room_name, room_prompt(room_flags));
                                scr_flush();
                        }
                }
@@ -665,8 +634,8 @@ static void really_do_keepalive(void) {
        /* If half keepalives are enabled, send a QNOP to the server (if the
         * server supports it) and then do nothing.
         */
-       if ( (keepalives_enabled == KA_HALF)
-          && (ipc_for_signal_handlers->ServInfo.supports_qnop > 0) ) {
+       if ((keepalives_enabled == KA_HALF)
+           && (ipc_for_signal_handlers->ServInfo.supports_qnop > 0)) {
                CtdlIPC_chat_send(ipc_for_signal_handlers, "QNOP");
        }
 }
@@ -680,8 +649,7 @@ void do_keepalive(void)
        time_t now;
 
        time(&now);
-       if ((now - idlet) < ((long) S_KEEPALIVE))
-       {
+       if ((now - idlet) < ((long) S_KEEPALIVE)) {
                return;
        }
 
@@ -795,41 +763,46 @@ int ctdl_getline(char *string, int lim, int noshow, int bs)
                while (num_stars--) {
                        scr_putc('*');
                }
-       }
-       else {
+       } else {
                scr_printf("%s", string);
        }
 
-       while(1) {
+       while (1) {
                ch = inkey();
 
-               if ((ch == 8)  && (pos > 0)) {                          /* backspace */
+               if ((ch == 8) && (pos > 0)) {   /* backspace */
                        --pos;
-                       scr_putc(8); scr_putc(32); scr_putc(8);
+                       scr_putc(8);
+                       scr_putc(32);
+                       scr_putc(8);
                }
 
-               else if ((ch == 8) && (pos == 0) && (bs)) {             /* backspace out of the prompt */
-                       return(-1);
+               else if ((ch == 8) && (pos == 0) && (bs)) {     /* backspace out of the prompt */
+                       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); scr_putc(32); scr_putc(8);
+                               scr_putc(8);
+                               scr_putc(32);
+                               scr_putc(8);
                        }
-                       while ((pos > 0) && !isspace(string[pos-1])) {
+                       while ((pos > 0) && !isspace(string[pos - 1])) {
                                --pos;
-                               scr_putc(8); scr_putc(32); scr_putc(8);
+                               scr_putc(8);
+                               scr_putc(32);
+                               scr_putc(8);
                        }
                }
 
-               else if (ch == 10) {                                    /* return */
+               else if (ch == 10) {    /* return */
                        string[pos] = 0;
                        scr_printf("\n");
-                       return(pos);
+                       return (pos);
                }
 
-               else if (isprint(ch)) {                                 /* payload characters */
+               else if (isprint(ch)) { /* payload characters */
                        scr_putc((noshow ? '*' : ch));
                        string[pos] = ch;
                        ++pos;
@@ -851,7 +824,7 @@ void strprompt(char *prompt, char *str, int len)
        color(DIM_WHITE);
        scr_printf(": ");
        color(BRIGHT_CYAN);
-       ctdl_getline(str, abs(len), (len<0), 0);
+       ctdl_getline(str, abs(len), (len < 0), 0);
        color(DIM_WHITE);
 }
 
@@ -892,9 +865,9 @@ int intprompt(char *prompt, int ival, int imin, int imax)
                snprintf(buf, sizeof buf, "%d", i);
                strprompt(prompt, buf, 15);
                i = atoi(buf);
-               for (p=0; !IsEmptyStr(&buf[p]); ++p) {
-                       if ( (!isdigit(buf[p]))
-                          && ( (buf[p]!='-') || (p!=0) )  )
+               for (p = 0; !IsEmptyStr(&buf[p]); ++p) {
+                       if ((!isdigit(buf[p]))
+                           && ((buf[p] != '-') || (p != 0)))
                                i = imin - 1;
                }
                if (i < imin)
@@ -916,7 +889,7 @@ void newprompt(char *prompt, char *str, int len)
        color(BRIGHT_MAGENTA);
        scr_printf("%s", prompt);
        color(DIM_MAGENTA);
-       ctdl_getline(str, abs(len), (len<0), 0);
+       ctdl_getline(str, abs(len), (len < 0), 0);
        color(DIM_WHITE);
 }
 
@@ -1001,8 +974,7 @@ 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
@@ -1164,7 +1136,7 @@ char *cmd_expand(char *strbuf, int mode)
                if (strbuf[a] == '&') {
 
                        /* dont echo these non mnemonic command keys */
-                       int noecho = strbuf[a+1] == '<' || strbuf[a+1] == '>' || strbuf[a+1] == '+' || strbuf[a+1] == '-';
+                       int noecho = strbuf[a + 1] == '<' || strbuf[a + 1] == '>' || strbuf[a + 1] == '+' || strbuf[a + 1] == '-';
 
                        if (mode == 0) {
                                strcpy(&exp[a], &exp[a + 1 + noecho]);
@@ -1239,7 +1211,7 @@ int requires_string(struct citcmd *cptr, int ncomp)
  * This function returns an integer command number.  If the command prompts
  * for a string then it is placed in the supplied buffer.
  */
-int getcmd(CtdlIPC *ipc, char *argbuf)
+int getcmd(CtdlIPC * ipc, char *argbuf)
 {
        char cmdbuf[5];
        int cmdspaces[5];
@@ -1315,8 +1287,7 @@ int getcmd(CtdlIPC *ipc, char *argbuf)
                                if (cptr->c_cmdnum == this_lazy_cmd) {
                                        for (a = 0; a < 5; ++a)
                                                if (cptr->c_keys[a][0] != 0)
-                                                       scr_printf("%s ", cmd_expand(
-                                                                                       cptr->c_keys[a], 0));
+                                                       scr_printf("%s ", cmd_expand(cptr->c_keys[a], 0));
                                        scr_printf("\n");
                                        return (this_lazy_cmd);
                                }
@@ -1331,8 +1302,7 @@ int getcmd(CtdlIPC *ipc, char *argbuf)
                        if (cmdmatch(cmdbuf, cptr, cmdpos + 1)) {
 
                                scr_printf("%s", cmd_expand(cptr->c_keys[cmdpos], 0));
-                               cmdspaces[cmdpos] = strlen(
-                                   cmd_expand(cptr->c_keys[cmdpos], 0));
+                               cmdspaces[cmdpos