Fix more warnings; output errors to the users.
[citadel.git] / citadel / textclient / tuiconfig.c
index 4ea9cc0f026022c86ce5d5df8ce959f090929307..60c1ada107ff7822979fc64daa35cac403cb9f66 100644 (file)
@@ -359,7 +359,7 @@ void do_system_configuration(CtdlIPC *ipc)
                        r += 1 + strlen(sc[a]);
                resp = (char *)calloc(1, r);
                if (!resp) {
-                       err_printf("Can't save config - out of memory!\n");
+                       scr_printf("Can't save config - out of memory!\n");
                        logoff(ipc, 1);
                }
                for (a = 0; a < NUM_CONFIGS; a++) {
@@ -368,18 +368,18 @@ void do_system_configuration(CtdlIPC *ipc)
                }
                r = CtdlIPCSetSystemConfig(ipc, resp, buf);
                if (r / 100 != 4) {
-                       err_printf("%s\n", buf);
+                       scr_printf("%s\n", buf);
                }
                free(resp);
 
                r = CtdlIPCSetMessageExpirationPolicy(ipc, 2, site_expirepolicy, buf);
                if (r / 100 != 2) {
-                       err_printf("%s\n", buf);
+                       scr_printf("%s\n", buf);
                }
 
                r = CtdlIPCSetMessageExpirationPolicy(ipc, 3, mbx_expirepolicy, buf);
                if (r / 100 != 2) {
-                       err_printf("%s\n", buf);
+                       scr_printf("%s\n", buf);
                }
 
        }
@@ -402,7 +402,7 @@ void get_inet_rec_type(CtdlIPC *ipc, char *buf) {
        keyopt(" <6> RBL            (domain suffix of spam hunting RBL)\n");
        keyopt(" <7> masq domains   (Domains as which users are allowed to masquerade)\n");
        keyopt(" <8> ClamAV         (Address of ClamAV clamd server)\n");
-       sel = intprompt("Which one", 1, 1, 7);
+       sel = intprompt("Which one", 1, 1, 8);
        switch(sel) {
                case 1: strcpy(buf, "localhost");
                        return;
@@ -434,7 +434,6 @@ void do_internet_configuration(CtdlIPC *ipc)
        int num_recs = 0;
        char **recs = NULL;
        char ch;
-       int badkey;
        int i, j;
        int quitting = 0;
        int modified = 0;
@@ -506,7 +505,7 @@ void do_internet_configuration(CtdlIPC *ipc)
                                        r += 1 + strlen(recs[i]);
                                resp = (char *)calloc(1, r);
                                if (!resp) {
-                                       err_printf("Can't save config - out of memory!\n");
+                                       scr_printf("Can't save config - out of memory!\n");
                                        logoff(ipc, 1);
                                }
                                if (num_recs) for (i = 0; i < num_recs; i++) {
@@ -515,7 +514,7 @@ void do_internet_configuration(CtdlIPC *ipc)
                                }
                                r = CtdlIPCSetSystemConfigByType(ipc, INTERNETCFG, resp, buf);
                                if (r / 100 != 4) {
-                                       err_printf("%s\n", buf);
+                                       scr_printf("%s\n", buf);
                                } else {
                                        scr_printf("Wrote %d records.\n", num_recs);
                                        modified = 0;
@@ -527,7 +526,7 @@ void do_internet_configuration(CtdlIPC *ipc)
                                        "Quit without saving", 0);
                                break;
                        default:
-                               badkey = 1;
+                               break;
                }
        } while (!quitting);
 
@@ -569,7 +568,7 @@ void network_config_management(CtdlIPC *ipc, char *entrytype, char *comment)
 
        tempfp = fopen(filename, "w");
        if (tempfp == NULL) {
-               err_printf("Cannot open %s: %s\n", filename, strerror(errno));
+               scr_printf("Cannot open %s: %s\n", filename, strerror(errno));
                return;
        }
 
@@ -604,7 +603,6 @@ void network_config_management(CtdlIPC *ipc, char *entrytype, char *comment)
        fclose(tempfp);
 
        e_ex_code = 1;  /* start with a failed exit code */
-       screen_reset();
        stty_ctdl(SB_RESTORE);
        editor_pid = fork();
        cksum = file_checksum(filename);
@@ -621,11 +619,10 @@ void network_config_management(CtdlIPC *ipc, char *entrytype, char *comment)
                } while ((b != editor_pid) && (b >= 0));
        editor_pid = (-1);
        stty_ctdl(0);
-       screen_set();
        }
 
        if (file_checksum(filename) == cksum) {
-               err_printf("*** No changes to save.\n");
+               scr_printf("*** No changes to save.\n");
                e_ex_code = 1;
        }
 
@@ -689,7 +686,6 @@ void do_ignet_configuration(CtdlIPC *ipc) {
        int num_recs = 0;
        char **recs = NULL;
        char ch;
-       int badkey;
        int i, j;
        int quitting = 0;
        int modified = 0;
@@ -778,7 +774,7 @@ void do_ignet_configuration(CtdlIPC *ipc) {
                                        r += 1 + strlen(recs[i]);
                                listing = (char*) calloc(1, r);
                                if (!listing) {
-                                       err_printf("Can't save config - out of memory!\n");
+                                       scr_printf("Can't save config - out of memory!\n");
                                        logoff(ipc, 1);
                                }
                                if (num_recs) for (i = 0; i < num_recs; ++i) {
@@ -799,7 +795,7 @@ void do_ignet_configuration(CtdlIPC *ipc) {
                                        "Quit without saving", 0);
                                break;
                        default:
-                               badkey = 1;
+                               break;
                }
        } while (!quitting);
 
@@ -819,7 +815,6 @@ void do_filterlist_configuration(CtdlIPC *ipc)
        int num_recs = 0;
        char **recs = NULL;
        char ch;
-       int badkey;
        int i, j;
        int quitting = 0;
        int modified = 0;
@@ -903,7 +898,7 @@ void do_filterlist_configuration(CtdlIPC *ipc)
                                        r += 1 + strlen(recs[i]);
                                listing = (char*) calloc(1, r);
                                if (!listing) {
-                                       err_printf("Can't save config - out of memory!\n");
+                                       scr_printf("Can't save config - out of memory!\n");
                                        logoff(ipc, 1);
                                }
                                if (num_recs) for (i = 0; i < num_recs; ++i) {
@@ -924,7 +919,7 @@ void do_filterlist_configuration(CtdlIPC *ipc)
                                        "Quit without saving", 0);
                                break;
                        default:
-                               badkey = 1;
+                               break;
                }
        } while (!quitting);
 
@@ -946,7 +941,6 @@ void do_pop3client_configuration(CtdlIPC *ipc)
        int num_recs = 0;
        char **recs = NULL;
        char ch;
-       int badkey;
        int i, j;
        int quitting = 0;
        int modified = 0;
@@ -1053,7 +1047,7 @@ void do_pop3client_configuration(CtdlIPC *ipc)
                                }
                                listing = (char*) calloc(1, r);
                                if (!listing) {
-                                       err_printf("Can't save config - out of memory!\n");
+                                       scr_printf("Can't save config - out of memory!\n");
                                        logoff(ipc, 1);
                                }
                                if (num_recs) for (i = 0; i < num_recs; ++i) {
@@ -1092,7 +1086,7 @@ void do_pop3client_configuration(CtdlIPC *ipc)
                                        "Quit without saving", 0);
                                break;
                        default:
-                               badkey = 1;
+                               break;
                }
        } while (!quitting);
 
@@ -1116,7 +1110,6 @@ void do_rssclient_configuration(CtdlIPC *ipc)
        int num_recs = 0;
        char **recs = NULL;
        char ch;
-       int badkey;
        int i, j;
        int quitting = 0;
        int modified = 0;
@@ -1198,7 +1191,7 @@ void do_rssclient_configuration(CtdlIPC *ipc)
                                }
                                listing = (char*) calloc(1, r);
                                if (!listing) {
-                                       err_printf("Can't save config - out of memory!\n");
+                                       scr_printf("Can't save config - out of memory!\n");
                                        logoff(ipc, 1);
                                }
                                if (num_recs) for (i = 0; i < num_recs; ++i) {
@@ -1237,7 +1230,7 @@ void do_rssclient_configuration(CtdlIPC *ipc)
                                        "Quit without saving", 0);
                                break;
                        default:
-                               badkey = 1;
+                               break;
                }
        } while (!quitting);