3 * More client-side support functions.
4 * Unlike routines.c, some of these DO use global variables.
11 #include <sys/types.h>
19 #if TIME_WITH_SYS_TIME
20 # include <sys/time.h>
24 # include <sys/time.h>
36 #include "citadel_decls.h"
37 #include "routines2.h"
47 void interr(int errnum);
48 void strprompt(char *prompt, char *str, int len);
49 void newprompt(char *prompt, char *str, int len);
50 void sttybbs(int cmd);
52 void serv_write(char *buf, int nbytes);
53 int haschar(char *st, int ch);
54 void progress(long int curr, long int cmax);
58 extern char tempdir[];
59 extern char *axdefs[7];
60 extern long highest_msg_read;
61 extern long maxmsgnum;
62 extern unsigned room_flags;
63 extern int screenwidth;
66 int eopen(char *name, int mode)
69 ret = open(name, mode);
71 err_printf("Cannot open file '%s', mode=%d, errno=%d\n",
79 int room_prompt(int qrflags)
80 { /* return proper room prompt character */
83 if (qrflags & QR_DIRECTORY)
85 if ((a == ']') && (qrflags & QR_NETWORK))
87 if ((a == '>') && (qrflags & QR_NETWORK))
93 { /* register with name and address */
103 char tmpcountry[SIZ];
113 strcpy(tmpstate, "");
115 strcpy(tmpphone, "");
116 strcpy(tmpemail, "");
117 strcpy(tmpcountry, "");
119 serv_puts("GREG _SELF_");
123 while (serv_gets(buf), strcmp(buf, "000")) {
125 strcpy(tmpname, buf);
127 strcpy(tmpaddr, buf);
129 strcpy(tmpcity, buf);
131 strcpy(tmpstate, buf);
135 strcpy(tmpphone, buf);
137 strcpy(tmpemail, buf);
139 strcpy(tmpcountry, buf);
143 strprompt("REAL name", tmpname, 29);
144 strprompt("Address", tmpaddr, 24);
145 strprompt("City/town", tmpcity, 14);
146 strprompt("State/province", tmpstate, 2);
147 strprompt("ZIP/Postal Code", tmpzip, 10);
148 strprompt("Country", tmpcountry, 31);
149 strprompt("Telephone number", tmpphone, 14);
153 strcpy(holdemail, tmpemail);
154 strprompt("Email address", tmpemail, 31);
155 snprintf(buf, sizeof buf, "QDIR %s", tmpemail);
159 extract_token(diruser, &buf[4], 0, '@');
160 extract_token(dirnode, &buf[4], 1, '@');
163 if ((strcasecmp(diruser, fullname))
164 || (strcasecmp(dirnode, serv_info.serv_nodename))) {
166 "\nYou can't use %s as your address.\n",
169 "It is already in use by %s @ %s.\n",
172 strcpy(tmpemail, holdemail);
177 /* now send the registration info back to the server */
181 scr_printf("%s\n", &buf[4]);
191 serv_puts(tmpcountry);
197 { /* make all messages old in current room */
200 if (rc_alt_semantics) {
201 if (maxmsgnum == highest_msg_read == 0) {
202 /* err_printf("maxmsgnum == highest_msg_read == 0\n"); */
205 snprintf(buf, sizeof(buf), "SLRP %ld",
206 (maxmsgnum > highest_msg_read) ?
207 maxmsgnum : highest_msg_read);
210 serv_puts("SLRP HIGHEST");
214 scr_printf("%s\n", &buf[4]);
218 * only make messages old in this room that have been read
224 snprintf(buf, sizeof buf, "SLRP %ld", highest_msg_read);
228 scr_printf("%s\n", &buf[4]);
233 * This routine completes a client upload
235 void do_upload(int fd)
239 long transmitted_bytes, total_bytes;
243 /* learn the size of the file */
244 total_bytes = lseek(fd, 0L, 2);
247 transmitted_bytes = 0L;
248 progress(transmitted_bytes, total_bytes);
250 bytes_to_send = read(fd, tbuf, 4096);
251 if (bytes_to_send > 0) {
252 snprintf(buf, sizeof buf, "WRIT %d", bytes_to_send);
256 bytes_expected = atoi(&buf[4]);
257 serv_write(tbuf, bytes_expected);
259 scr_printf("%s\n", &buf[4]);
262 transmitted_bytes = transmitted_bytes + (long) bytes_to_send;
263 progress(transmitted_bytes, total_bytes);
264 } while (bytes_to_send > 0);
266 /* close the upload file, locally and at the server */
270 scr_printf("%s\n", &buf[4]);
275 * client-based uploads (for users with their own clientware)
277 void cli_upload(void)
286 if ((room_flags & QR_UPLOAD) == 0) {
287 scr_printf("*** You cannot upload to this room.\n");
290 newprompt("File to be uploaded: ", flnm, 55);
291 fd = open(flnm, O_RDONLY);
293 scr_printf("Cannot open '%s': %s\n", flnm, strerror(errno));
296 scr_printf("Enter a description of this file:\n");
297 newprompt(": ", desc, 75);
299 /* keep generating filenames in hope of finding a unique one */
303 return; /* fail if tried 10 times */
305 while ((strlen(buf) > 0) && (haschar(buf, '/')))
306 strcpy(buf, &buf[1]);
308 size_t tmp = strlen(buf);
309 snprintf(&buf[tmp], sizeof buf - tmp, "%d", a);
311 snprintf(tbuf, sizeof tbuf, "UOPN %s|%s", buf, desc);
315 scr_printf("%s\n", &buf[4]);
317 } while (buf[0] != '2');
319 /* at this point we have an open upload file at the server */
325 * Function used for various image upload commands
327 void cli_image_upload(char *keyname)
333 snprintf(buf, sizeof buf, "UIMG 0|%s", keyname);
337 scr_printf("%s\n", &buf[4]);
340 newprompt("Image file to be uploaded: ", flnm, 55);
341 fd = open(flnm, O_RDONLY);
343 scr_printf("Cannot open '%s': %s\n", flnm, strerror(errno));
346 snprintf(buf, sizeof buf, "UIMG 1|%s", keyname);
350 scr_printf("%s\n", &buf[4]);
358 * protocol-based uploads (Xmodem, Ymodem, Zmodem)
361 { /* c = upload mode */
371 if ((room_flags & QR_UPLOAD) == 0) {
372 scr_printf("*** You cannot upload to this room.\n");
375 /* we don't need a filename when receiving batch y/z modem */
376 if ((c == 2) || (c == 3))
379 newprompt("Enter filename: ", flnm, 15);
381 for (a = 0; a < strlen(flnm); ++a)
382 if ((flnm[a] == '/') || (flnm[a] == '\\') || (flnm[a] == '>')
383 || (flnm[a] == '?') || (flnm[a] == '*')
384 || (flnm[a] == ';') || (flnm[a] == '&'))
387 newprompt("Enter a short description of the file:\n: ", desc, 150);
389 /* create a temporary directory... */
390 if (mkdir(tempdir, 0700) != 0) {
391 scr_printf("*** Could not create temporary directory %s: %s\n",
392 tempdir, strerror(errno));
395 /* now do the transfer ... in a separate process */
402 scr_printf("Receiving %s - press Ctrl-D to end.\n", flnm);
403 fp = fopen(flnm, "w");
419 execlp("rx", "rx", flnm, NULL);
424 execlp("rb", "rb", NULL);
429 execlp("rz", "rz", NULL);
435 } while ((b != xfer_pid) && (b != (-1)));
440 scr_printf("\r*** Transfer unsuccessful.\n");
444 scr_printf("\r*** Transfer successful. Sending file(s) to server...\n");
445 snprintf(buf, sizeof buf, "cd %s; ls", tempdir);
446 lsfp = popen(buf, "r");
448 while (fgets(flnm, sizeof flnm, lsfp) != NULL) {
449 flnm[strlen(flnm) - 1] = 0;
450 snprintf(buf, sizeof buf, "%s/%s", tempdir, flnm);
451 fd = open(buf, O_RDONLY);
455 snprintf(buf, sizeof buf, "UOPN %s|%s", flnm, desc);
457 size_t tmp = strlen(buf);
465 } while ((buf[0] != '2') && (a < 100));
468 a = read(fd, tbuf, 4096);
470 snprintf(buf, sizeof buf, "WRIT %d", a);
480 scr_printf("%s\n", &buf[4]);
491 void val_user(char *user, int do_validate)
498 snprintf(cmd, sizeof cmd, "GREG %s", user);
507 scr_printf("User #%s - %s ", buf, &cmd[4]);
509 scr_printf("PW: %s\n", buf);
511 scr_printf("%s\n", buf);
513 scr_printf("%s\n", buf);
515 scr_printf("%s, ", buf);
517 scr_printf("%s ", buf);
519 scr_printf("%s\n", buf);
521 scr_printf("%s\n", buf);
525 scr_printf("%s\n", buf);
527 scr_printf("%s\n", buf);
528 } while (strcmp(buf, "000"));
529 scr_printf("Current access level: %d (%s)\n", ax, axdefs[ax]);
531 scr_printf("%-30s\n%s\n", user, &cmd[4]);
535 /* now set the access level */
536 ax = intprompt("Access level", ax, 0, 6);
537 snprintf(cmd, sizeof cmd, "VALI %s|%d", user, ax);
541 scr_printf("%s\n", &cmd[4]);
548 { /* validate new users */
559 scr_printf("%s\n", &cmd[4]);
561 extract(buf, cmd, 0);
562 val_user(&buf[4], 1);
564 } while (finished == 0);
574 signal(SIGINT, SIG_DFL);
575 signal(SIGQUIT, SIG_DFL);
576 execlp(getenv("SHELL"), getenv("SHELL"), NULL);
577 err_printf("Could not open a shell: %s\n", strerror(errno));
582 } while ((a != b) && (a != (-1)));
588 * <.A>ide <F>ile <D>elete command
590 void deletefile(void)
595 newprompt("Filename: ", filename, 31);
596 if (strlen(filename) == 0)
598 snprintf(cmd, sizeof cmd, "DELF %s", filename);
601 err_printf("%s\n", &cmd[4]);
605 * <.A>ide <F>ile <S>end command
607 void netsendfile(void)
609 char filename[32], destsys[20], cmd[SIZ];
611 newprompt("Filename: ", filename, 31);
612 if (strlen(filename) == 0)
614 newprompt("System to send to: ", destsys, 19);
615 snprintf(cmd, sizeof cmd, "NETF %s|%s", filename, destsys);
618 err_printf("%s\n", &cmd[4]);
623 * <.A>ide <F>ile <M>ove command
628 char newroom[ROOMNAMELEN];
631 newprompt("Filename: ", filename, 63);
632 if (strlen(filename) == 0)
634 newprompt("Enter target room: ", newroom, ROOMNAMELEN - 1);
636 snprintf(cmd, sizeof cmd, "MOVF %s|%s", filename, newroom);
639 err_printf("%s\n", &cmd[4]);
644 * list of users who have filled out a bio
654 pprintf("%s\n", &buf[4]);
657 while (serv_gets(buf), strcmp(buf, "000")) {
658 if ((pos + strlen(buf) + 5) > screenwidth) {
662 pprintf("%s, ", buf);
663 pos = pos + strlen(buf) + 2;
665 pprintf("%c%c \n\n", 8, 8);
678 newprompt("Read bio for who ('?' for list) : ", who, 25);
680 if (!strcmp(who, "?"))
682 } while (!strcmp(who, "?"));
683 snprintf(buf, sizeof buf, "RBIO %s", who);
687 pprintf("%s\n", &buf[4]);
690 while (serv_gets(buf), strcmp(buf, "000")) {
691 pprintf("%s\n", buf);
697 * General system configuration command
699 void do_system_configuration(void)
704 int expire_value = 0;
708 /* Clear out the config buffers */
709 memset(&sc[0][0], 0, sizeof(sc));
711 /* Fetch the current config */
712 serv_puts("CONF get");
716 while (serv_gets(buf), strcmp(buf, "000")) {
718 strcpy(&sc[a][0], buf);
723 /* Fetch the expire policy (this will silently fail on old servers,
724 * resulting in "default" policy)
726 serv_puts("GPEX site");
729 expire_mode = extract_int(&buf[4], 0);
730 expire_value = extract_int(&buf[4], 1);
734 /* Identification parameters */
736 strprompt("Node name", &sc[0][0], 15);
737 strprompt("Fully qualified domain name", &sc[1][0], 63);
738 strprompt("Human readable node name", &sc[2][0], 20);
739 strprompt("Modem dialup number", &sc[3][0], 15);
740 strprompt("Geographic location of this system", &sc[12][0], 31);
741 strprompt("Name of system administrator", &sc[13][0], 25);
742 strprompt("Paginator prompt", &sc[10][0], 79);
744 /* this prompt is commented out until we finish the moderation system
745 strprompt("Default moderation filter for new users", &sc[25][0], 4);
748 /* Security parameters */
750 snprintf(sc[7], sizeof sc[7], "%d", (boolprompt(
751 "Require registration for new users",
753 snprintf(sc[29], sizeof sc[29], "%d", (boolprompt(
754 "Disable self-service user account creation",
756 strprompt("Initial access level for new users", &sc[6][0], 1);
757 strprompt("Access level required to create rooms", &sc[19][0], 1);
758 snprintf(sc[4], sizeof sc[4], "%d", (boolprompt(
759 "Automatically give room aide privs to a user who creates a private room",
762 snprintf(sc[8], sizeof sc[8], "%d", (boolprompt(
763 "Automatically move problem user messages to twit room",
766 strprompt("Name of twit room", &sc[9][0], ROOMNAMELEN);
767 snprintf(sc[11], sizeof sc[11], "%d", (boolprompt(
768 "Restrict Internet mail to only those with that privilege",
770 snprintf(sc[26], sizeof sc[26], "%d", (boolprompt(
771 "Allow Aides to Zap (forget) rooms",
774 if (strlen(&sc[18][0]) > 0) logpages = 1;
776 logpages = boolprompt("Log all pages", logpages);
778 strprompt("Name of logging room", &sc[18][0], ROOMNAMELEN);
787 strprompt("Server connection idle timeout (in seconds)", &sc[5][0], 4);
788 strprompt("Maximum concurrent sessions", &sc[14][0], 4);
789 strprompt("Maximum message length", &sc[20][0], 20);
790 strprompt("Minimum number of worker threads", &sc[21][0], 3);
791 strprompt("Maximum number of worker threads", &sc[22][0], 3);
793 /* no longer applicable ... deprecated
794 strprompt("Server-to-server networking password", &sc[15][0], 19);
797 strprompt("How often to run network jobs (in seconds)", &sc[28][0], 5);
798 strprompt("SMTP server port (-1 to disable)", &sc[24][0], 5);
799 strprompt("POP3 server port (-1 to disable)", &sc[23][0], 5);
800 strprompt("IMAP server port (-1 to disable)", &sc[27][0], 5);
802 /* Expiry settings */
803 strprompt("Default user purge time (days)", &sc[16][0], 5);
804 strprompt("Default room purge time (days)", &sc[17][0], 5);
806 /* Angels and demons dancing in my head... */
808 snprintf(buf, sizeof buf, "%d", expire_mode);
809 strprompt("System default message expire policy (? for list)",
813 "1. Never automatically expire messages\n"
814 "2. Expire by message count\n"
815 "3. Expire by message age\n");
817 } while ((buf[0] < 49) || (buf[0] > 51));
818 expire_mode = buf[0] - 48;
820 /* ...lunatics and monsters underneath my bed */
821 if (expire_mode == 2) {
822 snprintf(buf, sizeof buf, "%d", expire_value);
823 strprompt("Keep how many messages online?", buf, 10);
824 expire_value = atol(buf);
826 if (expire_mode == 3) {
827 snprintf(buf, sizeof buf, "%d", expire_value);
828 strprompt("Keep messages for how many days?", buf, 10);
829 expire_value = atol(buf);
832 scr_printf("Save this configuration? ");
834 serv_puts("CONF set");
837 for (a = 0; a < 30; ++a)
838 serv_puts(&sc[a][0]);
841 snprintf(buf, sizeof buf, "SPEX site|%d|%d",
842 expire_mode, expire_value);
850 * support function for do_internet_configuration()
852 void get_inet_rec_type(char *buf) {
855 keyopt(" <1> localhost (Alias for this computer)\n");
856 keyopt(" <2> gateway domain (Domain for all Citadel systems)\n");
857 keyopt(" <3> smart-host (Forward all outbound mail to this host)\n");
858 keyopt(" <4> directory (Consult the Global Address Book)\n");
859 sel = intprompt("Which one", 1, 1, 4);
861 case 1: strcpy(buf, "localhost");
863 case 2: strcpy(buf, "gatewaydomain");
865 case 3: strcpy(buf, "smarthost");
867 case 4: strcpy(buf, "directory");
874 * Internet mail configuration
876 void do_internet_configuration(void) {
886 snprintf(buf, sizeof buf, "CONF getsys|%s", INTERNETCFG);
889 if (buf[0] == '1') while (serv_gets(buf), strcmp(buf, "000")) {
891 if (num_recs == 1) recs = malloc(sizeof(char *));
892 else recs = realloc(recs, (sizeof(char *)) * num_recs);
893 recs[num_recs-1] = malloc(SIZ);
894 strcpy(recs[num_recs-1], buf);
900 scr_printf("### Host or domain Record type \n");
902 scr_printf("--- -------------------------------------------------- --------------------\n");
903 for (i=0; i<num_recs; ++i) {
905 scr_printf("%3d ", i+1);
906 extract(buf, recs[i], 0);
908 scr_printf("%-50s ", buf);
909 extract(buf, recs[i], 1);
910 color(BRIGHT_MAGENTA);
911 scr_printf("%-20s\n", buf);
915 ch = keymenu("", "<A>dd|<D>elete|<S>ave|<Q>uit");
920 recs = malloc(sizeof(char *));
921 else recs = realloc(recs,
922 (sizeof(char *)) * num_recs);
923 newprompt("Enter host name: ",
926 get_inet_rec_type(&buf[strlen(buf)]);
927 recs[num_recs-1] = strdup(buf);
930 i = intprompt("Delete which one",
934 for (j=i; j<num_recs; ++j)
938 snprintf(buf, sizeof buf, "CONF putsys|%s",
943 for (i=0; i<num_recs; ++i) {
949 scr_printf("%s\n", &buf[4]);
954 quitting = boolprompt(
955 "Quit without saving", 0);
960 } while (quitting == 0);
963 for (i=0; i<num_recs; ++i) free(recs[i]);
971 * Edit network configuration for room sharing, mailing lists, etc.
973 void network_config_management(char *entrytype, char *comment) {
974 char filename[PATH_MAX];
975 char changefile[PATH_MAX];
986 if (strlen(editor_path) == 0) {
987 scr_printf("You must have an external editor configured in"
988 " order to use this function.\n");
992 snprintf(filename, sizeof filename, "%s.listedit", tmpnam(NULL));
993 snprintf(changefile, sizeof changefile, "%s.listedit", tmpnam(NULL));
995 tempfp = fopen(filename, "w");
996 if (tempfp == NULL) {
997 err_printf("Cannot open %s: %s\n", filename, strerror(errno));
1001 fprintf(tempfp, "# Configuration for room: %s\n", room_name);
1002 fprintf(tempfp, "# %s\n", comment);
1003 fprintf(tempfp, "# Specify one per line.\n"
1008 if (buf[0] == '1') {
1009 while(serv_gets(buf), strcmp(buf, "000")) {
1010 extract(instr, buf, 0);
1011 if (!strcasecmp(instr, entrytype)) {
1012 extract(addr, buf, 1);
1013 fprintf(tempfp, "%s\n", addr);
1019 e_ex_code = 1; /* start with a failed exit code */
1020 editor_pid = fork();
1021 cksum = file_checksum(filename);
1022 if (editor_pid == 0) {
1023 chmod(filename, 0600);
1025 sttybbs(SB_RESTORE);
1026 putenv("WINDOW_TITLE=Network configuration");
1027 execlp(editor_path, editor_path, filename, NULL);
1030 if (editor_pid > 0) {
1033 b = ka_wait(&e_ex_code);
1034 } while ((b != editor_pid) && (b >= 0));
1040 if (file_checksum(filename) == cksum) {
1041 err_printf("*** Not saving changes.\n");
1045 if (e_ex_code == 0) { /* Save changes */
1046 changefp = fopen(changefile, "w");
1049 if (buf[0] == '1') {
1050 while(serv_gets(buf), strcmp(buf, "000")) {
1051 extract(instr, buf, 0);
1052 if (strcasecmp(instr, entrytype)) {
1053 fprintf(changefp, "%s\n", buf);
1057 tempfp = fopen(filename, "r");
1058 while (fgets(buf, sizeof buf, tempfp) != NULL) {
1059 for (i=0; i<strlen(buf); ++i) {
1060 if (buf[i] == '#') buf[i] = 0;
1063 if (strlen(buf) > 0) {
1064 fprintf(changefp, "%s|%s\n", entrytype, buf);
1070 /* now write it to the server... */
1073 if (buf[0] == '4') {
1074 changefp = fopen(changefile, "r");
1075 if (changefp != NULL) {
1076 while (fgets(buf, sizeof buf,
1077 changefp) != NULL) {
1078 buf[strlen(buf) - 1] = 0;
1087 unlink(filename); /* Delete the temporary files */
1093 * IGnet node configuration
1095 void do_ignet_configuration(void) {
1105 snprintf(buf, sizeof buf, "CONF getsys|%s", IGNETCFG);
1108 if (buf[0] == '1') while (serv_gets(buf), strcmp(buf, "000")) {
1110 if (num_recs == 1) recs = malloc(sizeof(char *));
1111 else recs = realloc(recs, (sizeof(char *)) * num_recs);
1112 recs[num_recs-1] = malloc(SIZ);
1113 strcpy(recs[num_recs-1], buf);
1118 color(BRIGHT_WHITE);
1127 "------------------ "
1128 "-------------------------------- "
1130 for (i=0; i<num_recs; ++i) {
1132 scr_printf("%3d ", i+1);
1133 extract(buf, recs[i], 0);
1135 scr_printf("%-16s ", buf);
1136 extract(buf, recs[i], 1);
1137 color(BRIGHT_MAGENTA);
1138 scr_printf("%-18s ", buf);
1139 extract(buf, recs[i], 2);
1141 scr_printf("%-32s ", buf);
1142 extract(buf, recs[i], 3);
1143 color(BRIGHT_MAGENTA);
1144 scr_printf("%-3s\n", buf);
1148 ch = keymenu("", "<A>dd|<D>elete|<S>ave|<Q>uit");
1153 recs = malloc(sizeof(char *));
1154 else recs = realloc(recs,
1155 (sizeof(char *)) * num_recs);
1156 newprompt("Enter node name : ", buf, 16);
1158 newprompt("Enter shared secret: ",
1159 &buf[strlen(buf)], 18);
1161 newprompt("Enter host or IP : ",
1162 &buf[strlen(buf)], 32);
1163 strcat(buf, "|504");
1164 strprompt("Enter port number : ",
1165 &buf[strlen(buf)-3], 5);
1166 recs[num_recs-1] = strdup(buf);
1169 i = intprompt("Delete which one",
1170 1, 1, num_recs) - 1;
1173 for (j=i; j<num_recs; ++j)
1174 recs[j] = recs[j+1];
1177 snprintf(buf, sizeof buf, "CONF putsys|%s", IGNETCFG);
1180 if (buf[0] == '4') {
1181 for (i=0; i<num_recs; ++i) {
1187 scr_printf("%s\n", &buf[4]);
1192 quitting = boolprompt(
1193 "Quit without saving", 0);
1198 } while (quitting == 0);
1201 for (i=0; i<num_recs; ++i) free(recs[i]);
1207 * Filter list configuration
1209 void do_filterlist_configuration(void) {
1219 snprintf(buf, sizeof buf, "CONF getsys|%s", FILTERLIST);
1222 if (buf[0] == '1') while (serv_gets(buf), strcmp(buf, "000")) {
1224 if (num_recs == 1) recs = malloc(sizeof(char *));
1225 else recs = realloc(recs, (sizeof(char *)) * num_recs);
1226 recs[num_recs-1] = malloc(SIZ);
1227 strcpy(recs[num_recs-1], buf);
1232 color(BRIGHT_WHITE);
1240 "---------------------------- "
1241 "---------------------------- "
1244 for (i=0; i<num_recs; ++i) {
1246 scr_printf("%3d ", i+1);
1247 extract(buf, recs[i], 0);
1249 scr_printf("%-28s ", buf);
1250 extract(buf, recs[i], 1);
1251 color(BRIGHT_MAGENTA);
1252 scr_printf("%-28s ", buf);
1253 extract(buf, recs[i], 2);
1255 scr_printf("%-16s\n", buf);
1256 extract(buf, recs[i], 3);
1260 ch = keymenu("", "<A>dd|<D>elete|<S>ave|<Q>uit");
1265 recs = malloc(sizeof(char *));
1266 else recs = realloc(recs,
1267 (sizeof(char *)) * num_recs);
1268 newprompt("Enter user name: ", buf, 28);
1270 newprompt("Enter room name: ",
1271 &buf[strlen(buf)], 28);
1273 newprompt("Enter node name: ",
1274 &buf[strlen(buf)], 16);
1276 recs[num_recs-1] = strdup(buf);
1279 i = intprompt("Delete which one",
1280 1, 1, num_recs) - 1;
1283 for (j=i; j<num_recs; ++j)
1284 recs[j] = recs[j+1];
1287 snprintf(buf, sizeof buf, "CONF putsys|%s", FILTERLIST);
1290 if (buf[0] == '4') {
1291 for (i=0; i<num_recs; ++i) {
1297 scr_printf("%s\n", &buf[4]);
1302 quitting = boolprompt(
1303 "Quit without saving", 0);
1308 } while (quitting == 0);
1311 for (i=0; i<num_recs; ++i) free(recs[i]);