5 * Client-side functions which perform room operations
17 #include <sys/types.h>
32 #define IFNEXPERT if ((userflags&US_EXPERT)==0)
35 void sttybbs(int cmd);
36 void hit_any_key(void);
38 void strprompt(char *prompt, char *str, int len);
39 void newprompt(char *prompt, char *str, int len);
40 void dotgoto(char *towhere, int display_name, int fromungoto);
41 void serv_read(char *buf, int bytes);
42 void formout(char *name);
44 void progress(long int curr, long int cmax);
45 int pattern(char *search, char *patn);
46 int file_checksum(char *filename);
47 int nukedir(char *dirname);
49 extern unsigned room_flags;
50 extern char room_name[];
52 extern char tempdir[];
53 extern int editor_pid;
54 extern char editor_path[];
55 extern int screenwidth;
56 extern int screenheight;
57 extern char fullname[];
59 extern char sigcaught;
60 extern char floor_mode;
61 extern char curr_floor;
66 extern char *uglist[];
67 extern long uglistlsn[];
68 extern int uglistsize;
70 extern char floorlist[128][SIZ];
73 void load_floorlist(void)
78 for (a = 0; a < 128; ++a)
84 strcpy(floorlist[0], "Main Floor");
87 while (serv_gets(buf), strcmp(buf, "000")) {
88 extract(floorlist[extract_int(buf, 0)], buf, 1);
93 void room_tree_list(struct roomlisting *rp)
96 char rmname[ROOMNAMELEN];
104 if (rp->lnext != NULL) {
105 room_tree_list(rp->lnext);
108 if (sigcaught == 0) {
109 strcpy(rmname, rp->rlname);
111 if ((c + strlen(rmname) + 4) > screenwidth) {
113 /* line break, check the paginator */
117 if (f & QR_MAILBOX) {
118 color(BRIGHT_YELLOW);
119 } else if (f & QR_PRIVATE) {
124 pprintf("%s", rmname);
125 if ((f & QR_DIRECTORY) && (f & QR_NETWORK))
127 else if (f & QR_DIRECTORY)
129 else if (f & QR_NETWORK)
133 c = c + strlen(rmname) + 3;
136 if (rp->rnext != NULL) {
137 room_tree_list(rp->rnext);
145 * Room ordering stuff (compare first by floor, then by order)
147 int rordercmp(struct roomlisting *r1, struct roomlisting *r2)
149 if ((r1 == NULL) && (r2 == NULL))
155 if (r1->rlfloor < r2->rlfloor)
157 if (r1->rlfloor > r2->rlfloor)
159 if (r1->rlorder < r2->rlorder)
161 if (r1->rlorder > r2->rlorder)
168 * Common code for all room listings
170 void listrms(char *variety)
174 struct roomlisting *rl = NULL;
175 struct roomlisting *rp;
176 struct roomlisting *rs;
179 /* Ask the server for a room list */
185 while (serv_gets(buf), strcmp(buf, "000")) {
186 rp = malloc(sizeof(struct roomlisting));
187 extract(rp->rlname, buf, 0);
188 rp->rlflags = extract_int(buf, 1);
189 rp->rlfloor = extract_int(buf, 2);
190 rp->rlorder = extract_int(buf, 3);
199 if (rordercmp(rp, rs) < 0) {
200 if (rs->lnext == NULL) {
207 if (rs->rnext == NULL) {
218 room_tree_list(NULL);
224 void list_other_floors(void)
229 for (a = 0; a < 128; ++a) {
230 if ((strlen(floorlist[a]) > 0) && (a != curr_floor)) {
231 if ((c + strlen(floorlist[a]) + 4) > screenwidth) {
235 pprintf("%s: ", floorlist[a]);
236 c = c + strlen(floorlist[a]) + 3;
243 * List known rooms. kn_floor_mode should be set to 0 for a 'flat' listing,
244 * 1 to list rooms on the current floor, or 1 to list rooms on all floors.
246 void knrooms(int kn_floor_mode)
253 if (kn_floor_mode == 0) {
255 pprintf("\n Rooms with unread messages:\n");
258 pprintf("\n\n No unseen messages in:\n");
263 if (kn_floor_mode == 1) {
265 pprintf("\n Rooms with unread messages on %s:\n",
266 floorlist[(int) curr_floor]);
267 snprintf(buf, sizeof buf, "LKRN %d", curr_floor);
270 pprintf("\n\n Rooms with no new messages on %s:\n",
271 floorlist[(int) curr_floor]);
272 snprintf(buf, sizeof buf, "LKRO %d", curr_floor);
275 pprintf("\n\n Other floors:\n");
280 if (kn_floor_mode == 2) {
281 for (a = 0; a < 128; ++a) {
282 if (floorlist[a][0] != 0) {
284 pprintf("\n Rooms on %s:\n",
286 snprintf(buf, sizeof buf, "LKRA %d", a);
294 IFNEXPERT hit_any_key();
298 void listzrooms(void)
299 { /* list public forgotten rooms */
301 pprintf("\n Forgotten public rooms:\n");
305 IFNEXPERT hit_any_key();
309 int set_room_attr(int ibuf, char *prompt, unsigned int sbit)
313 a = boolprompt(prompt, (ibuf & sbit));
314 ibuf = (ibuf | sbit);
316 ibuf = (ibuf ^ sbit);
324 * Select a floor (used in several commands)
325 * The supplied argument is the 'default' floor number.
326 * This function returns the selected floor number.
328 int select_floor(int rfloor)
333 if (floor_mode == 1) {
334 if (floorlist[(int) curr_floor][0] == 0) {
340 safestrncpy(floorstr, floorlist[rfloor],
342 strprompt("Which floor", floorstr, SIZ);
343 for (a = 0; a < 128; ++a) {
345 (floorstr, &floorlist[a][0]))
350 (floorstr, &floorlist[a][0],
354 && (pattern(&floorlist[a][0], floorstr)
359 scr_printf("\n One of:\n");
360 for (a = 0; a < 128; ++a) {
361 if (floorlist[a][0] != 0) {
367 } while (newfloor < 0);
377 * .<A>ide <E>dit room
379 void editthisroom(void)
381 char rname[ROOMNAMELEN];
391 int expire_value = 0;
393 /* Fetch the existing room config */
397 scr_printf("%s\n", &buf[4]);
401 extract(rname, &buf[4], 0);
402 extract(rpass, &buf[4], 1);
403 extract(rdir, &buf[4], 2);
404 rflags = extract_int(&buf[4], 3);
405 rfloor = extract_int(&buf[4], 4);
406 rorder = extract_int(&buf[4], 5);
409 /* Fetch the name of the current room aide */
413 safestrncpy(raide, &buf[4], sizeof raide);
418 if (strlen(raide) == 0) {
419 strcpy(raide, "none");
422 /* Fetch the expire policy (this will silently fail on old servers,
423 * resulting in "default" policy)
425 serv_puts("GPEX room");
428 expire_mode = extract_int(&buf[4], 0);
429 expire_value = extract_int(&buf[4], 1);
432 /* Now interact with the user. */
433 strprompt("Room name", rname, ROOMNAMELEN - 1);
435 rfloor = select_floor(rfloor);
436 rflags = set_room_attr(rflags, "Private room", QR_PRIVATE);
437 if (rflags & QR_PRIVATE) {
438 rflags = set_room_attr(rflags,
439 "Accessible by guessing room name",
443 /* if it's public, clear the privacy classes */
444 if ((rflags & QR_PRIVATE) == 0) {
445 if (rflags & QR_GUESSNAME) {
446 rflags = rflags - QR_GUESSNAME;
448 if (rflags & QR_PASSWORDED) {
449 rflags = rflags - QR_PASSWORDED;
453 /* if it's private, choose the privacy classes */
454 if ((rflags & QR_PRIVATE)
455 && ((rflags & QR_GUESSNAME) == 0)) {
456 rflags = set_room_attr(rflags,
457 "Accessible by entering a password",
460 if ((rflags & QR_PRIVATE)
461 && ((rflags & QR_PASSWORDED) == QR_PASSWORDED)) {
462 strprompt("Room password", rpass, 9);
465 if ((rflags & QR_PRIVATE) == QR_PRIVATE) {
467 boolprompt("Cause current users to forget room", 0);
471 set_room_attr(rflags, "Preferred users only", QR_PREFONLY);
472 rflags = set_room_attr(rflags, "Read-only room", QR_READONLY);
473 rflags = set_room_attr(rflags, "Directory room", QR_DIRECTORY);
474 rflags = set_room_attr(rflags, "Permanent room", QR_PERMANENT);
475 if (rflags & QR_DIRECTORY) {
476 strprompt("Directory name", rdir, 14);
478 set_room_attr(rflags, "Uploading allowed", QR_UPLOAD);
480 set_room_attr(rflags, "Downloading allowed",
483 set_room_attr(rflags, "Visible directory", QR_VISDIR);
485 rflags = set_room_attr(rflags, "Network shared room", QR_NETWORK);
486 rflags = set_room_attr(rflags,
487 "Automatically make all messages anonymous",
489 if ((rflags & QR_ANONONLY) == 0) {
490 rflags = set_room_attr(rflags,
491 "Ask users whether to make messages anonymous",
494 rorder = intprompt("Listing order", rorder, 1, 127);
496 /* Ask about the room aide */
498 strprompt("Room aide (or 'none')", raide, 29);
499 if (!strcasecmp(raide, "none")) {
503 snprintf(buf, sizeof buf, "QUSR %s", raide);
507 scr_printf("%s\n", &buf[4]);
509 } while (buf[0] != '2');
511 if (!strcasecmp(raide, "none")) {
516 /* Angels and demons dancing in my head... */
518 snprintf(buf, sizeof buf, "%d", expire_mode);
519 strprompt("Message expire policy (? for list)", buf, 1);
522 "0. Use the default for this floor\n"
523 "1. Never automatically expire messages\n"
524 "2. Expire by message count\n"
525 "3. Expire by message age\n");
527 } while ((buf[0] < 48) || (buf[0] > 51));
528 expire_mode = buf[0] - 48;
530 /* ...lunatics and monsters underneath my bed */
531 if (expire_mode == 2) {
532 snprintf(buf, sizeof buf, "%d", expire_value);
533 strprompt("Keep how many messages online?", buf, 10);
534 expire_value = atol(buf);
537 if (expire_mode == 3) {
538 snprintf(buf, sizeof buf, "%d", expire_value);
539 strprompt("Keep messages for how many days?", buf, 10);
540 expire_value = atol(buf);
543 /* Give 'em a chance to change their minds */
544 scr_printf("Save changes (y/n)? ");
547 snprintf(buf, sizeof buf, "SETA %s", raide);
551 scr_printf("%s\n", &buf[4]);
554 snprintf(buf, sizeof buf, "SPEX room|%d|%d",
555 expire_mode, expire_value);
559 snprintf(buf, sizeof buf, "SETR %s|%s|%s|%d|%d|%d|%d",
560 rname, rpass, rdir, rflags, rbump, rfloor,
564 scr_printf("%s\n", &buf[4]);
566 dotgoto(rname, 2, 0);
572 * un-goto the previous room
579 snprintf(buf, sizeof buf, "GOTO %s", uglist[uglistsize-1]);
583 scr_printf("%s\n", &buf[4]);
586 snprintf(buf, sizeof buf, "SLRP %ld", uglistlsn[uglistsize-1]);
590 scr_printf("%s\n", &buf[4]);
592 safestrncpy (buf, uglist[uglistsize-1], sizeof(buf));
594 free(uglist[uglistsize]);
595 dotgoto(buf, 0, 1); /* Don't queue ungoto info or we end up in a loop */
599 /* Here's the code for simply transferring the file to the client,
600 * for folks who have their own clientware. It's a lot simpler than
601 * the [XYZ]modem code below...
602 * (This function assumes that a download file is already open on the server)
604 void download_to_local_disk(char *supplied_filename, long total_bytes)
608 long transmitted_bytes = 0L;
615 strcpy(filename, supplied_filename);
616 if (strlen(filename) == 0) {
617 newprompt("Filename: ", filename, 250);
620 scr_printf("Enter the name of the directory to save '%s'\n"
621 "to, or press return for the current directory.\n", filename);
622 newprompt("Directory: ", dbuf, sizeof dbuf);
623 if (strlen(dbuf) == 0)
626 strcat(dbuf, filename);
628 savefp = fopen(dbuf, "w");
629 if (savefp == NULL) {
630 scr_printf("Cannot open '%s': %s\n", dbuf, strerror(errno));
631 /* close the download file at the server */
635 scr_printf("%s\n", &buf[4]);
639 progress(0, total_bytes);
640 while ((transmitted_bytes < total_bytes) && (broken == 0)) {
641 bb = total_bytes - transmitted_bytes;
642 aa = ((bb < 4096) ? bb : 4096);
643 snprintf(buf, sizeof buf, "READ %ld|%ld", transmitted_bytes, aa);
647 scr_printf("%s\n", &buf[4]);
650 packet = extract_int(&buf[4], 0);
651 serv_read(dbuf, packet);
652 if (fwrite(dbuf, packet, 1, savefp) < 1)
654 transmitted_bytes = transmitted_bytes + (long) packet;
655 progress(transmitted_bytes, total_bytes);
658 /* close the download file at the server */
662 scr_printf("%s\n", &buf[4]);
669 * download() - download a file or files. The argument passed to this
670 * function determines which protocol to use.
671 * proto - 0 = paginate, 1 = xmodem, 2 = raw, 3 = ymodem, 4 = zmodem, 5 = save
673 void download(int proto)
678 char transmit_cmd[SIZ];
679 long total_bytes = 0L;
681 long transmitted_bytes = 0L;
687 if ((room_flags & QR_DOWNLOAD) == 0) {
688 scr_printf("*** You cannot download from this room.\n");
692 newprompt("Enter filename: ", filename, 255);
694 snprintf(buf, sizeof buf, "OPEN %s", filename);
698 scr_printf("%s\n", &buf[4]);
701 total_bytes = extract_long(&buf[4], 0);
703 /* Save to local disk, for folks with their own copy of the client */
705 download_to_local_disk(filename, total_bytes);
709 /* Meta-download for public clients */
710 scr_printf("Fetching file from Citadel server...\n");
711 mkdir(tempdir, 0700);
712 snprintf(tempname, sizeof tempname, "%s/%s", tempdir, filename);
713 tpipe = fopen(tempname, "wb");
714 while ((transmitted_bytes < total_bytes) && (broken == 0)) {
715 progress(transmitted_bytes, total_bytes);
716 bb = total_bytes - transmitted_bytes;
717 aa = ((bb < 4096) ? bb : 4096);
718 snprintf(buf, sizeof buf, "READ %ld|%ld", transmitted_bytes, aa);
722 scr_printf("%s\n", &buf[4]);
724 packet = extract_int(&buf[4], 0);
725 serv_read(dbuf, packet);
726 if (fwrite(dbuf, packet, 1, tpipe) < 1) {
729 transmitted_bytes = transmitted_bytes + (long) packet;
732 progress(transmitted_bytes, total_bytes);
734 /* close the download file at the server */
738 scr_printf("%s\n", &buf[4]);
742 snprintf(transmit_cmd, sizeof transmit_cmd,
743 "SHELL=/dev/null; export SHELL; TERM=dumb; export TERM; exec more -d <%s",
747 snprintf(transmit_cmd, sizeof transmit_cmd, "exec sx %s", tempname);
749 snprintf(transmit_cmd, sizeof transmit_cmd, "exec sb %s", tempname);
751 snprintf(transmit_cmd, sizeof transmit_cmd, "exec sz %s", tempname);
753 snprintf(transmit_cmd, sizeof transmit_cmd, "exec cat %s", tempname);
757 system(transmit_cmd);
761 /* clean up the temporary directory */
768 * read directory of this room
780 pprintf("%s\n", &buf[4]);
784 extract(comment, &buf[4], 0);
785 extract(flnm, &buf[4], 1);
786 pprintf("\nDirectory of %s on %s\n", flnm, comment);
787 pprintf("-----------------------\n");
788 while (serv_gets(buf), strcmp(buf, "000")) {
789 extract(flnm, buf, 0);
790 extract(flsz, buf, 1);
791 extract(comment, buf, 2);
792 if (strlen(flnm) <= 14)
793 pprintf("%-14s %8s %s\n", flnm, flsz, comment);
795 pprintf("%s\n%14s %8s %s\n", flnm, "", flsz,
802 * add a user to a private room
806 char aaa[31], bbb[SIZ];
808 /* Because kicking people out of public rooms now sets a LOCKOUT
809 * flag, we need to be able to invite people into public rooms
810 * in order to let them back in again.
815 * if ((room_flags & QR_PRIVATE)==0) {
816 * scr_printf("This is not a private room.\n");
821 newprompt("Name of user? ", aaa, 30);
825 snprintf(bbb, sizeof bbb, "INVT %s", aaa);
828 scr_printf("%s\n", &bbb[4]);
833 * kick a user out of a room
837 char username[31], cmd[SIZ];
839 newprompt("Name of user? ", username, 30);
840 if (strlen(username) == 0) {
844 snprintf(cmd, sizeof cmd, "KICK %s", username);
847 scr_printf("%s\n", &cmd[4]);
852 * aide command: kill the current room
861 scr_printf("%s\n", &aaa[4]);
865 scr_printf("Are you sure you want to kill this room? ");
871 scr_printf("%s\n", &aaa[4]);
874 dotgoto("_BASEROOM_", 0, 0);
878 { /* forget the current room */
881 scr_printf("Are you sure you want to forget this room? ");
888 scr_printf("%s\n", &cmd[4]);
892 /* now return to the lobby */
893 dotgoto("_BASEROOM_", 0, 0);
903 char new_room_name[ROOMNAMELEN];
905 char new_room_pass[10];
913 scr_printf("%s\n", &cmd[4]);
917 newprompt("Name for new room? ", new_room_name, ROOMNAMELEN - 1);
918 if (strlen(new_room_name) == 0) {
921 for (a = 0; a < strlen(new_room_name); ++a) {
922 if (new_room_name[a] == '|') {
923 new_room_name[a] = '_';
927 new_room_floor = select_floor((int) curr_floor);
929 IFNEXPERT formout("roomaccess");
931 scr_printf("<?>Help\n<1>Public room\n<2>Guess-name room\n"
932 "<3>Passworded room\n<4>Invitation-only room\n"
934 "Enter room type: ");
937 } while (((b < '1') || (b > '5')) && (b != '?'));
940 formout("roomaccess");
942 } while ((b < '1') || (b > '5'));
944 scr_printf("%d\n", b);
945 new_room_type = b - 1;
946 if (new_room_type == 2) {
947 newprompt("Enter a room password: ", new_room_pass, 9);
948 for (a = 0; a < strlen(new_room_pass); ++a)
949 if (new_room_pass[a] == '|')
950 new_room_pass[a] = '_';
952 strcpy(new_room_pass, "");
955 scr_printf("\042%s\042, a", new_room_name);
957 scr_printf(" public room.");
959 scr_printf(" guess-name room.");
961 scr_printf(" passworded room, password: %s", new_room_pass);
963 scr_printf("n invitation-only room.");
965 scr_printf(" personal room.");
966 scr_printf("\nInstall it? (y/n) : ");
971 snprintf(cmd, sizeof cmd, "CRE8 1|%s|%d|%s|%d", new_room_name,
972 new_room_type, new_room_pass, new_room_floor);
976 scr_printf("%s\n", &cmd[4]);
980 /* command succeeded... now GO to the new room! */
981 dotgoto(new_room_name, 0, 0);
987 { /* read info file for current room */
991 /* Name of currernt room aide */
995 safestrncpy(raide, &cmd[4], sizeof raide);
999 if (strlen(raide) > 0)
1000 scr_printf("Room aide is %s.\n\n", raide);
1005 if (cmd[0] != '1') {
1009 fmout(screenwidth, NULL, NULL,
1010 ((userflags & US_PAGINATOR) ? 1 : 0), screenheight,
1011 (*raide) ? 2 : 0, 1);
1016 * <W>ho knows room...
1023 if (buf[0] != '1') {
1024 pprintf("%s\n", &buf[4]);
1027 while (serv_gets(buf), strncmp(buf, "000", 3)) {
1029 pprintf("%s\n", buf);
1034 void do_edit(char *desc, char *read_cmd, char *check_cmd, char *write_cmd)
1038 int b, cksum, editor_exit;
1041 if (strlen(editor_path) == 0) {
1042 scr_printf("Do you wish to re-enter %s? ", desc);
1047 fp = fopen(temp, "w");
1050 serv_puts(check_cmd);
1052 if (cmd[0] != '2') {
1053 scr_printf("%s\n", &cmd[4]);
1057 if (strlen(editor_path) > 0) {
1058 serv_puts(read_cmd);
1060 if (cmd[0] == '1') {
1061 fp = fopen(temp, "w");
1062 while (serv_gets(cmd), strcmp(cmd, "000")) {
1063 fprintf(fp, "%s\n", cmd);
1069 cksum = file_checksum(temp);
1071 if (strlen(editor_path) > 0) {
1074 snprintf(tmp, sizeof tmp, "WINDOW_TITLE=%s", desc);
1076 editor_pid = fork();
1077 if (editor_pid == 0) {
1080 sttybbs(SB_RESTORE);
1081 execlp(editor_path, editor_path, temp, NULL);
1087 b = wait(&editor_exit);
1088 } while ((b != editor_pid) && (b >= 0));
1090 scr_printf("Executed %s\n", editor_path);
1094 scr_printf("Entering %s. "
1095 "Press return twice when finished.\n", desc);
1096 fp = fopen(temp, "r+");
1101 if (file_checksum(temp) == cksum) {
1102 scr_printf("*** Aborted.\n");
1106 serv_puts(write_cmd);
1108 if (cmd[0] != '4') {
1109 scr_printf("%s\n", &cmd[4]);
1113 fp = fopen(temp, "r");
1114 while (fgets(cmd, SIZ - 1, fp) != NULL) {
1115 cmd[strlen(cmd) - 1] = 0;
1126 void enterinfo(void)
1127 { /* edit info file for current room */
1128 do_edit("the Info file for this room", "RINF", "EINF 0", "EINF 1");
1131 void enter_bio(void)
1134 snprintf(cmd, sizeof cmd, "RBIO %s", fullname);
1135 do_edit("your Bio", cmd, "NOOP", "EBIO");
1139 * create a new floor
1141 void create_floor(void)
1144 char newfloorname[SIZ];
1148 serv_puts("CFLR xx|0");
1150 if (buf[0] != '2') {
1151 scr_printf("%s\n", &buf[4]);
1155 newprompt("Name for new floor: ", newfloorname, 255);
1156 snprintf(buf, sizeof buf, "CFLR %s|1", newfloorname);
1159 if (buf[0] == '2') {
1160 scr_printf("Floor has been created.\n");
1162 scr_printf("%s\n", &buf[4]);
1169 * edit the current floor
1171 void edit_floor(void)
1174 int expire_mode = 0;
1175 int expire_value = 0;
1179 /* Fetch the expire policy (this will silently fail on old servers,
1180 * resulting in "default" policy)
1182 serv_puts("GPEX floor");
1184 if (buf[0] == '2') {
1185 expire_mode = extract_int(&buf[4], 0);
1186 expire_value = extract_int(&buf[4], 1);
1189 /* Interact with the user */
1190 strprompt("Floor name", &floorlist[(int) curr_floor][0], 255);
1192 /* Angels and demons dancing in my head... */
1194 snprintf(buf, sizeof buf, "%d", expire_mode);
1196 ("Floor default essage expire policy (? for list)",
1198 if (buf[0] == '?') {
1200 "0. Use the system default\n"
1201 "1. Never automatically expire messages\n"
1202 "2. Expire by message count\n"
1203 "3. Expire by message age\n");
1205 } while ((buf[0] < 48) || (buf[0] > 51));
1206 expire_mode = buf[0] - 48;
1208 /* ...lunatics and monsters underneath my bed */
1209 if (expire_mode == 2) {
1210 snprintf(buf, sizeof buf, "%d", expire_value);
1211 strprompt("Keep how many messages online?", buf, 10);
1212 expire_value = atol(buf);
1215 if (expire_mode == 3) {
1216 snprintf(buf, sizeof buf, "%d", expire_value);
1217 strprompt("Keep messages for how many days?", buf, 10);
1218 expire_value = atol(buf);
1222 snprintf(buf, sizeof buf, "SPEX floor|%d|%d",
1223 expire_mode, expire_value);
1227 snprintf(buf, sizeof buf, "EFLR %d|%s", curr_floor,
1228 &floorlist[(int) curr_floor][0]);
1231 scr_printf("%s\n", &buf[4]);
1239 * kill the current floor
1241 void kill_floor(void)
1243 int floornum_to_delete, a;
1248 floornum_to_delete = (-1);
1249 scr_printf("(Press return to abort)\n");
1250 newprompt("Delete which floor? ", buf, 255);
1251 if (strlen(buf) == 0)
1253 for (a = 0; a < 128; ++a)
1254 if (!strcasecmp(&floorlist[a][0], buf))
1255 floornum_to_delete = a;
1256 if (floornum_to_delete < 0) {
1257 scr_printf("No such floor. Select one of:\n");
1258 for (a = 0; a < 128; ++a)
1259 if (floorlist[a][0] != 0)
1260 scr_printf("%s\n", &floorlist[a][0]);
1262 } while (floornum_to_delete < 0);
1263 snprintf(buf, sizeof buf, "KFLR %d|1", floornum_to_delete);
1266 scr_printf("%s\n", &buf[4]);