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 remove_token(listing, 0, '\n');
92 extract(floorlist[extract_int(buf, 0)], buf, 1);
98 void room_tree_list(struct roomlisting *rp)
101 char rmname[ROOMNAMELEN];
109 if (rp->lnext != NULL) {
110 room_tree_list(rp->lnext);
113 if (sigcaught == 0) {
114 strcpy(rmname, rp->rlname);
116 if ((c + strlen(rmname) + 4) > screenwidth) {
118 /* line break, check the paginator */
122 if (f & QR_MAILBOX) {
123 color(BRIGHT_YELLOW);
124 } else if (f & QR_PRIVATE) {
129 pprintf("%s", rmname);
130 if ((f & QR_DIRECTORY) && (f & QR_NETWORK))
132 else if (f & QR_DIRECTORY)
134 else if (f & QR_NETWORK)
138 c = c + strlen(rmname) + 3;
141 if (rp->rnext != NULL) {
142 room_tree_list(rp->rnext);
150 * Room ordering stuff (compare first by floor, then by order)
152 int rordercmp(struct roomlisting *r1, struct roomlisting *r2)
154 if ((r1 == NULL) && (r2 == NULL))
160 if (r1->rlfloor < r2->rlfloor)
162 if (r1->rlfloor > r2->rlfloor)
164 if (r1->rlorder < r2->rlorder)
166 if (r1->rlorder > r2->rlorder)
173 * Common code for all room listings
175 void listrms(char *variety)
179 struct roomlisting *rl = NULL;
180 struct roomlisting *rp;
181 struct roomlisting *rs;
184 /* Ask the server for a room list */
190 while (serv_gets(buf), strcmp(buf, "000")) {
191 rp = malloc(sizeof(struct roomlisting));
192 extract(rp->rlname, buf, 0);
193 rp->rlflags = extract_int(buf, 1);
194 rp->rlfloor = extract_int(buf, 2);
195 rp->rlorder = extract_int(buf, 3);
204 if (rordercmp(rp, rs) < 0) {
205 if (rs->lnext == NULL) {
212 if (rs->rnext == NULL) {
223 room_tree_list(NULL);
229 void list_other_floors(void)
234 for (a = 0; a < 128; ++a) {
235 if ((strlen(floorlist[a]) > 0) && (a != curr_floor)) {
236 if ((c + strlen(floorlist[a]) + 4) > screenwidth) {
240 pprintf("%s: ", floorlist[a]);
241 c = c + strlen(floorlist[a]) + 3;
248 * List known rooms. kn_floor_mode should be set to 0 for a 'flat' listing,
249 * 1 to list rooms on the current floor, or 1 to list rooms on all floors.
251 void knrooms(int kn_floor_mode)
258 if (kn_floor_mode == 0) {
260 pprintf("\n Rooms with unread messages:\n");
263 pprintf("\n\n No unseen messages in:\n");
268 if (kn_floor_mode == 1) {
270 pprintf("\n Rooms with unread messages on %s:\n",
271 floorlist[(int) curr_floor]);
272 snprintf(buf, sizeof buf, "LKRN %d", curr_floor);
275 pprintf("\n\n Rooms with no new messages on %s:\n",
276 floorlist[(int) curr_floor]);
277 snprintf(buf, sizeof buf, "LKRO %d", curr_floor);
280 pprintf("\n\n Other floors:\n");
285 if (kn_floor_mode == 2) {
286 for (a = 0; a < 128; ++a) {
287 if (floorlist[a][0] != 0) {
289 pprintf("\n Rooms on %s:\n",
291 snprintf(buf, sizeof buf, "LKRA %d", a);
299 IFNEXPERT hit_any_key();
303 void listzrooms(void)
304 { /* list public forgotten rooms */
306 pprintf("\n Forgotten public rooms:\n");
310 IFNEXPERT hit_any_key();
314 int set_room_attr(int ibuf, char *prompt, unsigned int sbit)
318 a = boolprompt(prompt, (ibuf & sbit));
319 ibuf = (ibuf | sbit);
321 ibuf = (ibuf ^ sbit);
329 * Select a floor (used in several commands)
330 * The supplied argument is the 'default' floor number.
331 * This function returns the selected floor number.
333 int select_floor(int rfloor)
338 if (floor_mode == 1) {
339 if (floorlist[(int) curr_floor][0] == 0) {
345 safestrncpy(floorstr, floorlist[rfloor],
347 strprompt("Which floor", floorstr, SIZ);
348 for (a = 0; a < 128; ++a) {
350 (floorstr, &floorlist[a][0]))
355 (floorstr, &floorlist[a][0],
359 && (pattern(&floorlist[a][0], floorstr)
364 scr_printf("\n One of:\n");
365 for (a = 0; a < 128; ++a) {
366 if (floorlist[a][0] != 0) {
372 } while (newfloor < 0);
382 * .<A>ide <E>dit room
384 void editthisroom(void)
386 char rname[ROOMNAMELEN];
396 int expire_value = 0;
397 int r; /* IPC response code */
399 /* Fetch the existing room config */
403 scr_printf("%s\n", &buf[4]);
407 extract(rname, &buf[4], 0);
408 extract(rpass, &buf[4], 1);
409 extract(rdir, &buf[4], 2);
410 rflags = extract_int(&buf[4], 3);
411 rfloor = extract_int(&buf[4], 4);
412 rorder = extract_int(&buf[4], 5);
415 /* Fetch the name of the current room aide */
419 safestrncpy(raide, &buf[4], sizeof raide);
424 if (strlen(raide) == 0) {
425 strcpy(raide, "none");
428 /* Fetch the expire policy (this will silently fail on old servers,
429 * resulting in "default" policy)
431 serv_puts("GPEX room");
434 expire_mode = extract_int(&buf[4], 0);
435 expire_value = extract_int(&buf[4], 1);
438 /* Now interact with the user. */
439 strprompt("Room name", rname, ROOMNAMELEN - 1);
441 rfloor = select_floor(rfloor);
442 rflags = set_room_attr(rflags, "Private room", QR_PRIVATE);
443 if (rflags & QR_PRIVATE) {
444 rflags = set_room_attr(rflags,
445 "Accessible by guessing room name",
449 /* if it's public, clear the privacy classes */
450 if ((rflags & QR_PRIVATE) == 0) {
451 if (rflags & QR_GUESSNAME) {
452 rflags = rflags - QR_GUESSNAME;
454 if (rflags & QR_PASSWORDED) {
455 rflags = rflags - QR_PASSWORDED;
459 /* if it's private, choose the privacy classes */
460 if ((rflags & QR_PRIVATE)
461 && ((rflags & QR_GUESSNAME) == 0)) {
462 rflags = set_room_attr(rflags,
463 "Accessible by entering a password",
466 if ((rflags & QR_PRIVATE)
467 && ((rflags & QR_PASSWORDED) == QR_PASSWORDED)) {
468 strprompt("Room password", rpass, 9);
471 if ((rflags & QR_PRIVATE) == QR_PRIVATE) {
473 boolprompt("Cause current users to forget room", 0);
477 set_room_attr(rflags, "Preferred users only", QR_PREFONLY);
478 rflags = set_room_attr(rflags, "Read-only room", QR_READONLY);
479 rflags = set_room_attr(rflags, "Directory room", QR_DIRECTORY);
480 rflags = set_room_attr(rflags, "Permanent room", QR_PERMANENT);
481 if (rflags & QR_DIRECTORY) {
482 strprompt("Directory name", rdir, 14);
484 set_room_attr(rflags, "Uploading allowed", QR_UPLOAD);
486 set_room_attr(rflags, "Downloading allowed",
489 set_room_attr(rflags, "Visible directory", QR_VISDIR);
491 rflags = set_room_attr(rflags, "Network shared room", QR_NETWORK);
492 rflags = set_room_attr(rflags,
493 "Automatically make all messages anonymous",
495 if ((rflags & QR_ANONONLY) == 0) {
496 rflags = set_room_attr(rflags,
497 "Ask users whether to make messages anonymous",
500 rorder = intprompt("Listing order", rorder, 1, 127);
502 /* Ask about the room aide */
504 strprompt("Room aide (or 'none')", raide, 29);
505 if (!strcasecmp(raide, "none")) {
509 r = CtdlIPCQueryUsername(raide, buf);
511 scr_printf("%s\n", buf);
513 } while (r / 100 != 2);
515 /* FIXME: Duplicate code??? */
516 if (!strcasecmp(raide, "none")) {
520 /* Angels and demons dancing in my head... */
522 snprintf(buf, sizeof buf, "%d", expire_mode);
523 strprompt("Message expire policy (? for list)", buf, 1);
526 "0. Use the default for this floor\n"
527 "1. Never automatically expire messages\n"
528 "2. Expire by message count\n"
529 "3. Expire by message age\n");
531 } while ((buf[0] < 48) || (buf[0] > 51));
532 expire_mode = buf[0] - 48;
534 /* ...lunatics and monsters underneath my bed */
535 if (expire_mode == 2) {
536 snprintf(buf, sizeof buf, "%d", expire_value);
537 strprompt("Keep how many messages online?", buf, 10);
538 expire_value = atol(buf);
541 if (expire_mode == 3) {
542 snprintf(buf, sizeof buf, "%d", expire_value);
543 strprompt("Keep messages for how many days?", buf, 10);
544 expire_value = atol(buf);
547 /* Give 'em a chance to change their minds */
548 scr_printf("Save changes (y/n)? ");
551 r = CtdlIPCSetRoomAide(raide, buf);
553 scr_printf("%s\n", buf);
556 r = CtdlIPCSetMessageExpirationPolicy(0, expire_mode,
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
581 snprintf(buf, sizeof buf, "GOTO %s", uglist[uglistsize-1]);
585 scr_printf("%s\n", &buf[4]);
588 snprintf(buf, sizeof buf, "SLRP %ld", uglistlsn[uglistsize-1]);
592 scr_printf("%s\n", &buf[4]);
594 safestrncpy (buf, uglist[uglistsize-1], sizeof(buf));
596 free(uglist[uglistsize]);
597 dotgoto(buf, 0, 1); /* Don't queue ungoto info or we end up in a loop */
601 /* Here's the code for simply transferring the file to the client,
602 * for folks who have their own clientware. It's a lot simpler than
603 * the [XYZ]modem code below...
604 * (This function assumes that a download file is already open on the server)
606 void download_to_local_disk(char *supplied_filename, long total_bytes)
610 long transmitted_bytes = 0L;
617 strcpy(filename, supplied_filename);
618 if (strlen(filename) == 0) {
619 newprompt("Filename: ", filename, 250);
622 scr_printf("Enter the name of the directory to save '%s'\n"
623 "to, or press return for the current directory.\n", filename);
624 newprompt("Directory: ", dbuf, sizeof dbuf);
625 if (strlen(dbuf) == 0)
628 strcat(dbuf, filename);
630 savefp = fopen(dbuf, "w");
631 if (savefp == NULL) {
632 scr_printf("Cannot open '%s': %s\n", dbuf, strerror(errno));
633 /* close the download file at the server */
637 scr_printf("%s\n", &buf[4]);
641 progress(0, total_bytes);
642 while ((transmitted_bytes < total_bytes) && (broken == 0)) {
643 bb = total_bytes - transmitted_bytes;
644 aa = ((bb < 4096) ? bb : 4096);
645 snprintf(buf, sizeof buf, "READ %ld|%ld", transmitted_bytes, aa);
649 scr_printf("%s\n", &buf[4]);
652 packet = extract_int(&buf[4], 0);
653 serv_read(dbuf, packet);
654 if (fwrite(dbuf, packet, 1, savefp) < 1)
656 transmitted_bytes = transmitted_bytes + (long) packet;
657 progress(transmitted_bytes, total_bytes);
660 /* close the download file at the server */
664 scr_printf("%s\n", &buf[4]);
671 * download() - download a file or files. The argument passed to this
672 * function determines which protocol to use.
673 * proto - 0 = paginate, 1 = xmodem, 2 = raw, 3 = ymodem, 4 = zmodem, 5 = save
675 void download(int proto)
680 char transmit_cmd[SIZ];
681 long total_bytes = 0L;
683 long transmitted_bytes = 0L;
689 if ((room_flags & QR_DOWNLOAD) == 0) {
690 scr_printf("*** You cannot download from this room.\n");
694 newprompt("Enter filename: ", filename, 255);
696 snprintf(buf, sizeof buf, "OPEN %s", filename);
700 scr_printf("%s\n", &buf[4]);
703 total_bytes = extract_long(&buf[4], 0);
705 /* Save to local disk, for folks with their own copy of the client */
707 download_to_local_disk(filename, total_bytes);
711 /* Meta-download for public clients */
712 scr_printf("Fetching file from Citadel server...\n");
713 mkdir(tempdir, 0700);
714 snprintf(tempname, sizeof tempname, "%s/%s", tempdir, filename);
715 tpipe = fopen(tempname, "wb");
716 while ((transmitted_bytes < total_bytes) && (broken == 0)) {
717 progress(transmitted_bytes, total_bytes);
718 bb = total_bytes - transmitted_bytes;
719 aa = ((bb < 4096) ? bb : 4096);
720 snprintf(buf, sizeof buf, "READ %ld|%ld", transmitted_bytes, aa);
724 scr_printf("%s\n", &buf[4]);
726 packet = extract_int(&buf[4], 0);
727 serv_read(dbuf, packet);
728 if (fwrite(dbuf, packet, 1, tpipe) < 1) {
731 transmitted_bytes = transmitted_bytes + (long) packet;
734 progress(transmitted_bytes, total_bytes);
736 /* close the download file at the server */
740 scr_printf("%s\n", &buf[4]);
744 snprintf(transmit_cmd, sizeof transmit_cmd,
745 "SHELL=/dev/null; export SHELL; TERM=dumb; export TERM; exec more -d <%s",
749 snprintf(transmit_cmd, sizeof transmit_cmd, "exec sx %s", tempname);
751 snprintf(transmit_cmd, sizeof transmit_cmd, "exec sb %s", tempname);
753 snprintf(transmit_cmd, sizeof transmit_cmd, "exec sz %s", tempname);
755 snprintf(transmit_cmd, sizeof transmit_cmd, "exec cat %s", tempname);
759 system(transmit_cmd);
763 /* clean up the temporary directory */
770 * read directory of this room
782 pprintf("%s\n", &buf[4]);
786 extract(comment, &buf[4], 0);
787 extract(flnm, &buf[4], 1);
788 pprintf("\nDirectory of %s on %s\n", flnm, comment);
789 pprintf("-----------------------\n");
790 while (serv_gets(buf), strcmp(buf, "000")) {
791 extract(flnm, buf, 0);
792 extract(flsz, buf, 1);
793 extract(comment, buf, 2);
794 if (strlen(flnm) <= 14)
795 pprintf("%-14s %8s %s\n", flnm, flsz, comment);
797 pprintf("%s\n%14s %8s %s\n", flnm, "", flsz,
804 * add a user to a private room
808 char username[USERNAME_SIZE];
810 int r; /* IPC response code */
812 newprompt("Name of user? ", username, USERNAME_SIZE);
813 if (username[0] == 0)
816 r = CtdlIPCInviteUserToRoom(username, buf);
817 scr_printf("%s\n", buf);
822 * kick a user out of a room
826 char username[USERNAME_SIZE];
828 int r; /* IPC response code */
830 newprompt("Name of user? ", username, USERNAME_SIZE);
831 if (username[0] == 0)
834 r = CtdlIPCKickoutUserFromRoom(username, buf);
835 scr_printf("%s\n", buf);
840 * aide command: kill the current room
847 r = CtdlIPCDeleteRoom(0, aaa);
849 scr_printf("%s\n", aaa);
853 scr_printf("Are you sure you want to kill this room? ");
857 r = CtdlIPCDeleteRoom(1, aaa);
858 scr_printf("%s\n", aaa);
861 dotgoto("_BASEROOM_", 0, 0);
865 { /* forget the current room */
868 scr_printf("Are you sure you want to forget this room? ");
872 if (CtdlIPCForgetRoom(buf) / 100 != 2) {
873 scr_printf("%s\n", buf);
877 /* now return to the lobby */
878 dotgoto("_BASEROOM_", 0, 0);
888 char new_room_name[ROOMNAMELEN];
890 char new_room_pass[10];
893 int r; /* IPC response code */
895 /* Check permission to create room */
896 r = CtdlIPCCreateRoom(0, "", 1, "", 0, buf);
898 scr_printf("%s\n", buf);
902 newprompt("Name for new room? ", new_room_name, ROOMNAMELEN - 1);
903 if (strlen(new_room_name) == 0) {
906 for (a = 0; a < strlen(new_room_name); ++a) {
907 if (new_room_name[a] == '|') {
908 new_room_name[a] = '_';
912 new_room_floor = select_floor((int) curr_floor);
914 IFNEXPERT formout("roomaccess");
916 scr_printf("<?>Help\n<1>Public room\n<2>Guess-name room\n"
917 "<3>Passworded room\n<4>Invitation-only room\n"
919 "Enter room type: ");
922 } while (((b < '1') || (b > '5')) && (b != '?'));
925 formout("roomaccess");
927 } while ((b < '1') || (b > '5'));
928 b -= '0'; /* Portable */
929 scr_printf("%d\n", b);
930 new_room_type = b - 1;
931 if (new_room_type == 2) {
932 newprompt("Enter a room password: ", new_room_pass, 9);
933 for (a = 0; a < strlen(new_room_pass); ++a)
934 if (new_room_pass[a] == '|')
935 new_room_pass[a] = '_';
937 strcpy(new_room_pass, "");
940 scr_printf("\042%s\042, a", new_room_name);
942 scr_printf(" public room.");
944 scr_printf(" guess-name room.");
946 scr_printf(" passworded room, password: %s", new_room_pass);
948 scr_printf("n invitation-only room.");
950 scr_printf(" personal room.");
951 scr_printf("\nInstall it? (y/n) : ");
956 r = CtdlIPCCreateRoom(1, new_room_name, new_room_type,
957 new_room_pass, new_room_floor, buf);
959 scr_printf("%s\n", buf);
963 /* command succeeded... now GO to the new room! */
964 dotgoto(new_room_name, 0, 0);
970 { /* read info file for current room */
973 int r; /* IPC response code */
976 /* Name of currernt room aide */
977 r = CtdlIPCGetRoomAide(buf);
979 safestrncpy(raide, buf, sizeof raide);
983 if (strlen(raide) > 0)
984 scr_printf("Room aide is %s.\n\n", raide);
986 r = CtdlIPCRoomInfo(&text, buf);
991 fmout(screenwidth, NULL, text, NULL,
992 ((userflags & US_PAGINATOR) ? 1 : 0), screenheight,
993 (*raide) ? 2 : 0, 1);
1000 * <W>ho knows room...
1007 if (buf[0] != '1') {
1008 pprintf("%s\n", &buf[4]);
1011 while (serv_gets(buf), strncmp(buf, "000", 3)) {
1013 pprintf("%s\n", buf);
1018 void do_edit(char *desc, char *read_cmd, char *check_cmd, char *write_cmd)
1022 int b, cksum, editor_exit;
1025 if (strlen(editor_path) == 0) {
1026 scr_printf("Do you wish to re-enter %s? ", desc);
1031 fp = fopen(temp, "w");
1034 serv_puts(check_cmd);
1036 if (cmd[0] != '2') {
1037 scr_printf("%s\n", &cmd[4]);
1041 if (strlen(editor_path) > 0) {
1042 serv_puts(read_cmd);
1044 if (cmd[0] == '1') {
1045 fp = fopen(temp, "w");
1046 while (serv_gets(cmd), strcmp(cmd, "000")) {
1047 fprintf(fp, "%s\n", cmd);
1053 cksum = file_checksum(temp);
1055 if (strlen(editor_path) > 0) {
1058 snprintf(tmp, sizeof tmp, "WINDOW_TITLE=%s", desc);
1060 editor_pid = fork();
1061 if (editor_pid == 0) {
1064 sttybbs(SB_RESTORE);
1065 execlp(editor_path, editor_path, temp, NULL);
1071 b = wait(&editor_exit);
1072 } while ((b != editor_pid) && (b >= 0));
1074 scr_printf("Executed %s\n", editor_path);
1078 scr_printf("Entering %s. "
1079 "Press return twice when finished.\n", desc);
1080 fp = fopen(temp, "r+");
1085 if (file_checksum(temp) == cksum) {
1086 scr_printf("*** Aborted.\n");
1090 serv_puts(write_cmd);
1092 if (cmd[0] != '4') {
1093 scr_printf("%s\n", &cmd[4]);
1097 fp = fopen(temp, "r");
1098 while (fgets(cmd, SIZ - 1, fp) != NULL) {
1099 cmd[strlen(cmd) - 1] = 0;
1110 void enterinfo(void)
1111 { /* edit info file for current room */
1112 do_edit("the Info file for this room", "RINF", "EINF 0", "EINF 1");
1115 void enter_bio(void)
1118 snprintf(cmd, sizeof cmd, "RBIO %s", fullname);
1119 do_edit("your Bio", cmd, "NOOP", "EBIO");
1123 * create a new floor
1125 void create_floor(void)
1128 char newfloorname[SIZ];
1129 int r; /* IPC response code */
1133 r = CtdlIPCCreateFloor(0, "", buf);
1135 scr_printf("%s\n", buf);
1139 newprompt("Name for new floor: ", newfloorname, 255);
1140 r = CtdlIPCCreateFloor(1, newfloorname, buf);
1142 scr_printf("Floor has been created.\n");
1144 scr_printf("%s\n", buf);
1151 * edit the current floor
1153 void edit_floor(void)
1156 int expire_mode = 0;
1157 int expire_value = 0;
1158 int r; /* IPC response code */
1162 /* Fetch the expire policy (this will silently fail on old servers,
1163 * resulting in "default" policy)
1165 r = CtdlIPCGetMessageExpirationPolicy(1, buf);
1167 expire_mode = extract_int(buf, 0);
1168 expire_value = extract_int(buf, 1);
1171 /* Interact with the user */
1172 scr_printf("You are editing the floor called \"%s\"\n",
1173 &floorlist[(int) curr_floor][0] );
1174 strprompt("Floor name", &floorlist[(int) curr_floor][0], 255);
1176 /* Angels and demons dancing in my head... */
1178 snprintf(buf, sizeof buf, "%d", expire_mode);
1180 ("Floor default message expire policy (? for list)",
1182 if (buf[0] == '?') {
1184 "0. Use the system default\n"
1185 "1. Never automatically expire messages\n"
1186 "2. Expire by message count\n"
1187 "3. Expire by message age\n");
1189 } while ((buf[0] < '0') || (buf[0] > '3'));
1190 expire_mode = buf[0] - '0';
1192 /* ...lunatics and monsters underneath my bed */
1193 if (expire_mode == 2) {
1194 snprintf(buf, sizeof buf, "%d", expire_value);
1195 strprompt("Keep how many messages online?", buf, 10);
1196 expire_value = atol(buf);
1199 if (expire_mode == 3) {
1200 snprintf(buf, sizeof buf, "%d", expire_value);
1201 strprompt("Keep messages for how many days?", buf, 10);
1202 expire_value = atol(buf);
1206 r = CtdlIPCSetMessageExpirationPolicy(1, expire_mode,
1208 r = CtdlIPCEditFloor(curr_floor, &floorlist[(int)curr_floor][0], buf);
1209 scr_printf("%s\n", buf);
1217 * kill the current floor
1219 void kill_floor(void)
1221 int floornum_to_delete, a;
1226 floornum_to_delete = (-1);
1227 scr_printf("(Press return to abort)\n");
1228 newprompt("Delete which floor? ", buf, 255);
1229 if (strlen(buf) == 0)
1231 for (a = 0; a < 128; ++a)
1232 if (!strcasecmp(&floorlist[a][0], buf))
1233 floornum_to_delete = a;
1234 if (floornum_to_delete < 0) {
1235 scr_printf("No such floor. Select one of:\n");
1236 for (a = 0; a < 128; ++a)
1237 if (floorlist[a][0] != 0)
1238 scr_printf("%s\n", &floorlist[a][0]);
1240 } while (floornum_to_delete < 0);
1241 CtdlIPCDeleteFloor(1, floornum_to_delete, buf);
1242 scr_printf("%s\n", buf);