1 /* Citadel/UX room-oriented routines */
12 #include <sys/types.h>
25 #define IFNEXPERT if ((userflags&US_EXPERT)==0)
28 void sttybbs(int cmd);
29 void hit_any_key(void);
31 void strprompt(char *prompt, char *str, int len);
32 void newprompt(char *prompt, char *str, int len);
33 int struncmp(char *lstr, char *rstr, int len);
34 void dotgoto(char *towhere, int display_name);
35 void serv_read(char *buf, int bytes);
36 void formout(char *name);
38 int fmout(int width, FILE *fp, char pagin, int height, int starting_lp, char subst);
39 void citedit(FILE *fp, long int base_pos);
40 void progress(long int curr, long int cmax);
41 int pattern(char *search, char *patn);
42 int file_checksum(char *filename);
43 int nukedir(char *dirname);
45 extern unsigned room_flags;
46 extern char room_name[];
48 extern char tempdir[];
49 extern int editor_pid;
50 extern char editor_path[];
51 extern int screenwidth;
52 extern int screenheight;
53 extern char fullname[];
55 extern char sigcaught;
56 extern char floor_mode;
57 extern char curr_floor;
64 extern char floorlist[128][256];
67 void load_floorlist(void) {
71 for (a=0; a<128; ++a) floorlist[a][0] = 0;
76 strcpy(floorlist[0],"Main Floor");
79 while (serv_gets(buf), strcmp(buf,"000")) {
80 extract(floorlist[extract_int(buf,0)],buf,1);
85 void room_tree_list(struct roomlisting *rp) {
87 char rmname[ROOMNAMELEN];
95 if (rp->lnext != NULL) {
96 room_tree_list(rp->lnext);
100 strcpy(rmname, rp->rlname);
102 if ((c + strlen(rmname) + 4) > screenwidth) {
106 if (f & QR_MAILBOX) {
107 color(BRIGHT_YELLOW);
109 else if (f & QR_PRIVATE) {
116 if ((f & QR_DIRECTORY) && (f & QR_NETWORK)) printf("} ");
117 else if (f & QR_DIRECTORY) printf("] ");
118 else if (f & QR_NETWORK) printf(") ");
120 c = c + strlen(rmname) + 3;
123 if (rp->rnext != NULL) {
124 room_tree_list(rp->rnext);
132 * Room ordering stuff (compare first by floor, then by order)
134 int rordercmp(struct roomlisting *r1, struct roomlisting *r2)
136 if ((r1==NULL)&&(r2==NULL)) return(0);
137 if (r1==NULL) return(-1);
138 if (r2==NULL) return(1);
139 if (r1->rlfloor < r2->rlfloor) return(-1);
140 if (r1->rlfloor > r2->rlfloor) return(1);
141 if (r1->rlorder < r2->rlorder) return(-1);
142 if (r1->rlorder > r2->rlorder) return(1);
148 * Common code for all room listings
150 void listrms(char *variety)
154 struct roomlisting *rl = NULL;
155 struct roomlisting *rp;
156 struct roomlisting *rs;
159 /* Ask the server for a room list */
162 if (buf[0]!='1') return;
163 while (serv_gets(buf), strcmp(buf, "000")) {
164 rp = malloc(sizeof(struct roomlisting));
165 extract(rp->rlname, buf, 0);
166 rp->rlflags = extract_int(buf, 1);
167 rp->rlfloor = extract_int(buf, 2);
168 rp->rlorder = extract_int(buf, 3);
176 else while (rp != NULL) {
177 if (rordercmp(rp, rs)<0) {
178 if (rs->lnext == NULL) {
187 if (rs->rnext == NULL) {
199 sttybbs(SB_YES_INTR);
200 room_tree_list(NULL);
207 void list_other_floors(void) {
211 for (a=0; a<128; ++a) if ((strlen(floorlist[a])>0)&&(a!=curr_floor)) {
212 if ((c + strlen(floorlist[a]) + 4) > screenwidth) {
216 printf("%s: ",floorlist[a]);
217 c = c + strlen(floorlist[a]) + 3;
223 * List known rooms. kn_floor_mode should be set to 0 for a 'flat' listing,
224 * 1 to list rooms on the current floor, or 1 to list rooms on all floors.
226 void knrooms(int kn_floor_mode)
233 if (kn_floor_mode == 0) {
235 printf("\n Rooms with unread messages:\n");
238 printf("\n\n No unseen messages in:\n");
243 if (kn_floor_mode == 1) {
245 printf("\n Rooms with unread messages on %s:\n",
246 floorlist[(int)curr_floor]);
247 sprintf(buf,"LKRN %d",curr_floor);
250 printf("\n\n Rooms with no new messages on %s:\n",
251 floorlist[(int)curr_floor]);
252 sprintf(buf,"LKRO %d",curr_floor);
255 printf("\n\n Other floors:\n");
260 if (kn_floor_mode == 2) {
261 for (a=0; a<128; ++a) if (floorlist[a][0]!=0) {
263 printf("\n Rooms on %s:\n",floorlist[a]);
264 sprintf(buf,"LKRA %d",a);
271 IFNEXPERT hit_any_key();
275 void listzrooms(void) { /* list public forgotten rooms */
277 printf("\n Forgotten public rooms:\n");
281 IFNEXPERT hit_any_key();
285 int set_room_attr(int ibuf, char *prompt, unsigned int sbit)
289 a = boolprompt(prompt, (ibuf&sbit));
291 if (!a) ibuf=(ibuf^sbit);
298 * Select a floor (used in several commands)
299 * The supplied argument is the 'default' floor number.
300 * This function returns the selected floor number.
302 int select_floor(int rfloor)
307 if (floor_mode == 1) {
308 if (floorlist[(int)curr_floor][0]==0) load_floorlist();
312 safestrncpy(floorstr,floorlist[rfloor],sizeof floorstr);
313 strprompt("Which floor",floorstr,256);
314 for (a=0; a<128; ++a) {
315 if (!strucmp(floorstr,&floorlist[a][0]))
317 if ((newfloor<0)&&(!struncmp(floorstr,
318 &floorlist[a][0],strlen(floorstr))))
320 if ((newfloor<0)&&(pattern(&floorlist[a][0],
321 floorstr)>=0)) newfloor = a;
324 printf("\n One of:\n");
325 for (a=0; a<128; ++a)
326 if (floorlist[a][0]!=0)
330 } while(newfloor < 0);
340 * .<A>ide <E>dit room
342 void editthisroom(void) {
343 char rname[ROOMNAMELEN];
353 int expire_value = 0;
355 /* Fetch the existing room config */
359 printf("%s\n",&buf[4]);
363 extract(rname,&buf[4],0);
364 extract(rpass,&buf[4],1);
365 extract(rdir, &buf[4],2);
366 rflags = extract_int(&buf[4],3);
367 rfloor = extract_int(&buf[4],4);
368 rorder = extract_int(&buf[4],5);
371 /* Fetch the name of the current room aide */
374 if (buf[0]=='2') safestrncpy(raide,&buf[4],sizeof raide);
375 else strcpy(raide,"");
376 if (strlen(raide)==0) strcpy(raide,"none");
378 /* Fetch the expire policy (this will silently fail on old servers,
379 * resulting in "default" policy)
381 serv_puts("GPEX room");
384 expire_mode = extract_int(&buf[4], 0);
385 expire_value = extract_int(&buf[4], 1);
388 /* Now interact with the user. */
389 strprompt("Room name",rname,ROOMNAMELEN-1);
391 rfloor = select_floor(rfloor);
392 rflags = set_room_attr(rflags,"Private room",QR_PRIVATE);
393 if (rflags & QR_PRIVATE)
394 rflags = set_room_attr(rflags,
395 "Accessible by guessing room name",QR_GUESSNAME);
397 /* if it's public, clear the privacy classes */
398 if ((rflags & QR_PRIVATE)==0) {
399 if (rflags & QR_GUESSNAME) rflags = rflags - QR_GUESSNAME;
400 if (rflags & QR_PASSWORDED) rflags = rflags - QR_PASSWORDED;
403 /* if it's private, choose the privacy classes */
404 if ( (rflags & QR_PRIVATE)
405 && ( (rflags & QR_GUESSNAME) == 0) ) {
406 rflags = set_room_attr(rflags,
407 "Accessible by entering a password",QR_PASSWORDED);
409 if ( (rflags & QR_PRIVATE)
410 && ((rflags&QR_PASSWORDED)==QR_PASSWORDED) ) {
411 strprompt("Room password",rpass,9);
414 if ((rflags&QR_PRIVATE)==QR_PRIVATE) {
415 rbump = boolprompt("Cause current users to forget room", 0);
418 rflags = set_room_attr(rflags,"Preferred users only",QR_PREFONLY);
419 rflags = set_room_attr(rflags,"Read-only room",QR_READONLY);
420 rflags = set_room_attr(rflags,"Directory room",QR_DIRECTORY);
421 rflags = set_room_attr(rflags,"Permanent room",QR_PERMANENT);
422 if (rflags & QR_DIRECTORY) {
423 strprompt("Directory name",rdir,14);
424 rflags = set_room_attr(rflags,"Uploading allowed",QR_UPLOAD);
425 rflags = set_room_attr(rflags,"Downloading allowed",
427 rflags = set_room_attr(rflags,"Visible directory",QR_VISDIR);
429 rflags = set_room_attr(rflags,"Network shared room",QR_NETWORK);
430 rflags = set_room_attr(rflags,
431 "Automatically make all messages anonymous",QR_ANONONLY);
432 if ( (rflags & QR_ANONONLY) == 0) {
433 rflags = set_room_attr(rflags,
434 "Ask users whether to make messages anonymous",
437 rorder = intprompt("Listing order", rorder, 1, 127);
439 /* Ask about the room aide */
441 strprompt("Room aide (or 'none')",raide,29);
442 if (!strucmp(raide,"none")) {
447 snprintf(buf,sizeof buf,"QUSR %s",raide);
450 if (buf[0]!='2') printf("%s\n",&buf[4]);
452 } while(buf[0]!='2');
454 if (!strucmp(raide,"none")) strcpy(raide,"");
457 /* Angels and demons dancing in my head... */
459 sprintf(buf, "%d", expire_mode);
460 strprompt("Message expire policy (? for list)", buf, 1);
463 printf("0. Use the default for this floor\n");
464 printf("1. Never automatically expire messages\n");
465 printf("2. Expire by message count\n");
466 printf("3. Expire by message age\n");
468 } while((buf[0]<48)||(buf[0]>51));
469 expire_mode = buf[0] - 48;
471 /* ...lunatics and monsters underneath my bed */
472 if (expire_mode == 2) {
473 sprintf(buf, "%d", expire_value);
474 strprompt("Keep how many messages online?", buf, 10);
475 expire_value = atol(buf);
478 if (expire_mode == 3) {
479 sprintf(buf, "%d", expire_value);
480 strprompt("Keep messages for how many days?", buf, 10);
481 expire_value = atol(buf);
484 /* Give 'em a chance to change their minds */
485 printf("Save changes (y/n)? ");
488 snprintf(buf,sizeof buf,"SETA %s",raide);
491 if (buf[0]!='2') printf("%s\n",&buf[4]);
493 snprintf(buf, sizeof buf, "SPEX room|%d|%d",
494 expire_mode, expire_value);
498 snprintf(buf,sizeof buf,"SETR %s|%s|%s|%d|%d|%d|%d",
499 rname,rpass,rdir,rflags,rbump,rfloor,rorder);
502 printf("%s\n",&buf[4]);
503 if (buf[0]=='2') dotgoto(rname,2);
509 * un-goto the previous room
514 if (!strcmp(ugname,"")) return;
515 snprintf(buf,sizeof buf,"GOTO %s",ugname);
519 printf("%s\n",&buf[4]);
522 sprintf(buf,"SLRP %ld",uglsn);
525 if (buf[0]!='2') printf("%s\n",&buf[4]);
526 safestrncpy(buf,ugname,sizeof buf);
532 /* Here's the code for simply transferring the file to the client,
533 * for folks who have their own clientware. It's a lot simpler than
534 * the [XYZ]modem code below...
535 * (This function assumes that a download file is already open on the server)
537 void download_to_local_disk(char *supplied_filename, long total_bytes)
541 long transmitted_bytes = 0L;
548 strcpy(filename, supplied_filename);
549 if (strlen(filename)==0) {
550 newprompt("Filename: ", filename, 250);
553 printf("Enter the name of the directory to save '%s'\n",
555 printf("to, or press return for the current directory.\n");
556 newprompt("Directory: ",dbuf,256);
557 if (strlen(dbuf)==0) strcpy(dbuf,".");
559 strcat(dbuf,filename);
561 savefp = fopen(dbuf,"w");
562 if (savefp == NULL) {
563 printf("Cannot open '%s': %s\n",dbuf,strerror(errno));
564 /* close the download file at the server */
568 printf("%s\n",&buf[4]);
572 progress(0,total_bytes);
573 while ( (transmitted_bytes < total_bytes) && (broken == 0) ) {
574 bb = total_bytes - transmitted_bytes;
575 aa = ((bb < 4096) ? bb : 4096);
576 sprintf(buf,"READ %ld|%ld",transmitted_bytes,aa);
580 printf("%s\n",&buf[4]);
583 packet = extract_int(&buf[4],0);
584 serv_read(dbuf,packet);
585 if (fwrite(dbuf,packet,1,savefp) < 1) broken = 1;
586 transmitted_bytes = transmitted_bytes + (long)packet;
587 progress(transmitted_bytes,total_bytes);
590 /* close the download file at the server */
594 printf("%s\n",&buf[4]);
601 * download() - download a file or files. The argument passed to this
602 * function determines which protocol to use.
603 * proto - 0 = paginate, 1 = xmodem, 2 = raw, 3 = ymodem, 4 = zmodem, 5 = save
605 void download(int proto)
609 long total_bytes = 0L;
612 long transmitted_bytes = 0L;
621 if ((room_flags & QR_DOWNLOAD) == 0) {
622 printf("*** You cannot download from this room.\n");
626 newprompt("Enter filename: ",filename,255);
628 snprintf(buf,sizeof buf,"OPEN %s",filename);
632 printf("%s\n",&buf[4]);
635 total_bytes = extract_long(&buf[4],0);
637 /* Save to local disk, for folks with their own copy of the client */
639 download_to_local_disk(filename, total_bytes);
644 /* Meta-download for public clients */
646 snprintf(buf,sizeof buf,"%s/%s",tempdir,filename);
649 /* We do the remainder of this function as a separate process in
650 * order to allow recovery if the transfer is aborted. If the
651 * file transfer program aborts, the first child process receives a
652 * "broken pipe" signal and aborts. We *should* be able to catch
653 * this condition with signal(), but it doesn't seem to work on all
658 /* wait for the download to finish */
659 while (wait(&b)!=a) ;;
661 /* close the download file at the server */
665 printf("%s\n",&buf[4]);
667 /* clean up the temporary directory */
672 snprintf(buf,sizeof buf,"%s/%s",tempdir,filename); /* full pathname */
674 /* The next fork() creates a second child process that is used for
675 * the actual file transfer program (usually sz).
678 if (proto_pid == 0) {
681 signal(SIGINT,SIG_DFL);
682 signal(SIGQUIT,SIG_DFL);
683 snprintf(dbuf,sizeof dbuf,"SHELL=/dev/null; export SHELL; TERM=dumb; export TERM; exec more -d <%s",buf);
689 signal(SIGINT,SIG_DFL);
690 signal(SIGQUIT,SIG_DFL);
691 if (proto==1) execlp("sx","sx",buf,NULL);
692 if (proto==2) execlp("cat","cat",buf,NULL);
693 if (proto==3) execlp("sb","sb",buf,NULL);
694 if (proto==4) execlp("sz","sz",buf,NULL);
695 execlp("cat","cat",buf,NULL);
699 tpipe = fopen(buf,"w");
701 while ( (transmitted_bytes < total_bytes) && (broken == 0) ) {
702 bb = total_bytes - transmitted_bytes;
703 aa = ((bb < 4096) ? bb : 4096);
704 sprintf(buf,"READ %ld|%ld",transmitted_bytes,aa);
708 printf("%s\n",&buf[4]);
711 packet = extract_int(&buf[4],0);
712 serv_read(dbuf,packet);
713 if (fwrite(dbuf,packet,1,tpipe) < 1) broken = 1;
714 transmitted_bytes = transmitted_bytes + (long)packet;
716 if (tpipe!=NULL) fclose(tpipe);
718 /* Hang out and wait for the file transfer program to finish */
719 while (wait(&a) != proto_pid) ;;
723 exit(0); /* transfer control back to the main program */
729 * read directory of this room
740 printf("%s\n",&buf[4]);
744 extract(comment,&buf[4],0);
745 extract(flnm,&buf[4],1);
746 printf("\nDirectory of %s on %s\n",flnm,comment);
747 printf("-----------------------\n");
748 while (serv_gets(buf), strcmp(buf,"000")) {
751 extract(comment,buf,2);
752 if (strlen(flnm)<=14)
753 printf("%-14s %8s %s\n",flnm,flsz,comment);
755 printf("%s\n%14s %8s %s\n",flnm,"",flsz,comment);
761 * add a user to a private room
764 char aaa[31],bbb[256];
766 if ((room_flags & QR_PRIVATE)==0) {
767 printf("This is not a private room.\n");
771 newprompt("Name of user? ",aaa,30);
772 if (aaa[0]==0) return;
774 snprintf(bbb,sizeof bbb,"INVT %s",aaa);
777 printf("%s\n",&bbb[4]);
782 * kick a user out of a room
785 char aaa[31],bbb[256];
787 newprompt("Name of user? ",aaa,30);
788 if (aaa[0]==0) return;
790 snprintf(bbb,sizeof bbb,"KICK %s",aaa);
793 printf("%s\n",&bbb[4]);
798 * aide command: kill the current room
800 void killroom(void) {
806 printf("%s\n",&aaa[4]);
810 printf("Are you sure you want to kill this room? ");
811 if (yesno()==0) return;
815 printf("%s\n",&aaa[4]);
816 if (aaa[0]!='2') return;
817 dotgoto("_BASEROOM_",0);
820 void forget(void) { /* forget the current room */
823 printf("Are you sure you want to forget this room? ");
824 if (yesno()==0) return;
829 printf("%s\n",&cmd[4]);
833 /* now return to the lobby */
834 dotgoto("_BASEROOM_",0);
843 char new_room_name[ROOMNAMELEN];
845 char new_room_pass[10];
853 printf("%s\n",&cmd[4]);
857 newprompt("Name for new room? ",new_room_name,ROOMNAMELEN-1);
858 if (strlen(new_room_name)==0) return;
859 for (a=0; a<strlen(new_room_name); ++a)
860 if (new_room_name[a] == '|') new_room_name[a]='_';
862 new_room_floor = select_floor((int)curr_floor);
864 IFNEXPERT formout("roomaccess");
866 printf( "<?>Help\n<1>Public room\n<2>Guess-name room\n"
867 "<3>Passworded room\n<4>Invitation-only room\n"
868 "<5>Personal room\n");
869 printf("Enter room type: ");
872 } while (((b<'1')||(b>'5')) && (b!='?'));
875 formout("roomaccess");
877 } while ((b<'1')||(b>'5'));
880 new_room_type = b - 1;
881 if (new_room_type==2) {
882 newprompt("Enter a room password: ",new_room_pass,9);
883 for (a=0; a<strlen(new_room_pass); ++a)
884 if (new_room_pass[a] == '|') new_room_pass[a]='_';
886 else strcpy(new_room_pass,"");
888 printf("\042%s\042, a",new_room_name);
889 if (b==1) printf(" public room.");
890 if (b==2) printf(" guess-name room.");
891 if (b==3) printf(" passworded room, password: %s",new_room_pass);
892 if (b==4) printf("n invitation-only room.");
893 if (b==5) printf(" personal room.");
894 printf("\nInstall it? (y/n) : ");
898 snprintf(cmd, sizeof cmd, "CRE8 1|%s|%d|%s|%d", new_room_name,
899 new_room_type, new_room_pass, new_room_floor);
903 printf("%s\n",&cmd[4]);
907 /* command succeeded... now GO to the new room! */
908 dotgoto(new_room_name,0);
913 void readinfo(void) { /* read info file for current room */
920 if (cmd[0]!='1') return;
922 fmout(screenwidth,NULL,
923 ((userflags & US_PAGINATOR) ? 1 : 0),
929 * <W>ho knows room...
931 void whoknows(void) {
936 printf("%s\n",&buf[5]);
940 sttybbs(SB_YES_INTR);
941 while (serv_gets(buf), strncmp(buf,"000",3)) {
942 if (sigcaught==0) printf("%s\n",buf);
948 void do_edit(char *desc, char *read_cmd, char *check_cmd, char *write_cmd)
952 int b,cksum,editor_exit;
955 if (strlen(editor_path)==0) {
956 printf("Do you wish to re-enter %s? ",desc);
957 if (yesno()==0) return;
960 fp = fopen(temp,"w");
963 serv_puts(check_cmd);
966 printf("%s\n",&cmd[4]);
970 if (strlen(editor_path)>0) {
974 fp = fopen(temp,"w");
975 while (serv_gets(cmd), strcmp(cmd,"000")) {
976 fprintf(fp,"%s\n",cmd);
982 cksum = file_checksum(temp);
984 if (strlen(editor_path)>0) {
989 execlp(editor_path,editor_path,temp,NULL);
992 if (editor_pid>0) do {
994 b=wait(&editor_exit);
995 } while((b!=editor_pid)&&(b>=0));
997 printf("Executed %s\n", editor_path);
1001 printf("Entering %s. ",desc);
1002 printf("Press return twice when finished.\n");
1003 fp=fopen(temp,"r+");
1008 if (file_checksum(temp) == cksum) {
1009 printf("*** Aborted.\n");
1013 serv_puts(write_cmd);
1016 printf("%s\n",&cmd[4]);
1021 while (fgets(cmd,255,fp)!=NULL) {
1022 cmd[strlen(cmd)-1] = 0;
1033 void enterinfo(void) { /* edit info file for current room */
1034 do_edit("the Info file for this room","RINF","EINF 0","EINF 1");
1037 void enter_bio(void) {
1039 snprintf(cmd,sizeof cmd,"RBIO %s",fullname);
1040 do_edit("your Bio",cmd,"NOOP","EBIO");
1044 * create a new floor
1046 void create_floor(void) {
1048 char newfloorname[256];
1050 serv_puts("CFLR xx|0");
1053 printf("%s\n",&buf[4]);
1057 newprompt("Name for new floor: ",newfloorname,255);
1058 snprintf(buf,sizeof buf,"CFLR %s|1",newfloorname);
1062 printf("Floor has been created.\n");
1065 printf("%s\n",&buf[4]);
1070 * edit the current floor
1072 void edit_floor(void) {
1074 int expire_mode = 0;
1075 int expire_value = 0;
1077 if (floorlist[(int)curr_floor][0]==0) load_floorlist();
1079 /* Fetch the expire policy (this will silently fail on old servers,
1080 * resulting in "default" policy)
1082 serv_puts("GPEX floor");
1085 expire_mode = extract_int(&buf[4], 0);
1086 expire_value = extract_int(&buf[4], 1);
1089 /* Interact with the user */
1090 strprompt("Floor name",&floorlist[(int)curr_floor][0],255);
1092 /* Angels and demons dancing in my head... */
1094 sprintf(buf, "%d", expire_mode);
1095 strprompt("Floor default essage expire policy (? for list)",
1097 if (buf[0] == '?') {
1099 printf("0. Use the system default\n");
1100 printf("1. Never automatically expire messages\n");
1101 printf("2. Expire by message count\n");
1102 printf("3. Expire by message age\n");
1104 } while((buf[0]<48)||(buf[0]>51));
1105 expire_mode = buf[0] - 48;
1107 /* ...lunatics and monsters underneath my bed */
1108 if (expire_mode == 2) {
1109 sprintf(buf, "%d", expire_value);
1110 strprompt("Keep how many messages online?", buf, 10);
1111 expire_value = atol(buf);
1114 if (expire_mode == 3) {
1115 sprintf(buf, "%d", expire_value);
1116 strprompt("Keep messages for how many days?", buf, 10);
1117 expire_value = atol(buf);
1121 snprintf(buf, sizeof buf, "SPEX floor|%d|%d",
1122 expire_mode, expire_value);
1126 snprintf(buf,sizeof buf,"EFLR %d|%s",curr_floor,
1127 &floorlist[(int)curr_floor][0]);
1130 printf("%s\n",&buf[4]);
1138 * kill the current floor
1140 void kill_floor(void) {
1141 int floornum_to_delete,a;
1144 if (floorlist[(int)curr_floor][0]==0) load_floorlist();
1146 floornum_to_delete = (-1);
1147 printf("(Press return to abort)\n");
1148 newprompt("Delete which floor? ",buf,255);
1149 if (strlen(buf)==0) return;
1150 for (a=0; a<128; ++a)
1151 if (!strucmp(&floorlist[a][0],buf))
1152 floornum_to_delete = a;
1153 if (floornum_to_delete < 0) {
1154 printf("No such floor. Select one of:\n");
1155 for (a=0; a<128; ++a)
1156 if (floorlist[a][0]!=0)
1157 printf("%s\n",&floorlist[a][0]);
1159 } while (floornum_to_delete < 0);
1160 sprintf(buf,"KFLR %d|1",floornum_to_delete);
1163 printf("%s\n",&buf[4]);