5 * Client-side functions which perform room operations
17 #include <sys/types.h>
23 #include "citadel_ipc.h"
33 #define IFNEXPERT if ((userflags&US_EXPERT)==0)
36 void sttybbs(int cmd);
37 void hit_any_key(void);
39 void strprompt(char *prompt, char *str, int len);
40 void newprompt(char *prompt, char *str, int len);
41 void dotgoto(char *towhere, int display_name, int fromungoto);
42 void serv_read(char *buf, int bytes);
43 void formout(char *name);
45 void progress(long int curr, long int cmax);
46 int pattern(char *search, char *patn);
47 int file_checksum(char *filename);
48 int nukedir(char *dirname);
50 extern unsigned room_flags;
51 extern char room_name[];
53 extern char tempdir[];
54 extern int editor_pid;
55 extern char editor_path[];
56 extern int screenwidth;
57 extern int screenheight;
58 extern char fullname[];
60 extern char sigcaught;
61 extern char floor_mode;
62 extern char curr_floor;
67 extern char *uglist[];
68 extern long uglistlsn[];
69 extern int uglistsize;
71 extern char floorlist[128][SIZ];
74 void load_floorlist(void)
79 int r; /* IPC response code */
81 for (a = 0; a < 128; ++a)
84 r = CtdlIPCFloorListing(&listing, buf);
86 strcpy(floorlist[0], "Main Floor");
89 while (*listing && strlen(listing)) {
90 extract_token(buf, listing, 0, '\n');
91 strcpy(listing, &listing[strlen(buf) + 1]);
92 extract(floorlist[extract_int(buf, 0)], buf, 1);
97 void room_tree_list(struct roomlisting *rp)
100 char rmname[ROOMNAMELEN];
108 if (rp->lnext != NULL) {
109 room_tree_list(rp->lnext);
112 if (sigcaught == 0) {
113 strcpy(rmname, rp->rlname);
115 if ((c + strlen(rmname) + 4) > screenwidth) {
117 /* line break, check the paginator */
121 if (f & QR_MAILBOX) {
122 color(BRIGHT_YELLOW);
123 } else if (f & QR_PRIVATE) {
128 pprintf("%s", rmname);
129 if ((f & QR_DIRECTORY) && (f & QR_NETWORK))
131 else if (f & QR_DIRECTORY)
133 else if (f & QR_NETWORK)
137 c = c + strlen(rmname) + 3;
140 if (rp->rnext != NULL) {
141 room_tree_list(rp->rnext);
149 * Room ordering stuff (compare first by floor, then by order)
151 int rordercmp(struct roomlisting *r1, struct roomlisting *r2)
153 if ((r1 == NULL) && (r2 == NULL))
159 if (r1->rlfloor < r2->rlfloor)
161 if (r1->rlfloor > r2->rlfloor)
163 if (r1->rlorder < r2->rlorder)
165 if (r1->rlorder > r2->rlorder)
172 * Common code for all room listings
174 void listrms(char *variety)
178 struct roomlisting *rl = NULL;
179 struct roomlisting *rp;
180 struct roomlisting *rs;
183 /* Ask the server for a room list */
189 while (serv_gets(buf), strcmp(buf, "000")) {
190 rp = malloc(sizeof(struct roomlisting));
191 extract(rp->rlname, buf, 0);
192 rp->rlflags = extract_int(buf, 1);
193 rp->rlfloor = extract_int(buf, 2);
194 rp->rlorder = extract_int(buf, 3);
203 if (rordercmp(rp, rs) < 0) {
204 if (rs->lnext == NULL) {
211 if (rs->rnext == NULL) {
222 room_tree_list(NULL);
228 void list_other_floors(void)
233 for (a = 0; a < 128; ++a) {
234 if ((strlen(floorlist[a]) > 0) && (a != curr_floor)) {
235 if ((c + strlen(floorlist[a]) + 4) > screenwidth) {
239 pprintf("%s: ", floorlist[a]);
240 c = c + strlen(floorlist[a]) + 3;
247 * List known rooms. kn_floor_mode should be set to 0 for a 'flat' listing,
248 * 1 to list rooms on the current floor, or 1 to list rooms on all floors.
250 void knrooms(int kn_floor_mode)
257 if (kn_floor_mode == 0) {
259 pprintf("\n Rooms with unread messages:\n");
262 pprintf("\n\n No unseen messages in:\n");
267 if (kn_floor_mode == 1) {
269 pprintf("\n Rooms with unread messages on %s:\n",
270 floorlist[(int) curr_floor]);
271 snprintf(buf, sizeof buf, "LKRN %d", curr_floor);
274 pprintf("\n\n Rooms with no new messages on %s:\n",
275 floorlist[(int) curr_floor]);
276 snprintf(buf, sizeof buf, "LKRO %d", curr_floor);
279 pprintf("\n\n Other floors:\n");
284 if (kn_floor_mode == 2) {
285 for (a = 0; a < 128; ++a) {
286 if (floorlist[a][0] != 0) {
288 pprintf("\n Rooms on %s:\n",
290 snprintf(buf, sizeof buf, "LKRA %d", a);
298 IFNEXPERT hit_any_key();
302 void listzrooms(void)
303 { /* list public forgotten rooms */
305 pprintf("\n Forgotten public rooms:\n");
309 IFNEXPERT hit_any_key();
313 int set_room_attr(int ibuf, char *prompt, unsigned int sbit)
317 a = boolprompt(prompt, (ibuf & sbit));
318 ibuf = (ibuf | sbit);
320 ibuf = (ibuf ^ sbit);
328 * Select a floor (used in several commands)
329 * The supplied argument is the 'default' floor number.
330 * This function returns the selected floor number.
332 int select_floor(int rfloor)
337 if (floor_mode == 1) {
338 if (floorlist[(int) curr_floor][0] == 0) {
344 safestrncpy(floorstr, floorlist[rfloor],
346 strprompt("Which floor", floorstr, SIZ);
347 for (a = 0; a < 128; ++a) {
349 (floorstr, &floorlist[a][0]))
354 (floorstr, &floorlist[a][0],
358 && (pattern(&floorlist[a][0], floorstr)
363 scr_printf("\n One of:\n");
364 for (a = 0; a < 128; ++a) {
365 if (floorlist[a][0] != 0) {
371 } while (newfloor < 0);
381 * .<A>ide <E>dit room
383 void editthisroom(void)
385 char rname[ROOMNAMELEN];
395 int expire_value = 0;
397 /* Fetch the existing room config */
401 scr_printf("%s\n", &buf[4]);
405 extract(rname, &buf[4], 0);
406 extract(rpass, &buf[4], 1);
407 extract(rdir, &buf[4], 2);
408 rflags = extract_int(&buf[4], 3);
409 rfloor = extract_int(&buf[4], 4);
410 rorder = extract_int(&buf[4], 5);
413 /* Fetch the name of the current room aide */
417 safestrncpy(raide, &buf[4], sizeof raide);
422 if (strlen(raide) == 0) {
423 strcpy(raide, "none");
426 /* Fetch the expire policy (this will silently fail on old servers,
427 * resulting in "default" policy)
429 serv_puts("GPEX room");
432 expire_mode = extract_int(&buf[4], 0);
433 expire_value = extract_int(&buf[4], 1);
436 /* Now interact with the user. */
437 strprompt("Room name", rname, ROOMNAMELEN - 1);
439 rfloor = select_floor(rfloor);
440 rflags = set_room_attr(rflags, "Private room", QR_PRIVATE);
441 if (rflags & QR_PRIVATE) {
442 rflags = set_room_attr(rflags,
443 "Accessible by guessing room name",
447 /* if it's public, clear the privacy classes */
448 if ((rflags & QR_PRIVATE) == 0) {
449 if (rflags & QR_GUESSNAME) {
450 rflags = rflags - QR_GUESSNAME;
452 if (rflags & QR_PASSWORDED) {
453 rflags = rflags - QR_PASSWORDED;
457 /* if it's private, choose the privacy classes */
458 if ((rflags & QR_PRIVATE)
459 && ((rflags & QR_GUESSNAME) == 0)) {
460 rflags = set_room_attr(rflags,
461 "Accessible by entering a password",
464 if ((rflags & QR_PRIVATE)
465 && ((rflags & QR_PASSWORDED) == QR_PASSWORDED)) {
466 strprompt("Room password", rpass, 9);
469 if ((rflags & QR_PRIVATE) == QR_PRIVATE) {
471 boolprompt("Cause current users to forget room", 0);
475 set_room_attr(rflags, "Preferred users only", QR_PREFONLY);
476 rflags = set_room_attr(rflags, "Read-only room", QR_READONLY);
477 rflags = set_room_attr(rflags, "Directory room", QR_DIRECTORY);
478 rflags = set_room_attr(rflags, "Permanent room", QR_PERMANENT);
479 if (rflags & QR_DIRECTORY) {
480 strprompt("Directory name", rdir, 14);
482 set_room_attr(rflags, "Uploading allowed", QR_UPLOAD);
484 set_room_attr(rflags, "Downloading allowed",
487 set_room_attr(rflags, "Visible directory", QR_VISDIR);
489 rflags = set_room_attr(rflags, "Network shared room", QR_NETWORK);
490 rflags = set_room_attr(rflags,
491 "Automatically make all messages anonymous",
493 if ((rflags & QR_ANONONLY) == 0) {
494 rflags = set_room_attr(rflags,
495 "Ask users whether to make messages anonymous",
498 rorder = intprompt("Listing order", rorder, 1, 127);
500 /* Ask about the room aide */
502 strprompt("Room aide (or 'none')", raide, 29);
503 if (!strcasecmp(raide, "none")) {
507 r = CtdlIPCQueryUsername(raide, buf);
509 scr_printf("%s\n", buf);
511 } while (r / 100 != 2);
513 /* FIXME: Duplicate code??? */
514 if (!strcasecmp(raide, "none")) {
518 /* Angels and demons dancing in my head... */
520 snprintf(buf, sizeof buf, "%d", expire_mode);
521 strprompt("Message expire policy (? for list)", buf, 1);
524 "0. Use the default for this floor\n"
525 "1. Never automatically expire messages\n"
526 "2. Expire by message count\n"
527 "3. Expire by message age\n");
529 } while ((buf[0] < 48) || (buf[0] > 51));
530 expire_mode = buf[0] - 48;
532 /* ...lunatics and monsters underneath my bed */
533 if (expire_mode == 2) {
534 snprintf(buf, sizeof buf, "%d", expire_value);
535 strprompt("Keep how many messages online?", buf, 10);
536 expire_value = atol(buf);
539 if (expire_mode == 3) {
540 snprintf(buf, sizeof buf, "%d", expire_value);
541 strprompt("Keep messages for how many days?", buf, 10);
542 expire_value = atol(buf);
545 /* Give 'em a chance to change their minds */
546 scr_printf("Save changes (y/n)? ");
549 r = CtdlIPCSetRoomAide(raide, buf);
551 scr_printf("%s\n", buf);
554 r = CtdlIPCSetMessageExpirationPolicy(0, expire_mode,
557 snprintf(buf, sizeof buf, "SETR %s|%s|%s|%d|%d|%d|%d",
558 rname, rpass, rdir, rflags, rbump, rfloor,
562 scr_printf("%s\n", &buf[4]);
564 dotgoto(rname, 2, 0);
570 * un-goto the previous room
575 int r; /* IPC response code */
580 snprintf(buf, sizeof buf, "GOTO %s", uglist[uglistsize-1]);
584 scr_printf("%s\n", &buf[4]);
587 snprintf(buf, sizeof buf, "SLRP %ld", uglistlsn[uglistsize-1]);
591 scr_printf("%s\n", &buf[4]);
593 safestrncpy (buf, uglist[uglistsize-1], sizeof(buf));
595 free(uglist[uglistsize]);
596 dotgoto(buf, 0, 1); /* Don't queue ungoto info or we end up in a loop */
600 /* Here's the code for simply transferring the file to the client,
601 * for folks who have their own clientware. It's a lot simpler than
602 * the [XYZ]modem code below...
603 * (This function assumes that a download file is already open on the server)
605 void download_to_local_disk(char *supplied_filename, long total_bytes)
609 long transmitted_bytes = 0L;
616 strcpy(filename, supplied_filename);
617 if (strlen(filename) == 0) {
618 newprompt("Filename: ", filename, 250);
621 scr_printf("Enter the name of the directory to save '%s'\n"
622 "to, or press return for the current directory.\n", filename);
623 newprompt("Directory: ", dbuf, sizeof dbuf);
624 if (strlen(dbuf) == 0)
627 strcat(dbuf, filename);
629 savefp = fopen(dbuf, "w");
630 if (savefp == NULL) {
631 scr_printf("Cannot open '%s': %s\n", dbuf, strerror(errno));
632 /* close the download file at the server */
636 scr_printf("%s\n", &buf[4]);
640 progress(0, total_bytes);
641 while ((transmitted_bytes < total_bytes) && (broken == 0)) {
642 bb = total_bytes - transmitted_bytes;
643 aa = ((bb < 4096) ? bb : 4096);
644 snprintf(buf, sizeof buf, "READ %ld|%ld", transmitted_bytes, aa);
648 scr_printf("%s\n", &buf[4]);
651 packet = extract_int(&buf[4], 0);
652 serv_read(dbuf, packet);
653 if (fwrite(dbuf, packet, 1, savefp) < 1)
655 transmitted_bytes = transmitted_bytes + (long) packet;
656 progress(transmitted_bytes, total_bytes);
659 /* close the download file at the server */
663 scr_printf("%s\n", &buf[4]);
670 * download() - download a file or files. The argument passed to this
671 * function determines which protocol to use.
672 * proto - 0 = paginate, 1 = xmodem, 2 = raw, 3 = ymodem, 4 = zmodem, 5 = save
674 void download(int proto)
679 char transmit_cmd[SIZ];
680 long total_bytes = 0L;
682 long transmitted_bytes = 0L;
688 if ((room_flags & QR_DOWNLOAD) == 0) {
689 scr_printf("*** You cannot download from this room.\n");
693 newprompt("Enter filename: ", filename, 255);
695 snprintf(buf, sizeof buf, "OPEN %s", filename);
699 scr_printf("%s\n", &buf[4]);
702 total_bytes = extract_long(&buf[4], 0);
704 /* Save to local disk, for folks with their own copy of the client */
706 download_to_local_disk(filename, total_bytes);
710 /* Meta-download for public clients */
711 scr_printf("Fetching file from Citadel server...\n");
712 mkdir(tempdir, 0700);
713 snprintf(tempname, sizeof tempname, "%s/%s", tempdir, filename);
714 tpipe = fopen(tempname, "wb");
715 while ((transmitted_bytes < total_bytes) && (broken == 0)) {
716 progress(transmitted_bytes, total_bytes);
717 bb = total_bytes - transmitted_bytes;
718 aa = ((bb < 4096) ? bb : 4096);
719 snprintf(buf, sizeof buf, "READ %ld|%ld", transmitted_bytes, aa);
723 scr_printf("%s\n", &buf[4]);
725 packet = extract_int(&buf[4], 0);
726 serv_read(dbuf, packet);
727 if (fwrite(dbuf, packet, 1, tpipe) < 1) {
730 transmitted_bytes = transmitted_bytes + (long) packet;
733 progress(transmitted_bytes, total_bytes);
735 /* close the download file at the server */
739 scr_printf("%s\n", &buf[4]);
743 snprintf(transmit_cmd, sizeof transmit_cmd,
744 "SHELL=/dev/null; export SHELL; TERM=dumb; export TERM; exec more -d <%s",
748 snprintf(transmit_cmd, sizeof transmit_cmd, "exec sx %s", tempname);
750 snprintf(transmit_cmd, sizeof transmit_cmd, "exec sb %s", tempname);
752 snprintf(transmit_cmd, sizeof transmit_cmd, "exec sz %s", tempname);
754 snprintf(transmit_cmd, sizeof transmit_cmd, "exec cat %s", tempname);
758 system(transmit_cmd);
762 /* clean up the temporary directory */
769 * read directory of this room
781 pprintf("%s\n", &buf[4]);
785 extract(comment, &buf[4], 0);
786 extract(flnm, &buf[4], 1);
787 pprintf("\nDirectory of %s on %s\n", flnm, comment);
788 pprintf("-----------------------\n");
789 while (serv_gets(buf), strcmp(buf, "000")) {
790 extract(flnm, buf, 0);
791 extract(flsz, buf, 1);
792 extract(comment, buf, 2);
793 if (strlen(flnm) <= 14)
794 pprintf("%-14s %8s %s\n", flnm, flsz, comment);
796 pprintf("%s\n%14s %8s %s\n", flnm, "", flsz,
803 * add a user to a private room
807 char username[USERNAME_SIZE];
809 int r; /* IPC response code */
811 newprompt("Name of user? ", username, USERNAME_SIZE);
812 if (username[0] == 0)
815 r = CtdlIPCInviteUserToRoom(username, buf);
816 scr_printf("%s\n", buf);
821 * kick a user out of a room
825 char username[USERNAME_SIZE];
827 int r; /* IPC response code */
829 newprompt("Name of user? ", username, USERNAME_SIZE);
830 if (username[0] == 0)
833 r = CtdlIPCKickoutUserFromRoom(username, buf);
834 scr_printf("%s\n", buf);
839 * aide command: kill the current room
846 r = CtdlIPCDeleteRoom(0, aaa);
848 scr_printf("%s\n", aaa);
852 scr_printf("Are you sure you want to kill this room? ");
856 r = CtdlIPCDeleteRoom(1, aaa);
857 scr_printf("%s\n", aaa);
860 dotgoto("_BASEROOM_", 0, 0);
864 { /* forget the current room */
867 scr_printf("Are you sure you want to forget this room? ");
871 if (CtdlIPCForgetRoom(buf) / 100 != 2) {
872 scr_printf("%s\n", buf);
876 /* now return to the lobby */
877 dotgoto("_BASEROOM_", 0, 0);
887 char new_room_name[ROOMNAMELEN];
889 char new_room_pass[10];
892 int r; /* IPC response code */
894 /* Check permission to create room */
895 r = CtdlIPCCreateRoom(0, "", 1, "", 0, buf);
897 scr_printf("%s\n", buf);
901 newprompt("Name for new room? ", new_room_name, ROOMNAMELEN - 1);
902 if (strlen(new_room_name) == 0) {
905 for (a = 0; a < strlen(new_room_name); ++a) {
906 if (new_room_name[a] == '|') {
907 new_room_name[a] = '_';
911 new_room_floor = select_floor((int) curr_floor);
913 IFNEXPERT formout("roomaccess");
915 scr_printf("<?>Help\n<1>Public room\n<2>Guess-name room\n"
916 "<3>Passworded room\n<4>Invitation-only room\n"
918 "Enter room type: ");
921 } while (((b < '1') || (b > '5')) && (b != '?'));
924 formout("roomaccess");
926 } while ((b < '1') || (b > '5'));
927 b -= '0'; /* Portable */
928 scr_printf("%d\n", b);
929 new_room_type = b - 1;
930 if (new_room_type == 2) {
931 newprompt("Enter a room password: ", new_room_pass, 9);
932 for (a = 0; a < strlen(new_room_pass); ++a)
933 if (new_room_pass[a] == '|')
934 new_room_pass[a] = '_';
936 strcpy(new_room_pass, "");
939 scr_printf("\042%s\042, a", new_room_name);
941 scr_printf(" public room.");
943 scr_printf(" guess-name room.");
945 scr_printf(" passworded room, password: %s", new_room_pass);
947 scr_printf("n invitation-only room.");
949 scr_printf(" personal room.");
950 scr_printf("\nInstall it? (y/n) : ");
955 r = CtdlIPCCreateRoom(1, new_room_name, new_room_type,
956 new_room_pass, new_room_floor, buf);
958 scr_printf("%s\n", buf);
962 /* command succeeded... now GO to the new room! */
963 dotgoto(new_room_name, 0, 0);
969 { /* read info file for current room */
972 int r; /* IPC response code */
975 /* Name of currernt room aide */
976 r = CtdlIPCGetRoomAide(buf);
978 safestrncpy(raide, buf, sizeof raide);
982 if (strlen(raide) > 0)
983 scr_printf("Room aide is %s.\n\n", raide);
985 r = CtdlIPCRoomInfo(&text, buf);
990 fmout(screenwidth, NULL, text, NULL,
991 ((userflags & US_PAGINATOR) ? 1 : 0), screenheight,
992 (*raide) ? 2 : 0, 1);
999 * <W>ho knows room...
1006 if (buf[0] != '1') {
1007 pprintf("%s\n", &buf[4]);
1010 while (serv_gets(buf), strncmp(buf, "000", 3)) {
1012 pprintf("%s\n", buf);
1017 void do_edit(char *desc, char *read_cmd, char *check_cmd, char *write_cmd)
1021 int b, cksum, editor_exit;
1024 if (strlen(editor_path) == 0) {
1025 scr_printf("Do you wish to re-enter %s? ", desc);
1030 fp = fopen(temp, "w");
1033 serv_puts(check_cmd);
1035 if (cmd[0] != '2') {
1036 scr_printf("%s\n", &cmd[4]);
1040 if (strlen(editor_path) > 0) {
1041 serv_puts(read_cmd);
1043 if (cmd[0] == '1') {
1044 fp = fopen(temp, "w");
1045 while (serv_gets(cmd), strcmp(cmd, "000")) {
1046 fprintf(fp, "%s\n", cmd);
1052 cksum = file_checksum(temp);
1054 if (strlen(editor_path) > 0) {
1057 snprintf(tmp, sizeof tmp, "WINDOW_TITLE=%s", desc);
1059 editor_pid = fork();
1060 if (editor_pid == 0) {
1063 sttybbs(SB_RESTORE);
1064 execlp(editor_path, editor_path, temp, NULL);
1070 b = wait(&editor_exit);
1071 } while ((b != editor_pid) && (b >= 0));
1073 scr_printf("Executed %s\n", editor_path);
1077 scr_printf("Entering %s. "
1078 "Press return twice when finished.\n", desc);
1079 fp = fopen(temp, "r+");
1084 if (file_checksum(temp) == cksum) {
1085 scr_printf("*** Aborted.\n");
1089 serv_puts(write_cmd);
1091 if (cmd[0] != '4') {
1092 scr_printf("%s\n", &cmd[4]);
1096 fp = fopen(temp, "r");
1097 while (fgets(cmd, SIZ - 1, fp) != NULL) {
1098 cmd[strlen(cmd) - 1] = 0;
1109 void enterinfo(void)
1110 { /* edit info file for current room */
1111 do_edit("the Info file for this room", "RINF", "EINF 0", "EINF 1");
1114 void enter_bio(void)
1117 snprintf(cmd, sizeof cmd, "RBIO %s", fullname);
1118 do_edit("your Bio", cmd, "NOOP", "EBIO");
1122 * create a new floor
1124 void create_floor(void)
1127 char newfloorname[SIZ];
1128 int r; /* IPC response code */
1132 r = CtdlIPCCreateFloor(0, "", buf);
1134 scr_printf("%s\n", buf);
1138 newprompt("Name for new floor: ", newfloorname, 255);
1139 r = CtdlIPCCreateFloor(1, newfloorname, buf);
1141 scr_printf("Floor has been created.\n");
1143 scr_printf("%s\n", buf);
1150 * edit the current floor
1152 void edit_floor(void)
1155 int expire_mode = 0;
1156 int expire_value = 0;
1160 /* Fetch the expire policy (this will silently fail on old servers,
1161 * resulting in "default" policy)
1163 r = CtdlIPCGetMessageExpirationPolicy(1, buf);
1165 expire_mode = extract_int(buf, 0);
1166 expire_value = extract_int(buf, 1);
1169 /* Interact with the user */
1170 strprompt("Floor name", &floorlist[(int) curr_floor][0], 255);
1172 /* Angels and demons dancing in my head... */
1174 snprintf(buf, sizeof buf, "%d", expire_mode);
1176 ("Floor default essage expire policy (? for list)",
1178 if (buf[0] == '?') {
1180 "0. Use the system default\n"
1181 "1. Never automatically expire messages\n"
1182 "2. Expire by message count\n"
1183 "3. Expire by message age\n");
1185 } while ((buf[0] < '0') || (buf[0] > '3'));
1186 expire_mode = buf[0] - '0';
1188 /* ...lunatics and monsters underneath my bed */
1189 if (expire_mode == 2) {
1190 snprintf(buf, sizeof buf, "%d", expire_value);
1191 strprompt("Keep how many messages online?", buf, 10);
1192 expire_value = atol(buf);
1195 if (expire_mode == 3) {
1196 snprintf(buf, sizeof buf, "%d", expire_value);
1197 strprompt("Keep messages for how many days?", buf, 10);
1198 expire_value = atol(buf);
1202 r = CtdlIPCSetMessageExpirationPolicy(1, expire_mode,
1204 r = CtdlIPCEditFloor(curr_floor, &floorlist[(int)curr_floor][0]);
1205 scr_printf("%s\n", buf);
1213 * kill the current floor
1215 void kill_floor(void)
1217 int floornum_to_delete, a;
1222 floornum_to_delete = (-1);
1223 scr_printf("(Press return to abort)\n");
1224 newprompt("Delete which floor? ", buf, 255);
1225 if (strlen(buf) == 0)
1227 for (a = 0; a < 128; ++a)
1228 if (!strcasecmp(&floorlist[a][0], buf))
1229 floornum_to_delete = a;
1230 if (floornum_to_delete < 0) {
1231 scr_printf("No such floor. Select one of:\n");
1232 for (a = 0; a < 128; ++a)
1233 if (floorlist[a][0] != 0)
1234 scr_printf("%s\n", &floorlist[a][0]);
1236 } while (floornum_to_delete < 0);
1237 CtdlIPCDeleteFloor(1, floornum_to_delete, buf);
1238 scr_printf("%s\n", buf);