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"
41 #include "citadel_ipc.h"
47 #include "client_crypto.h"
50 extern char tempdir[];
51 extern char *axdefs[7];
52 extern long highest_msg_read;
53 extern long maxmsgnum;
54 extern unsigned room_flags;
55 extern int screenwidth;
58 int eopen(char *name, int mode)
61 ret = open(name, mode);
63 err_printf("Cannot open file '%s', mode=%d, errno=%d\n",
71 int room_prompt(int qrflags)
72 { /* return proper room prompt character */
75 if (qrflags & QR_DIRECTORY)
77 if ((a == ']') && (qrflags & QR_NETWORK))
79 if ((a == '>') && (qrflags & QR_NETWORK))
85 { /* register with name and address */
101 int r; /* IPC response code */
106 strcpy(tmpstate, "");
108 strcpy(tmpphone, "");
109 strcpy(tmpemail, "");
110 strcpy(tmpcountry, "");
112 r = CtdlIPCGetUserRegistration(NULL, ®, buf);
116 while (reg && strlen(reg) > 0) {
118 extract_token(buf, reg, 0, '\n');
119 remove_token(reg, 0, '\n');
122 strcpy(tmpname, buf);
124 strcpy(tmpaddr, buf);
126 strcpy(tmpcity, buf);
128 strcpy(tmpstate, buf);
132 strcpy(tmpphone, buf);
134 strcpy(tmpemail, buf);
136 strcpy(tmpcountry, buf);
140 strprompt("REAL name", tmpname, 29);
141 strprompt("Address", tmpaddr, 24);
142 strprompt("City/town", tmpcity, 14);
143 strprompt("State/province", tmpstate, 2);
144 strprompt("ZIP/Postal Code", tmpzip, 10);
145 strprompt("Country", tmpcountry, 31);
146 strprompt("Telephone number", tmpphone, 14);
150 strcpy(holdemail, tmpemail);
151 strprompt("Email address", tmpemail, 31);
152 r = CtdlIPCDirectoryLookup(tmpemail, buf);
154 extract_token(diruser, buf, 0, '@');
155 extract_token(dirnode, buf, 1, '@');
158 if ((strcasecmp(diruser, fullname))
159 || (strcasecmp(dirnode, serv_info.serv_nodename))) {
161 "\nYou can't use %s as your address.\n",
164 "It is already in use by %s @ %s.\n",
167 strcpy(tmpemail, holdemail);
172 /* now send the registration info back to the server */
173 reg = (char *)realloc(reg, 4096); /* Overkill? */
175 sprintf(reg, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
176 tmpname, tmpaddr, tmpcity, tmpstate,
177 tmpzip, tmpphone, tmpemail, tmpcountry);
178 r = CtdlIPCSetRegistration(reg, buf);
180 scr_printf("%s\n", buf);
187 { /* make all messages old in current room */
189 int r; /* IPC response code */
191 if (rc_alt_semantics) {
192 if (maxmsgnum == highest_msg_read == 0) {
193 /* err_printf("maxmsgnum == highest_msg_read == 0\n"); */
196 r = CtdlIPCSetLastRead((maxmsgnum > highest_msg_read) ?
197 maxmsgnum : highest_msg_read, buf);
199 r = CtdlIPCSetLastRead(0, buf);
202 scr_printf("%s\n", buf);
206 * only make messages old in this room that have been read
211 int r; /* IPC response code */
213 r = CtdlIPCSetLastRead(highest_msg_read, buf);
215 scr_printf("%s\n", &buf[4]);
220 * This routine completes a client upload
222 void do_upload(int fd)
226 long transmitted_bytes, total_bytes;
230 /* learn the size of the file */
231 total_bytes = lseek(fd, 0L, 2);
234 transmitted_bytes = 0L;
235 progress(transmitted_bytes, total_bytes);
237 bytes_to_send = read(fd, tbuf, 4096);
238 if (bytes_to_send > 0) {
239 snprintf(buf, sizeof buf, "WRIT %d", bytes_to_send);
243 bytes_expected = atoi(&buf[4]);
244 serv_write(tbuf, bytes_expected);
246 scr_printf("%s\n", &buf[4]);
249 transmitted_bytes = transmitted_bytes + (long) bytes_to_send;
250 progress(transmitted_bytes, total_bytes);
251 } while (bytes_to_send > 0);
253 /* close the upload file, locally and at the server */
257 scr_printf("%s\n", &buf[4]);
262 * client-based uploads (for users with their own clientware)
264 void cli_upload(void)
273 if ((room_flags & QR_UPLOAD) == 0) {
274 scr_printf("*** You cannot upload to this room.\n");
277 newprompt("File to be uploaded: ", flnm, 55);
278 fd = open(flnm, O_RDONLY);
280 scr_printf("Cannot open '%s': %s\n", flnm, strerror(errno));
283 scr_printf("Enter a description of this file:\n");
284 newprompt(": ", desc, 75);
286 /* keep generating filenames in hope of finding a unique one */
290 return; /* fail if tried 10 times */
292 while ((strlen(buf) > 0) && (haschar(buf, '/')))
293 strcpy(buf, &buf[1]);
295 size_t tmp = strlen(buf);
296 snprintf(&buf[tmp], sizeof buf - tmp, "%d", a);
298 snprintf(tbuf, sizeof tbuf, "UOPN %s|%s", buf, desc);
302 scr_printf("%s\n", &buf[4]);
304 } while (buf[0] != '2');
306 /* at this point we have an open upload file at the server */
312 * Function used for various image upload commands
314 void cli_image_upload(char *keyname)
320 snprintf(buf, sizeof buf, "UIMG 0|%s", keyname);
324 scr_printf("%s\n", &buf[4]);
327 newprompt("Image file to be uploaded: ", flnm, 55);
328 fd = open(flnm, O_RDONLY);
330 scr_printf("Cannot open '%s': %s\n", flnm, strerror(errno));
333 snprintf(buf, sizeof buf, "UIMG 1|%s", keyname);
337 scr_printf("%s\n", &buf[4]);
345 * protocol-based uploads (Xmodem, Ymodem, Zmodem)
348 { /* c = upload mode */
358 if ((room_flags & QR_UPLOAD) == 0) {
359 scr_printf("*** You cannot upload to this room.\n");
362 /* we don't need a filename when receiving batch y/z modem */
363 if ((c == 2) || (c == 3))
366 newprompt("Enter filename: ", flnm, 15);
368 for (a = 0; a < strlen(flnm); ++a)
369 if ((flnm[a] == '/') || (flnm[a] == '\\') || (flnm[a] == '>')
370 || (flnm[a] == '?') || (flnm[a] == '*')
371 || (flnm[a] == ';') || (flnm[a] == '&'))
374 newprompt("Enter a short description of the file:\n: ", desc, 150);
376 /* create a temporary directory... */
377 if (mkdir(tempdir, 0700) != 0) {
378 scr_printf("*** Could not create temporary directory %s: %s\n",
379 tempdir, strerror(errno));
382 /* now do the transfer ... in a separate process */
389 scr_printf("Receiving %s - press Ctrl-D to end.\n", flnm);
390 fp = fopen(flnm, "w");
406 execlp("rx", "rx", flnm, NULL);
411 execlp("rb", "rb", NULL);
416 execlp("rz", "rz", NULL);
422 } while ((b != xfer_pid) && (b != (-1)));
427 scr_printf("\r*** Transfer unsuccessful.\n");
431 scr_printf("\r*** Transfer successful. Sending file(s) to server...\n");
432 snprintf(buf, sizeof buf, "cd %s; ls", tempdir);
433 lsfp = popen(buf, "r");
435 while (fgets(flnm, sizeof flnm, lsfp) != NULL) {
436 flnm[strlen(flnm) - 1] = 0;
437 snprintf(buf, sizeof buf, "%s/%s", tempdir, flnm);
438 fd = open(buf, O_RDONLY);
442 snprintf(buf, sizeof buf, "UOPN %s|%s", flnm, desc);
444 size_t tmp = strlen(buf);
452 } while ((buf[0] != '2') && (a < 100));
455 a = read(fd, tbuf, 4096);
457 snprintf(buf, sizeof buf, "WRIT %d", a);
467 scr_printf("%s\n", &buf[4]);
478 void val_user(char *user, int do_validate)
484 int r; /* IPC response code */
486 snprintf(cmd, sizeof cmd, "GREG %s", user);
495 scr_printf("User #%s - %s ", buf, &cmd[4]);
497 scr_printf("PW: %s\n", buf);
499 scr_printf("%s\n", buf);
501 scr_printf("%s\n", buf);
503 scr_printf("%s, ", buf);
505 scr_printf("%s ", buf);
507 scr_printf("%s\n", buf);
509 scr_printf("%s\n", buf);
513 scr_printf("%s\n", buf);
515 scr_printf("%s\n", buf);
516 } while (strcmp(buf, "000"));
517 scr_printf("Current access level: %d (%s)\n", ax, axdefs[ax]);
519 scr_printf("%-30s\n%s\n", user, &cmd[4]);
523 /* now set the access level */
524 ax = intprompt("Access level", ax, 0, 6);
525 r = CtdlIPCValidateUser(user, ax, cmd);
527 scr_printf("%s\n", cmd);
534 { /* validate new users */
538 int r; /* IPC response code */
541 r = CtdlIPCNextUnvalidatedUser(cmd);
545 scr_printf("%s\n", cmd);
547 extract(buf, cmd, 0);
550 } while (finished == 0);
560 signal(SIGINT, SIG_DFL);
561 signal(SIGQUIT, SIG_DFL);
562 execlp(getenv("SHELL"), getenv("SHELL"), NULL);
563 err_printf("Could not open a shell: %s\n", strerror(errno));
568 } while ((a != b) && (a != (-1)));
574 * <.A>ide <F>ile <D>elete command
576 void deletefile(void)
581 newprompt("Filename: ", filename, 31);
582 if (strlen(filename) == 0)
584 CtdlIPCDeleteFile(filename, buf);
585 err_printf("%s\n", buf);
589 * <.A>ide <F>ile <S>end command
591 void netsendfile(void)
593 char filename[32], destsys[20], buf[SIZ];
595 newprompt("Filename: ", filename, 31);
596 if (strlen(filename) == 0)
598 newprompt("System to send to: ", destsys, 19);
599 CtdlIPCNetSendFile(filename, destsys, buf);
600 err_printf("%s\n", buf);
605 * <.A>ide <F>ile <M>ove command
610 char newroom[ROOMNAMELEN];
613 newprompt("Filename: ", filename, 63);
614 if (strlen(filename) == 0)
616 newprompt("Enter target room: ", newroom, ROOMNAMELEN - 1);
617 CtdlIPCMoveFile(filename, newroom, buf);
618 err_printf("%s\n", buf);
623 * list of users who have filled out a bio
633 pprintf("%s\n", &buf[4]);
636 while (serv_gets(buf), strcmp(buf, "000")) {
637 if ((pos + strlen(buf) + 5) > screenwidth) {
641 pprintf("%s, ", buf);
642 pos = pos + strlen(buf) + 2;
644 pprintf("%c%c \n\n", 8, 8);
657 newprompt("Read bio for who ('?' for list) : ", who, 25);
659 if (!strcmp(who, "?"))
661 } while (!strcmp(who, "?"));
662 snprintf(buf, sizeof buf, "RBIO %s", who);
666 pprintf("%s\n", &buf[4]);
669 while (serv_gets(buf), strcmp(buf, "000")) {
670 pprintf("%s\n", buf);
676 * General system configuration command
678 void do_system_configuration(void)
683 int expire_value = 0;
687 /* Clear out the config buffers */
688 memset(&sc[0][0], 0, sizeof(sc));
690 /* Fetch the current config */
691 serv_puts("CONF get");
695 while (serv_gets(buf), strcmp(buf, "000")) {
697 strcpy(&sc[a][0], buf);
702 /* Fetch the expire policy (this will silently fail on old servers,
703 * resulting in "default" policy)
705 serv_puts("GPEX site");
708 expire_mode = extract_int(&buf[4], 0);
709 expire_value = extract_int(&buf[4], 1);
713 /* Identification parameters */
715 strprompt("Node name", &sc[0][0], 15);
716 strprompt("Fully qualified domain name", &sc[1][0], 63);
717 strprompt("Human readable node name", &sc[2][0], 20);
718 strprompt("Modem dialup number", &sc[3][0], 15);
719 strprompt("Geographic location of this system", &sc[12][0], 31);
720 strprompt("Name of system administrator", &sc[13][0], 25);
721 strprompt("Paginator prompt", &sc[10][0], 79);
723 /* Security parameters */
725 snprintf(sc[7], sizeof sc[7], "%d", (boolprompt(
726 "Require registration for new users",
728 snprintf(sc[29], sizeof sc[29], "%d", (boolprompt(
729 "Disable self-service user account creation",
731 strprompt("Initial access level for new users", &sc[6][0], 1);
732 strprompt("Access level required to create rooms", &sc[19][0], 1);
733 snprintf(sc[4], sizeof sc[4], "%d", (boolprompt(
734 "Automatically give room aide privs to a user who creates a private room",
737 snprintf(sc[8], sizeof sc[8], "%d", (boolprompt(
738 "Automatically move problem user messages to twit room",
741 strprompt("Name of twit room", &sc[9][0], ROOMNAMELEN);
742 snprintf(sc[11], sizeof sc[11], "%d", (boolprompt(
743 "Restrict Internet mail to only those with that privilege",
745 snprintf(sc[26], sizeof sc[26], "%d", (boolprompt(
746 "Allow Aides to Zap (forget) rooms",
748 snprintf(sc[30], sizeof sc[29], "%d", (boolprompt(
749 "Allow system Aides access to user mailboxes",
752 if (strlen(&sc[18][0]) > 0) logpages = 1;
754 logpages = boolprompt("Log all pages", logpages);
756 strprompt("Name of logging room", &sc[18][0], ROOMNAMELEN);
765 strprompt("Server connection idle timeout (in seconds)", &sc[5][0], 4);
766 strprompt("Maximum concurrent sessions", &sc[14][0], 4);
767 strprompt("Maximum message length", &sc[20][0], 20);
768 strprompt("Minimum number of worker threads", &sc[21][0], 3);
769 strprompt("Maximum number of worker threads", &sc[22][0], 3);
771 /* no longer applicable ... deprecated
772 strprompt("Server-to-server networking password", &sc[15][0], 19);
775 strprompt("How often to run network jobs (in seconds)", &sc[28][0], 5);
776 strprompt("SMTP server port (-1 to disable)", &sc[24][0], 5);
777 strprompt("POP3 server port (-1 to disable)", &sc[23][0], 5);
778 strprompt("IMAP server port (-1 to disable)", &sc[27][0], 5);
780 /* Expiry settings */
781 strprompt("Default user purge time (days)", &sc[16][0], 5);
782 strprompt("Default room purge time (days)", &sc[17][0], 5);
784 /* Angels and demons dancing in my head... */
786 snprintf(buf, sizeof buf, "%d", expire_mode);
787 strprompt("System default message expire policy (? for list)",
791 "1. Never automatically expire messages\n"
792 "2. Expire by message count\n"
793 "3. Expire by message age\n");
795 } while ((buf[0] < 49) || (buf[0] > 51));
796 expire_mode = buf[0] - 48;
798 /* ...lunatics and monsters underneath my bed */
799 if (expire_mode == 2) {
800 snprintf(buf, sizeof buf, "%d", expire_value);
801 strprompt("Keep how many messages online?", buf, 10);
802 expire_value = atol(buf);
804 if (expire_mode == 3) {
805 snprintf(buf, sizeof buf, "%d", expire_value);
806 strprompt("Keep messages for how many days?", buf, 10);
807 expire_value = atol(buf);
810 scr_printf("Save this configuration? ");
812 serv_puts("CONF set");
815 for (a = 0; a < 31; ++a)
816 serv_puts(&sc[a][0]);
819 snprintf(buf, sizeof buf, "SPEX site|%d|%d",
820 expire_mode, expire_value);
828 * support function for do_internet_configuration()
830 void get_inet_rec_type(char *buf) {
833 keyopt(" <1> localhost (Alias for this computer)\n");
834 keyopt(" <2> gateway domain (Domain for all Citadel systems)\n");
835 keyopt(" <3> smart-host (Forward all outbound mail to this host)\n");
836 keyopt(" <4> directory (Consult the Global Address Book)\n");
837 keyopt(" <5> SpamAssassin (Address of SpamAssassin server)\n");
838 sel = intprompt("Which one", 1, 1, 5);
840 case 1: strcpy(buf, "localhost");
842 case 2: strcpy(buf, "gatewaydomain");
844 case 3: strcpy(buf, "smarthost");
846 case 4: strcpy(buf, "directory");
848 case 5: strcpy(buf, "spamassassin");
855 * Internet mail configuration
857 void do_internet_configuration(void) {
867 snprintf(buf, sizeof buf, "CONF getsys|%s", INTERNETCFG);
870 if (buf[0] == '1') while (serv_gets(buf), strcmp(buf, "000")) {
872 if (num_recs == 1) recs = malloc(sizeof(char *));
873 else recs = realloc(recs, (sizeof(char *)) * num_recs);
874 recs[num_recs-1] = malloc(SIZ);
875 strcpy(recs[num_recs-1], buf);
881 scr_printf("### Host or domain Record type \n");
883 scr_printf("--- -------------------------------------------------- --------------------\n");
884 for (i=0; i<num_recs; ++i) {
886 scr_printf("%3d ", i+1);
887 extract(buf, recs[i], 0);
889 scr_printf("%-50s ", buf);
890 extract(buf, recs[i], 1);
891 color(BRIGHT_MAGENTA);
892 scr_printf("%-20s\n", buf);
896 ch = keymenu("", "<A>dd|<D>elete|<S>ave|<Q>uit");
901 recs = malloc(sizeof(char *));
902 else recs = realloc(recs,
903 (sizeof(char *)) * num_recs);
904 newprompt("Enter host name: ",
907 get_inet_rec_type(&buf[strlen(buf)]);
908 recs[num_recs-1] = strdup(buf);
911 i = intprompt("Delete which one",
915 for (j=i; j<num_recs; ++j)
919 snprintf(buf, sizeof buf, "CONF putsys|%s",
924 for (i=0; i<num_recs; ++i) {
930 scr_printf("%s\n", &buf[4]);
935 quitting = boolprompt(
936 "Quit without saving", 0);
941 } while (quitting == 0);
944 for (i=0; i<num_recs; ++i) free(recs[i]);
952 * Edit network configuration for room sharing, mailing lists, etc.
954 void network_config_management(char *entrytype, char *comment) {
955 char filename[PATH_MAX];
956 char changefile[PATH_MAX];
967 if (strlen(editor_path) == 0) {
968 scr_printf("You must have an external editor configured in"
969 " order to use this function.\n");
973 snprintf(filename, sizeof filename, "%s.listedit", tmpnam(NULL));
974 snprintf(changefile, sizeof changefile, "%s.listedit", tmpnam(NULL));
976 tempfp = fopen(filename, "w");
977 if (tempfp == NULL) {
978 err_printf("Cannot open %s: %s\n", filename, strerror(errno));
982 fprintf(tempfp, "# Configuration for room: %s\n", room_name);
983 fprintf(tempfp, "# %s\n", comment);
984 fprintf(tempfp, "# Specify one per line.\n"
990 while(serv_gets(buf), strcmp(buf, "000")) {
991 extract(instr, buf, 0);
992 if (!strcasecmp(instr, entrytype)) {
993 extract(addr, buf, 1);
994 fprintf(tempfp, "%s\n", addr);
1000 e_ex_code = 1; /* start with a failed exit code */
1001 editor_pid = fork();
1002 cksum = file_checksum(filename);
1003 if (editor_pid == 0) {
1004 chmod(filename, 0600);
1006 sttybbs(SB_RESTORE);
1007 putenv("WINDOW_TITLE=Network configuration");
1008 execlp(editor_path, editor_path, filename, NULL);
1011 if (editor_pid > 0) {
1014 b = ka_wait(&e_ex_code);
1015 } while ((b != editor_pid) && (b >= 0));
1021 if (file_checksum(filename) == cksum) {
1022 err_printf("*** Not saving changes.\n");
1026 if (e_ex_code == 0) { /* Save changes */
1027 changefp = fopen(changefile, "w");
1030 if (buf[0] == '1') {
1031 while(serv_gets(buf), strcmp(buf, "000")) {
1032 extract(instr, buf, 0);
1033 if (strcasecmp(instr, entrytype)) {
1034 fprintf(changefp, "%s\n", buf);
1038 tempfp = fopen(filename, "r");
1039 while (fgets(buf, sizeof buf, tempfp) != NULL) {
1040 for (i=0; i<strlen(buf); ++i) {
1041 if (buf[i] == '#') buf[i] = 0;
1044 if (strlen(buf) > 0) {
1045 fprintf(changefp, "%s|%s\n", entrytype, buf);
1051 /* now write it to the server... */
1054 if (buf[0] == '4') {
1055 changefp = fopen(changefile, "r");
1056 if (changefp != NULL) {
1057 while (fgets(buf, sizeof buf,
1058 changefp) != NULL) {
1059 buf[strlen(buf) - 1] = 0;
1068 unlink(filename); /* Delete the temporary files */
1074 * IGnet node configuration
1076 void do_ignet_configuration(void) {
1086 snprintf(buf, sizeof buf, "CONF getsys|%s", IGNETCFG);
1089 if (buf[0] == '1') while (serv_gets(buf), strcmp(buf, "000")) {
1091 if (num_recs == 1) recs = malloc(sizeof(char *));
1092 else recs = realloc(recs, (sizeof(char *)) * num_recs);
1093 recs[num_recs-1] = malloc(SIZ);
1094 strcpy(recs[num_recs-1], buf);
1099 color(BRIGHT_WHITE);
1108 "------------------ "
1109 "-------------------------------- "
1111 for (i=0; i<num_recs; ++i) {
1113 scr_printf("%3d ", i+1);
1114 extract(buf, recs[i], 0);
1116 scr_printf("%-16s ", buf);
1117 extract(buf, recs[i], 1);
1118 color(BRIGHT_MAGENTA);
1119 scr_printf("%-18s ", buf);
1120 extract(buf, recs[i], 2);
1122 scr_printf("%-32s ", buf);
1123 extract(buf, recs[i], 3);
1124 color(BRIGHT_MAGENTA);
1125 scr_printf("%-3s\n", buf);
1129 ch = keymenu("", "<A>dd|<D>elete|<S>ave|<Q>uit");
1134 recs = malloc(sizeof(char *));
1135 else recs = realloc(recs,
1136 (sizeof(char *)) * num_recs);
1137 newprompt("Enter node name : ", buf, 16);
1139 newprompt("Enter shared secret: ",
1140 &buf[strlen(buf)], 18);
1142 newprompt("Enter host or IP : ",
1143 &buf[strlen(buf)], 32);
1144 strcat(buf, "|504");
1145 strprompt("Enter port number : ",
1146 &buf[strlen(buf)-3], 5);
1147 recs[num_recs-1] = strdup(buf);
1150 i = intprompt("Delete which one",
1151 1, 1, num_recs) - 1;
1154 for (j=i; j<num_recs; ++j)
1155 recs[j] = recs[j+1];
1158 snprintf(buf, sizeof buf, "CONF putsys|%s", IGNETCFG);
1161 if (buf[0] == '4') {
1162 for (i=0; i<num_recs; ++i) {
1168 scr_printf("%s\n", &buf[4]);
1173 quitting = boolprompt(
1174 "Quit without saving", 0);
1179 } while (quitting == 0);
1182 for (i=0; i<num_recs; ++i) free(recs[i]);
1188 * Filter list configuration
1190 void do_filterlist_configuration(void) {
1200 snprintf(buf, sizeof buf, "CONF getsys|%s", FILTERLIST);
1203 if (buf[0] == '1') while (serv_gets(buf), strcmp(buf, "000")) {
1205 if (num_recs == 1) recs = malloc(sizeof(char *));
1206 else recs = realloc(recs, (sizeof(char *)) * num_recs);
1207 recs[num_recs-1] = malloc(SIZ);
1208 strcpy(recs[num_recs-1], buf);
1213 color(BRIGHT_WHITE);
1221 "---------------------------- "
1222 "---------------------------- "
1225 for (i=0; i<num_recs; ++i) {
1227 scr_printf("%3d ", i+1);
1228 extract(buf, recs[i], 0);
1230 scr_printf("%-28s ", buf);
1231 extract(buf, recs[i], 1);
1232 color(BRIGHT_MAGENTA);
1233 scr_printf("%-28s ", buf);
1234 extract(buf, recs[i], 2);
1236 scr_printf("%-16s\n", buf);
1237 extract(buf, recs[i], 3);
1241 ch = keymenu("", "<A>dd|<D>elete|<S>ave|<Q>uit");
1246 recs = malloc(sizeof(char *));
1247 else recs = realloc(recs,
1248 (sizeof(char *)) * num_recs);
1249 newprompt("Enter user name: ", buf, 28);
1251 newprompt("Enter room name: ",
1252 &buf[strlen(buf)], 28);
1254 newprompt("Enter node name: ",
1255 &buf[strlen(buf)], 16);
1257 recs[num_recs-1] = strdup(buf);
1260 i = intprompt("Delete which one",
1261 1, 1, num_recs) - 1;
1264 for (j=i; j<num_recs; ++j)
1265 recs[j] = recs[j+1];
1268 snprintf(buf, sizeof buf, "CONF putsys|%s", FILTERLIST);
1271 if (buf[0] == '4') {
1272 for (i=0; i<num_recs; ++i) {
1278 scr_printf("%s\n", &buf[4]);
1283 quitting = boolprompt(
1284 "Quit without saving", 0);
1289 } while (quitting == 0);
1292 for (i=0; i<num_recs; ++i) free(recs[i]);