]> code.citadel.org Git - citadel.git/blobdiff - citadel/rooms.c
* The size constant "256" which shows up everywhere as a buffer size has now
[citadel.git] / citadel / rooms.c
index 6a5abb54ad55b9be170898665a3d4527eaf0953d..3e276edc2bd42010752dc3b134a4ce9bb4e06e51 100644 (file)
@@ -1,5 +1,12 @@
-/* Citadel/UX room-oriented routines */
+/*
+ * $Id$
+ *
+ * 
+ * Client-side functions which perform room operations
+ *
+ */
 
+#include "sysdep.h"
 #include <stdlib.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/stat.h>
 #include <sys/wait.h>
 #include <errno.h>
+#include <stdarg.h>
 #include "citadel.h"
 #include "rooms.h"
+#include "commands.h"
 #include "tools.h"
+#include "messages.h"
+#ifndef HAVE_SNPRINTF
+#include "snprintf.h"
+#endif
 
-#define IFEXPERT if (userflags&US_EXPERT)
 #define IFNEXPERT if ((userflags&US_EXPERT)==0)
-#define IFAIDE if (axlevel>=6)
-#define IFNAIDE if (axlevel<6)
 
 
 void sttybbs(int cmd);
-void extract(char *dest, char *source, int parmnum);
-int extract_int(char *source, int parmnum);
 void hit_any_key(void);
 int yesno(void);
-int yesno_d(int d);
 void strprompt(char *prompt, char *str, int len);
 void newprompt(char *prompt, char *str, int len);
-int struncmp(char *lstr, char *rstr, int len);
 void dotgoto(char *towhere, int display_name);
-long extract_long(char *source, int parmnum);
 void serv_read(char *buf, int bytes);
 void formout(char *name);
 int inkey(void);
 int fmout(int width, FILE *fp, char pagin, int height, int starting_lp, char subst);
-void citedit(FILE *fp, long int base_pos);
 void progress(long int curr, long int cmax);
 int pattern(char *search, char *patn);
 int file_checksum(char *filename);
 int nukedir(char *dirname);
-void color(int colornum);
 
 extern unsigned room_flags;
 extern char room_name[];
@@ -62,12 +65,12 @@ extern int ugnum;
 extern long uglsn;
 extern char ugname[];
 
-extern char floorlist[128][256];
+extern char floorlist[128][SIZ];
 
 
 void load_floorlist(void) {
        int a;
-       char buf[256];
+       char buf[SIZ];
 
        for (a=0; a<128; ++a) floorlist[a][0] = 0;
 
@@ -82,53 +85,138 @@ void load_floorlist(void) {
                }
        }
 
-void listrms(char *variety)
-{
-       char buf[256];
-       char rmname[32];
-       int f,c;
 
-       serv_puts(variety);
-       serv_gets(buf);
-       if (buf[0]!='1') return;
-       c = 1;
-       sigcaught = 0;
-       sttybbs(SB_YES_INTR);
-       while (serv_gets(buf), strcmp(buf,"000")) if (sigcaught==0) {
-               extract(rmname,buf,0);
+void room_tree_list(struct roomlisting *rp) {
+       static int c = 0;
+       char rmname[ROOMNAMELEN];
+       int f;
+
+       if (rp == NULL) {
+               c = 1;
+               return;
+               }
+
+       if (rp->lnext != NULL) {
+               room_tree_list(rp->lnext);
+               }
+
+       if (sigcaught == 0) {
+               strcpy(rmname, rp->rlname);
+               f = rp->rlflags;
                if ((c + strlen(rmname) + 4) > screenwidth) {
-                       printf("\n");
+
+                       /* line break, check the paginator */
+                       pprintf("\n");
                        c = 1;
                        }
-               f = extract_int(buf,1);
-               if (f & QR_PRIVATE) {
-                       color(1);
+                       if (f & QR_MAILBOX) {
+                       color(BRIGHT_YELLOW);
+                       }
+               else if (f & QR_PRIVATE) {
+                       color(BRIGHT_RED);
                        }
                else {
-                       color(2);
+                       color(DIM_WHITE);
                        }
-               printf("%s",rmname);
-               if ((f & QR_DIRECTORY) && (f & QR_NETWORK)) printf("}  ");
-               else if (f & QR_DIRECTORY) printf("]  ");
-               else if (f & QR_NETWORK) printf(")  ");
-               else printf(">  ");
+               pprintf("%s",rmname);
+               if ((f & QR_DIRECTORY) && (f & QR_NETWORK)) pprintf("}  ");
+               else if (f & QR_DIRECTORY) pprintf("]  ");
+               else if (f & QR_NETWORK) pprintf(")  ");
+               else pprintf(">  ");
                c = c + strlen(rmname) + 3;
                }
-       color(7);
-       sttybbs(SB_NO_INTR);
+
+       if (rp->rnext != NULL) {
+               room_tree_list(rp->rnext);
+               }
+
+       free(rp);
+       }
+
+
+/* 
+ * Room ordering stuff (compare first by floor, then by order)
+ */
+int rordercmp(struct roomlisting *r1, struct roomlisting *r2)
+{
+       if ((r1==NULL)&&(r2==NULL)) return(0);
+       if (r1==NULL) return(-1);
+       if (r2==NULL) return(1);
+       if (r1->rlfloor < r2->rlfloor) return(-1);
+       if (r1->rlfloor > r2->rlfloor) return(1);
+       if (r1->rlorder < r2->rlorder) return(-1);
+       if (r1->rlorder > r2->rlorder) return(1);
+       return(0);
        }
 
 
+/*
+ * Common code for all room listings
+ */
+void listrms(char *variety)
+{
+       char buf[SIZ];
+
+       struct roomlisting *rl = NULL;
+       struct roomlisting *rp;
+       struct roomlisting *rs;
+
+
+       /* Ask the server for a room list */
+       serv_puts(variety);
+       serv_gets(buf);
+       if (buf[0]!='1') return;
+       while (serv_gets(buf), strcmp(buf, "000")) {
+               rp = malloc(sizeof(struct roomlisting));
+               extract(rp->rlname, buf, 0);
+               rp->rlflags = extract_int(buf, 1);
+               rp->rlfloor = extract_int(buf, 2);
+               rp->rlorder = extract_int(buf, 3);
+               rp->lnext = NULL;
+               rp->rnext = NULL;
+
+               rs = rl;
+               if (rl == NULL) {
+                       rl = rp;
+                       }
+               else while (rp != NULL) {
+                       if (rordercmp(rp, rs)<0) {
+                               if (rs->lnext == NULL) {
+                                       rs->lnext = rp;
+                                       rp = NULL;
+                                       }
+                               else {
+                                       rs = rs->lnext;
+                                       }
+                               }
+                       else {
+                               if (rs->rnext == NULL) {
+                                       rs->rnext = rp;
+                                       rp = NULL;
+                                       }
+                               else {
+                                       rs = rs->rnext;
+                                       }
+                               }
+                       }
+               }
+
+       room_tree_list(NULL);
+       room_tree_list(rl);
+       color(DIM_WHITE);
+}
+
+
 void list_other_floors(void) {
        int a,c;
 
        c = 1;
        for (a=0; a<128; ++a) if ((strlen(floorlist[a])>0)&&(a!=curr_floor)) {
                if ((c + strlen(floorlist[a]) + 4) > screenwidth) {
-                       printf("\n");
+                       pprintf("\n");
                        c = 1;
                        }
-               printf("%s:  ",floorlist[a]);
+               pprintf("%s:  ",floorlist[a]);
                c = c + strlen(floorlist[a]) + 3;
                }
        }
@@ -140,59 +228,59 @@ void list_other_floors(void) {
  */
 void knrooms(int kn_floor_mode)
 {
-       char buf[256];
+       char buf[SIZ];
        int a;
 
        load_floorlist();
 
        if (kn_floor_mode == 0) {
-               color(3);
-               printf("\n   Rooms with unread messages:\n");
+               color(BRIGHT_CYAN);
+               pprintf("\n   Rooms with unread messages:\n");
                listrms("LKRN");
-               color(3);
-               printf("\n\n   No unseen messages in:\n");
+               color(BRIGHT_CYAN);
+               pprintf("\n\n   No unseen messages in:\n");
                listrms("LKRO");
-               printf("\n");
+               pprintf("\n");
                }
 
        if (kn_floor_mode == 1) {
-               color(3);
-               printf("\n   Rooms with unread messages on %s:\n",
+               color(BRIGHT_CYAN);
+               pprintf("\n   Rooms with unread messages on %s:\n",
                        floorlist[(int)curr_floor]);
-               sprintf(buf,"LKRN %d",curr_floor);
+               sprintf(buf,"LKRN %d", curr_floor);
                listrms(buf);
-               color(3);
-               printf("\n\n   Rooms with no new messages on %s:\n",
+               color(BRIGHT_CYAN);
+               pprintf("\n\n   Rooms with no new messages on %s:\n",
                        floorlist[(int)curr_floor]);
                sprintf(buf,"LKRO %d",curr_floor);
                listrms(buf);
-               color(3);
-               printf("\n\n   Other floors:\n");
+               color(BRIGHT_CYAN);
+               pprintf("\n\n   Other floors:\n");
                list_other_floors();
-               printf("\n");
+               pprintf("\n");
                }
 
        if (kn_floor_mode == 2) {
                for (a=0; a<128; ++a) if (floorlist[a][0]!=0) {
-                       color(3);
-                       printf("\n   Rooms on %s:\n",floorlist[a]);
+                       color(BRIGHT_CYAN);
+                       pprintf("\n   Rooms on %s:\n",floorlist[a]);
                        sprintf(buf,"LKRA %d",a);
                        listrms(buf);
-                       printf("\n");
+                       pprintf("\n");
                        }
                }
        
-       color(7);
+       color(DIM_WHITE);
        IFNEXPERT hit_any_key();
        }
 
 
 void listzrooms(void) {                /* list public forgotten rooms */
-       color(3);
-       printf("\n   Forgotten public rooms:\n");
+       color(BRIGHT_CYAN);
+       pprintf("\n   Forgotten public rooms:\n");
        listrms("LZRM");
-       printf("\n");
-       color(7);
+       pprintf("\n");
+       color(DIM_WHITE);
        IFNEXPERT hit_any_key();
        }
 
@@ -201,8 +289,7 @@ int set_room_attr(int ibuf, char *prompt, unsigned int sbit)
 {
        int a;
 
-       printf("%s [%s]? ",prompt,((ibuf&sbit) ? "Yes":"No"));
-       a=yesno_d(ibuf&sbit);
+       a = boolprompt(prompt, (ibuf&sbit));
        ibuf=(ibuf|sbit);
        if (!a) ibuf=(ibuf^sbit);
        return(ibuf);
@@ -218,7 +305,7 @@ int set_room_attr(int ibuf, char *prompt, unsigned int sbit)
 int select_floor(int rfloor)
 {
        int a, newfloor;
-       char floorstr[256];
+       char floorstr[SIZ];
 
        if (floor_mode == 1) {
                if (floorlist[(int)curr_floor][0]==0) load_floorlist();
@@ -226,11 +313,11 @@ int select_floor(int rfloor)
                do {
                        newfloor = (-1);
                        safestrncpy(floorstr,floorlist[rfloor],sizeof floorstr);
-                       strprompt("Which floor",floorstr,256);
+                       strprompt("Which floor",floorstr,SIZ);
                        for (a=0; a<128; ++a) {
-                               if (!strucmp(floorstr,&floorlist[a][0]))
+                               if (!strcasecmp(floorstr,&floorlist[a][0]))
                                        newfloor = a;
-                               if ((newfloor<0)&&(!struncmp(floorstr,
+                               if ((newfloor<0)&&(!strncasecmp(floorstr,
                                        &floorlist[a][0],strlen(floorstr))))
                                                newfloor = a;
                                if ((newfloor<0)&&(pattern(&floorlist[a][0],
@@ -262,8 +349,9 @@ void editthisroom(void) {
        unsigned rflags;
        int rbump;
        char raide[32];
-       char buf[256];
+       char buf[SIZ];
        int rfloor;
+       int rorder;
        int expire_mode = 0;
        int expire_value = 0;
 
@@ -280,6 +368,7 @@ void editthisroom(void) {
        extract(rdir, &buf[4],2);
        rflags = extract_int(&buf[4],3);
        rfloor = extract_int(&buf[4],4);
+       rorder = extract_int(&buf[4],5);
        rbump = 0;
 
        /* Fetch the name of the current room aide */
@@ -326,8 +415,7 @@ void editthisroom(void) {
                }
 
        if ((rflags&QR_PRIVATE)==QR_PRIVATE) {
-               printf("Cause current users to forget room [No] ? ");
-               if (yesno_d(0)==1) rbump = 1;
+               rbump = boolprompt("Cause current users to forget room", 0);
                }
 
        rflags = set_room_attr(rflags,"Preferred users only",QR_PREFONLY);
@@ -349,12 +437,12 @@ void editthisroom(void) {
                        "Ask users whether to make messages anonymous",
                        QR_ANONOPT);
                }
-
+       rorder = intprompt("Listing order", rorder, 1, 127);
 
        /* Ask about the room aide */
        do {
                strprompt("Room aide (or 'none')",raide,29);
-               if (!strucmp(raide,"none")) {
+               if (!strcasecmp(raide,"none")) {
                        strcpy(raide,"");
                        strcpy(buf,"200");
                        }
@@ -366,7 +454,7 @@ void editthisroom(void) {
                        }
                } while(buf[0]!='2');
 
-       if (!strucmp(raide,"none")) strcpy(raide,"");
+       if (!strcasecmp(raide,"none")) strcpy(raide,"");
 
 
        /* Angels and demons dancing in my head... */
@@ -409,10 +497,9 @@ void editthisroom(void) {
                        expire_mode, expire_value);
                serv_puts(buf);
                serv_gets(buf);
-               if (buf[0]!='2') printf("%s\n",&buf[4]);
 
-               snprintf(buf,sizeof buf,"SETR %s|%s|%s|%d|%d|%d",
-                       rname,rpass,rdir,rflags,rbump,rfloor);
+               snprintf(buf,sizeof buf,"SETR %s|%s|%s|%d|%d|%d|%d",
+                       rname,rpass,rdir,rflags,rbump,rfloor,rorder);
                serv_puts(buf);
                serv_gets(buf);
                printf("%s\n",&buf[4]);
@@ -425,7 +512,7 @@ void editthisroom(void) {
  * un-goto the previous room
  */
 void ungoto(void) { 
-       char buf[256];
+       char buf[SIZ];
        
        if (!strcmp(ugname,"")) return;
        snprintf(buf,sizeof buf,"GOTO %s",ugname);
@@ -445,29 +532,91 @@ void ungoto(void) {
        }
 
 
+/* Here's the code for simply transferring the file to the client,
+ * for folks who have their own clientware.  It's a lot simpler than
+ * the [XYZ]modem code below...
+ * (This function assumes that a download file is already open on the server)
+ */
+void download_to_local_disk(char *supplied_filename, long total_bytes)
+{
+       char buf[SIZ];
+       char dbuf[4096];
+       long transmitted_bytes = 0L;
+       long aa,bb;
+       FILE *savefp;
+       int broken = 0;
+       int packet;
+       char filename[SIZ];
+
+       strcpy(filename, supplied_filename);
+       if (strlen(filename)==0) {
+               newprompt("Filename: ", filename, 250);
+               }
+
+       printf("Enter the name of the directory to save '%s'\n",
+               filename);
+       printf("to, or press return for the current directory.\n");
+       newprompt("Directory: ", dbuf, sizeof dbuf);
+       if (strlen(dbuf)==0) strcpy(dbuf,".");
+       strcat(dbuf,"/");
+       strcat(dbuf,filename);
+       
+       savefp = fopen(dbuf,"w");
+       if (savefp == NULL) {
+               printf("Cannot open '%s': %s\n",dbuf,strerror(errno));
+               /* close the download file at the server */
+               serv_puts("CLOS");
+               serv_gets(buf);
+               if (buf[0]!='2') {
+                       printf("%s\n",&buf[4]);
+                       }
+               return;
+               }
+       progress(0,total_bytes);
+       while ( (transmitted_bytes < total_bytes) && (broken == 0) ) {
+               bb = total_bytes - transmitted_bytes;
+               aa = ((bb < 4096) ? bb : 4096);
+               sprintf(buf,"READ %ld|%ld",transmitted_bytes,aa);
+               serv_puts(buf);
+               serv_gets(buf);
+               if (buf[0]!='6') {
+                       printf("%s\n",&buf[4]);
+                       return;
+                       }
+               packet = extract_int(&buf[4],0);
+               serv_read(dbuf,packet);
+               if (fwrite(dbuf,packet,1,savefp) < 1) broken = 1;
+               transmitted_bytes = transmitted_bytes + (long)packet;
+               progress(transmitted_bytes,total_bytes);
+               }
+       fclose(savefp);
+       /* close the download file at the server */
+       serv_puts("CLOS");
+       serv_gets(buf);
+       if (buf[0]!='2') {
+               printf("%s\n",&buf[4]);
+               }
+       return;
+       }
+
+
 /*
  * download()  -  download a file or files.  The argument passed to this
  *                function determines which protocol to use.
+ *  proto - 0 = paginate, 1 = xmodem, 2 = raw, 3 = ymodem, 4 = zmodem, 5 = save
  */
 void download(int proto)
 {
-
-/*
-  - 0 = paginate, 1 = xmodem, 2 = raw, 3 = ymodem, 4 = zmodem, 5 = save
-*/
-
-
-       char buf[256];
-       char dbuf[4096];
-       char filename[256];
+       char buf[SIZ];
+       char filename[SIZ];
+       char tempname[SIZ];
+       char transmit_cmd[SIZ];
        long total_bytes = 0L;
+       char dbuf[4096];
        long transmitted_bytes = 0L;
        long aa,bb;
-       int a,b;
        int packet;
        FILE *tpipe = NULL;
-       FILE *savefp = NULL;
-       int proto_pid;
        int broken = 0;
 
        if ((room_flags & QR_DOWNLOAD) == 0) {
@@ -486,116 +635,19 @@ void download(int proto)
                }
        total_bytes = extract_long(&buf[4],0);
 
-
-       /* Here's the code for simply transferring the file to the client,
-        * for folks who have their own clientware.  It's a lot simpler than
-        * the [XYZ]modem code below...
-        */
+       /* Save to local disk, for folks with their own copy of the client */
        if (proto == 5) {
-               printf("Enter the name of the directory to save '%s'\n",
-                       filename);
-               printf("to, or press return for the current directory.\n");
-               newprompt("Directory: ",dbuf,256);
-               if (strlen(dbuf)==0) strcpy(dbuf,".");
-               strcat(dbuf,"/");
-               strcat(dbuf,filename);
-               
-               savefp = fopen(dbuf,"w");
-               if (savefp == NULL) {
-                       printf("Cannot open '%s': %s\n",dbuf,strerror(errno));
-                       /* close the download file at the server */
-                       serv_puts("CLOS");
-                       serv_gets(buf);
-                       if (buf[0]!='2') {
-                               printf("%s\n",&buf[4]);
-                               }
-                       return;
-                       }
-               progress(0,total_bytes);
-               while ( (transmitted_bytes < total_bytes) && (broken == 0) ) {
-                       bb = total_bytes - transmitted_bytes;
-                       aa = ((bb < 4096) ? bb : 4096);
-                       sprintf(buf,"READ %ld|%ld",transmitted_bytes,aa);
-                       serv_puts(buf);
-                       serv_gets(buf);
-                       if (buf[0]!='6') {
-                               printf("%s\n",&buf[4]);
-                               return;
-                               }
-                       packet = extract_int(&buf[4],0);
-                       serv_read(dbuf,packet);
-                       if (fwrite(dbuf,packet,1,savefp) < 1) broken = 1;
-                       transmitted_bytes = transmitted_bytes + (long)packet;
-                       progress(transmitted_bytes,total_bytes);
-                       }
-               fclose(savefp);
-               /* close the download file at the server */
-               serv_puts("CLOS");
-               serv_gets(buf);
-               if (buf[0]!='2') {
-                       printf("%s\n",&buf[4]);
-                       }
+               download_to_local_disk(filename, total_bytes);
                return;
                }
 
-
-       mkdir(tempdir,0700);
-       snprintf(buf,sizeof buf,"%s/%s",tempdir,filename);
-       mkfifo(buf, 0777);
-
-       /* We do the remainder of this function as a separate process in
-        * order to allow recovery if the transfer is aborted.  If the
-        * file transfer program aborts, the first child process receives a
-        * "broken pipe" signal and aborts.  We *should* be able to catch
-        * this condition with signal(), but it doesn't seem to work on all
-        * systems.
-        */
-       a = fork();
-       if (a!=0) {
-               /* wait for the download to finish */
-               while (wait(&b)!=a) ;;
-               sttybbs(0);
-               /* close the download file at the server */
-               serv_puts("CLOS");
-               serv_gets(buf);
-               if (buf[0]!='2') {
-                       printf("%s\n",&buf[4]);
-                       }
-               /* clean up the temporary directory */
-               nukedir(tempdir);
-               return;
-               }
-
-       snprintf(buf,sizeof buf,"%s/%s",tempdir,filename); /* full pathname */
-
-       /* The next fork() creates a second child process that is used for
-        * the actual file transfer program (usually sz).
-        */
-       proto_pid = fork();
-       if (proto_pid == 0) {
-               if (proto==0)  {
-                       sttybbs(0);
-                       signal(SIGINT,SIG_DFL);
-                       signal(SIGQUIT,SIG_DFL);
-                       snprintf(dbuf,sizeof dbuf,"SHELL=/dev/null; export SHELL; TERM=dumb; export TERM; exec more -d <%s",buf);
-                       system(dbuf);
-                       sttybbs(SB_NO_INTR);
-                       exit(0);
-                       }
-               sttybbs(3);
-               signal(SIGINT,SIG_DFL);
-               signal(SIGQUIT,SIG_DFL);
-               if (proto==1) execlp("sx","sx",buf,NULL);
-               if (proto==2) execlp("cat","cat",buf,NULL);
-               if (proto==3) execlp("sb","sb",buf,NULL);
-               if (proto==4) execlp("sz","sz",buf,NULL);
-               execlp("cat","cat",buf,NULL);
-               exit(1);
-               }
-
-       tpipe = fopen(buf,"w");
-
+       /* Meta-download for public clients */
+       printf("Fetching file from Citadel server...\n");
+       mkdir(tempdir, 0700);
+       snprintf(tempname, sizeof tempname, "%s/%s", tempdir, filename);
+       tpipe = fopen(tempname, "wb");
        while ( (transmitted_bytes < total_bytes) && (broken == 0) ) {
+               progress(transmitted_bytes, total_bytes);
                bb = total_bytes - transmitted_bytes;
                aa = ((bb < 4096) ? bb : 4096);
                sprintf(buf,"READ %ld|%ld",transmitted_bytes,aa);
@@ -603,52 +655,66 @@ void download(int proto)
                serv_gets(buf);
                if (buf[0]!='6') {
                        printf("%s\n",&buf[4]);
-                       return;
-                       }
+               }
                packet = extract_int(&buf[4],0);
                serv_read(dbuf,packet);
                if (fwrite(dbuf,packet,1,tpipe) < 1) broken = 1;
                transmitted_bytes = transmitted_bytes + (long)packet;
-               }
-       if (tpipe!=NULL) fclose(tpipe);
+       }
+       fclose(tpipe);
+       progress(transmitted_bytes, total_bytes);
 
-       /* Hang out and wait for the file transfer program to finish */
-       while (wait(&a) != proto_pid) ;;
+       /* close the download file at the server */
+       serv_puts("CLOS");
+       serv_gets(buf);
+       if (buf[0]!='2') {
+               printf("%s\n",&buf[4]);
+       }
 
+       if (proto==0)           sprintf(transmit_cmd, "SHELL=/dev/null; export SHELL; TERM=dumb; export TERM; exec more -d <%s",tempname);
+       else if (proto==1)      sprintf(transmit_cmd, "exec sx %s", tempname);
+       else if (proto==3)      sprintf(transmit_cmd, "exec sb %s", tempname);
+       else if (proto==4)      sprintf(transmit_cmd, "exec sz %s", tempname);
+       else                    sprintf(transmit_cmd, "exec cat %s", tempname);
 
+       sttybbs(SB_RESTORE);
+       system(transmit_cmd);
+       sttybbs(SB_NO_INTR);
+       
+       /* clean up the temporary directory */
+       nukedir(tempdir);
        putc(7,stdout);
-       exit(0);        /* transfer control back to the main program */
-       }
+}
 
 
 /*
  * read directory of this room
  */
 void roomdir(void) {
-       char flnm[256];
+       char flnm[SIZ];
        char flsz[32];
-       char comment[256];
-       char buf[256];
+       char comment[SIZ];
+       char buf[SIZ];
 
        serv_puts("RDIR");
        serv_gets(buf);
        if (buf[0]!='1') {
-               printf("%s\n",&buf[4]);
+               pprintf("%s\n",&buf[4]);
                return;
                }
 
        extract(comment,&buf[4],0);
        extract(flnm,&buf[4],1);
-       printf("\nDirectory of %s on %s\n",flnm,comment);
-       printf("-----------------------\n");
+       pprintf("\nDirectory of %s on %s\n",flnm,comment);
+       pprintf("-----------------------\n");
        while (serv_gets(buf), strcmp(buf,"000")) {
                extract(flnm,buf,0);
                extract(flsz,buf,1);
                extract(comment,buf,2);
                if (strlen(flnm)<=14)
-                       printf("%-14s %8s %s\n",flnm,flsz,comment);
+                       pprintf("%-14s %8s %s\n",flnm,flsz,comment);
                else
-                       printf("%s\n%14s %8s %s\n",flnm,"",flsz,comment);
+                       pprintf("%s\n%14s %8s %s\n",flnm,"",flsz,comment);
                }
        }
 
@@ -657,7 +723,7 @@ void roomdir(void) {
  * add a user to a private room
  */
 void invite(void) {
-       char aaa[31],bbb[256];
+       char aaa[31],bbb[SIZ];
 
        if ((room_flags & QR_PRIVATE)==0) {
                printf("This is not a private room.\n");
@@ -678,13 +744,7 @@ void invite(void) {
  * kick a user out of a room
  */
 void kickout(void) {
-       char aaa[31],bbb[256];
-
-       if ((room_flags & QR_PRIVATE)==0) {
-               printf("Note: this is not a private room.  Kicking a user ");
-               printf("out of this room will only\nhave the same effect ");
-               printf("as if they <Z>apped the room.\n\n");
-               }
+       char aaa[31],bbb[SIZ];
 
        newprompt("Name of user? ",aaa,30);
        if (aaa[0]==0) return;
@@ -720,7 +780,7 @@ void killroom(void) {
        }
 
 void forget(void) {    /* forget the current room */
-       char cmd[256];
+       char cmd[SIZ];
 
        printf("Are you sure you want to forget this room? ");
        if (yesno()==0) return;
@@ -741,7 +801,7 @@ void forget(void) { /* forget the current room */
  * create a new room
  */
 void entroom(void) {
-       char cmd[256];
+       char cmd[SIZ];
        char new_room_name[ROOMNAMELEN];
        int new_room_type;
        char new_room_pass[10];
@@ -765,17 +825,18 @@ void entroom(void) {
 
        IFNEXPERT formout("roomaccess");
        do {
-               printf("<?>Help\n<1>Public room\n<2>Guess-name room\n");
-               printf("<3>Passworded room\n<4>Invitation-only room\n");
+               printf( "<?>Help\n<1>Public room\n<2>Guess-name room\n"
+                       "<3>Passworded room\n<4>Invitation-only room\n"
+                       "<5>Personal room\n");
                printf("Enter room type: ");
                do {
                        b=inkey();
-                       } while (((b<'1')||(b>'4')) && (b!='?'));
+                       } while (((b<'1')||(b>'5')) && (b!='?'));
                if (b=='?') {
                        printf("?\n");
                        formout("roomaccess");
                        }
-               } while ((b<'1')||(b>'4'));
+               } while ((b<'1')||(b>'5'));
        b=b-48;
        printf("%d\n",b);
        new_room_type = b - 1;
@@ -791,6 +852,7 @@ void entroom(void) {
        if (b==2) printf(" guess-name room.");
        if (b==3) printf(" passworded room, password: %s",new_room_pass);
        if (b==4) printf("n invitation-only room.");
+       if (b==5) printf(" personal room.");
        printf("\nInstall it? (y/n) : ");
        a=yesno();
        if (a==0) return;
@@ -811,7 +873,7 @@ void entroom(void) {
 
 
 void readinfo(void) {  /* read info file for current room */
-       char cmd[256];
+       char cmd[SIZ];
        
        sprintf(cmd,"RINF");
        serv_puts(cmd);
@@ -829,26 +891,23 @@ void readinfo(void) {     /* read info file for current room */
  * <W>ho knows room...
  */
 void whoknows(void) {
-       char buf[256];
+       char buf[SIZ];
        serv_puts("WHOK");
        serv_gets(buf);
        if (buf[0]!='1') {
-               printf("%s\n",&buf[5]);
+               pprintf("%s\n",&buf[5]);
                return;
-               }
-       sigcaught = 0;
-       sttybbs(SB_YES_INTR);
+       }
        while (serv_gets(buf), strncmp(buf,"000",3)) {
-               if (sigcaught==0) printf("%s\n",buf);
-               }
-       sttybbs(SB_NO_INTR);
+               if (sigcaught==0) pprintf("%s\n",buf);
        }
+}
 
 
 void do_edit(char *desc, char *read_cmd, char *check_cmd, char *write_cmd)
 {
        FILE *fp;
-       char cmd[256];
+       char cmd[SIZ];
        int b,cksum,editor_exit;
 
 
@@ -901,7 +960,7 @@ void do_edit(char *desc, char *read_cmd, char *check_cmd, char *write_cmd)
                printf("Entering %s.  ",desc);
                printf("Press return twice when finished.\n");
                fp=fopen(temp,"r+");
-               citedit(fp,0);
+               citedit(fp);
                fclose(fp);
                }
 
@@ -935,7 +994,7 @@ void enterinfo(void) {              /* edit info file for current room */
        }
 
 void enter_bio(void) {
-       char cmd[256];
+       char cmd[SIZ];
        snprintf(cmd,sizeof cmd,"RBIO %s",fullname);
        do_edit("your Bio",cmd,"NOOP","EBIO");
        }
@@ -944,8 +1003,8 @@ void enter_bio(void) {
  * create a new floor
  */
 void create_floor(void) {
-       char buf[256];
-       char newfloorname[256];
+       char buf[SIZ];
+       char newfloorname[SIZ];
 
        serv_puts("CFLR xx|0");
        serv_gets(buf);
@@ -970,7 +1029,7 @@ void create_floor(void) {
  * edit the current floor
  */
 void edit_floor(void) {
-       char buf[256];
+       char buf[SIZ];
        int expire_mode = 0;
        int expire_value = 0;
 
@@ -1022,7 +1081,6 @@ void edit_floor(void) {
                expire_mode, expire_value);
        serv_puts(buf);
        serv_gets(buf);
-       if (buf[0]!='2') printf("%s\n",&buf[4]);
 
        snprintf(buf,sizeof buf,"EFLR %d|%s",curr_floor,
                 &floorlist[(int)curr_floor][0]);
@@ -1040,7 +1098,7 @@ void edit_floor(void) {
  */
 void kill_floor(void) {
        int floornum_to_delete,a;
-       char buf[256];
+       char buf[SIZ];
 
        if (floorlist[(int)curr_floor][0]==0) load_floorlist();
        do {
@@ -1049,7 +1107,7 @@ void kill_floor(void) {
                newprompt("Delete which floor? ",buf,255);
                if (strlen(buf)==0) return;
                for (a=0; a<128; ++a)
-                       if (!strucmp(&floorlist[a][0],buf))
+                       if (!strcasecmp(&floorlist[a][0],buf))
                                floornum_to_delete = a;
                if (floornum_to_delete < 0) {
                        printf("No such floor.  Select one of:\n");