- switch(ch) {
- case 'a':
- ++num_recs;
- if (num_recs == 1) {
- recs = malloc(sizeof(char *));
- }
- else {
- recs = realloc(recs, (sizeof(char *)) * num_recs);
- }
- strcpy(buf, "pop3client|");
- newprompt("Enter host name: ", &buf[strlen(buf)], 28);
- strcat(buf, "|");
- newprompt("Enter user name: ", &buf[strlen(buf)], 28);
- strcat(buf, "|");
- newprompt("Enter password : ", &buf[strlen(buf)], 16);
- strcat(buf, "|");
- scr_printf("Keep messages on server instead of deleting them? ");
- sprintf(&buf[strlen(buf)], "%d", yesno());
- strcat(buf, "|");
- recs[num_recs-1] = strdup(buf);
- modified = 1;
- break;
- case 'd':
- i = intprompt("Delete which one",
- 1, 1, num_recs) - 1;
- free(recs[i]);
- --num_recs;
- for (j=i; j<num_recs; ++j)
- recs[j] = recs[j+1];
- modified = 1;
- break;
- case 's':
- r = 1;
+ switch (ch) {
+ case 'a':
+ ++num_recs;
+ if (num_recs == 1) {
+ recs = malloc(sizeof(char *));
+ } else {
+ recs = realloc(recs, (sizeof(char *)) * num_recs);
+ }
+ strcpy(buf, "pop3client|");
+ newprompt("Enter host name: ", &buf[strlen(buf)], 28);
+ strcat(buf, "|");
+ newprompt("Enter user name: ", &buf[strlen(buf)], 28);
+ strcat(buf, "|");
+ newprompt("Enter password : ", &buf[strlen(buf)], 16);
+ strcat(buf, "|");
+ scr_printf("Keep messages on server instead of deleting them? ");
+ sprintf(&buf[strlen(buf)], "%d", yesno());
+ strcat(buf, "|");
+ recs[num_recs - 1] = strdup(buf);
+ modified = 1;
+ break;
+ case 'd':
+ i = intprompt("Delete which one", 1, 1, num_recs) - 1;
+ free(recs[i]);
+ --num_recs;
+ for (j = i; j < num_recs; ++j)
+ recs[j] = recs[j + 1];
+ modified = 1;
+ break;
+ case 's':
+ r = 1;
+ for (i = 0; i < num_recs; ++i) {
+ r += 1 + strlen(recs[i]);
+ }
+ listing = (char *) calloc(1, r);
+ if (!listing) {
+ scr_printf("Can't save config - out of memory!\n");
+ logoff(ipc, 1);
+ }
+ if (num_recs)