Ignore:
Timestamp:
Sep 25, 2013, 9:03:25 AM (11 years ago)
Author:
Bruno Cornec
Message:
  • revert r3188 & r3189 as I started to work on branch 3.0 before deciding it was much better to do it in 3.2. This will allow some small maintenance work on 3.0 if needed, while pushing all the rest to 3.2 and providing early access to it.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0/mondo/src/common/newt-specific.c

    r3188 r3192  
    9797    extern int g_current_media_number;
    9898    pid_t g_main_pid = 0;       ///< The PID of the main Mondo process.
    99     long g_maximum_progress = 999L; ///< The maximum amount of progress (100%) for the currently opened progress form.
     99    long g_maximum_progress = 999;  ///< The maximum amount of progress (100%) for the currently opened progress form.
    100100    long g_current_progress = -999; ///< The current amount of progress (filelist #, etc.) for the currently opened progress form.
    101     long g_start_time = 0L;     ///< The time (in seconds since the epoch) that the progress form was opened.
     101    long g_start_time = 0;      ///< The time (in seconds since the epoch) that the progress form was opened.
    102102    bool g_text_mode = TRUE;    ///< If FALSE, use a newt interface; if TRUE, use an ugly (but more compatible) dumb terminal interface.
     103    char g_xmondo_stdin[MAX_NEWT_COMMENT_LEN],  ///< ... @bug Unneeded w/current XMondo.
     104     g_xmondo_stdout[MAX_NEWT_COMMENT_LEN]; ///< .... @bug Unneeded w/current XMondo.
     105    bool g_called_by_xmondo = FALSE;    ///< @bug Unneeded w/current XMondo.
    103106    char *g_selfmounted_isodir; ///< Holds the NETFS mountpoint if mounted via mondoarchive.
    104107
    105108/* @} - end of globalGroup */
     109
     110//int g_fd_in=-1, g_fd_out=-1;
    106111
    107112    void popup_and_OK(char *);
     
    120125
    121126        /*@ buffers ********************************************************** */
    122         int i = 0;
    123         char *tmp = NULL;
     127        int i;
     128        char *p;
    124129
    125130        assert_string_is_neither_NULL_nor_zerolength(prompt);
     
    131136        }
    132137        if (g_text_mode) {
     138
     139            char *tmp;
     140            tmp = malloc(MAX_NEWT_COMMENT_LEN);
     141
    133142            while (1) {
    134                 sync();
    135                 printf("---promptdialogYN---1--- %s\n---promptdialogYN---Q--- [yes] [no] ---\n--> ", prompt);
    136                 mr_getline(tmp, stdin);
     143                paranoid_system("sync");
     144                printf
     145                    ("---promptdialogYN---1--- %s\n---promptdialogYN---Q--- [yes] [no] ---\n--> ",
     146                     prompt);
     147                p= fgets(tmp, MAX_NEWT_COMMENT_LEN, stdin);
     148                if (!p) {
     149                    //FIXME
     150                }
    137151                if (tmp[strlen(tmp) - 1] == '\n')
    138152                    tmp[strlen(tmp) - 1] = '\0';
     
    143157                }
    144158                if (strstr("yesYES", tmp)) {
    145                     mr_free(tmp);
     159                    paranoid_free(tmp);
    146160                    return (TRUE);
    147161                } else if (strstr("NOno", tmp)) {
    148                     mr_free(tmp);
     162                    paranoid_free(tmp);
    149163                    return (FALSE);
    150164                } else {
    151                     sync();
    152                     printf("Please enter either YES or NO (or yes or no, or y or n, or...)\n");
     165                    paranoid_system("sync");
     166                    printf
     167                        ("Please enter either YES or NO (or yes or no, or y or n, or...)\n");
    153168                }
    154169            }
     
    168183
    169184        /*@ buffer *********************************************************** */
    170         char *tmp = NULL;
     185        char *tmp;
     186        char *p;
    171187        int i;
    172188
     
    177193            finish(1);
    178194        }
    179 
     195        tmp = malloc(MAX_NEWT_COMMENT_LEN);
    180196        if (g_text_mode) {
    181             sync();
    182             printf("---promptdialogOKC---1--- %s\n---promptdialogOKC---Q--- [OK] [Cancel] ---\n--> ", prompt);
    183             mr_getline(tmp, stdin);
     197            paranoid_system("sync");
     198            printf
     199                ("---promptdialogOKC---1--- %s\n---promptdialogOKC---Q--- [OK] [Cancel] ---\n--> ",
     200                 prompt);
     201            p = fgets(tmp, MAX_NEWT_COMMENT_LEN, stdin);
     202            if (!p) {
     203                // FIXME
     204            }
    184205            if (tmp[strlen(tmp) - 1] == '\n')
    185206                tmp[strlen(tmp) - 1] = '\0';
     
    190211            }
    191212            if (strstr("okOKOkYESyes", tmp)) {
    192                 mr_free(tmp);
     213                paranoid_free(tmp);
    193214                return (TRUE);
    194215            } else {
    195                 mr_free(tmp);
     216                paranoid_free(tmp);
    196217                return (FALSE);
    197218            }
    198219        } else {
     220            paranoid_free(tmp);
    199221            return (popup_with_buttons(prompt, " Okay ", "Cancel"));
    200222        }
     
    242264        }
    243265        if (g_current_progress == -999) {
    244             log_msg(2, "Trying to close the progress form when it ain't open!");
     266            log_msg(2,
     267                    "Trying to close the progress form when it ain't open!");
    245268            return;
    246269        }
     
    278301        mr_asprintf(tmp1,"kill `%s`", tmp);
    279302        run_program_and_log_output(tmp1, TRUE);
    280         mr_free(tmp1);
    281     }
    282     mr_free(tmp);
     303        paranoid_free(tmp1);
     304    }
     305    paranoid_free(tmp);
    283306}
    284307
     
    289312 * @note This function never returns.
    290313 */
    291 void fatal_error(char *error_string) {
    292 
     314    void
     315     fatal_error(char *error_string) {
    293316        /*@ buffers ***************************************************** */
    294         char *command = NULL;
     317        char fatalstr[MAX_NEWT_COMMENT_LEN] =
     318            "-------FATAL ERROR---------";
     319        char *tmp;
     320        char *command;
    295321        static bool already_exiting = FALSE;
    296322
    297323        /*@ end vars **************************************************** */
    298324
     325        malloc_string(command);
     326        tmp = malloc(MAX_NEWT_COMMENT_LEN);
    299327        set_signals(FALSE);     // link to external func
    300328        g_exiting = TRUE;
     
    304332            log_msg(2, "mastermind %d is exiting", (int) getpid());
    305333            kill(g_main_pid, SIGTERM);
     334            paranoid_free(tmp);
    306335            finish(1);
    307336        }
     
    311340                log_msg(2, "non-m/m %d is exiting", (int) getpid());
    312341                kill(g_main_pid, SIGTERM);
     342                paranoid_free(tmp);
    313343                finish(1);
    314344            }
     
    318348        if (already_exiting) {
    319349            log_msg(3, "...I'm already exiting. Give me time, Julian!");
     350            paranoid_free(tmp);
    320351            finish(1);
    321352        }
     
    328359        kill_anything_like_this("ntfsclone");
    329360        sync();
     361        /*
     362        sprintf(tmp, "umount %s", g_tmpfs_mountpt);
     363        for (i = 0; i < 10 && run_program_and_log_output(tmp, 5); i++) {
     364            log_msg(2, "Waiting for child processes to terminate");
     365            sleep(1);
     366            run_program_and_log_output(tmp, 5);
     367        }
     368        */
    330369
    331370        if (chdir("/")) {
     
    333372        }
    334373        if (g_selfmounted_isodir) {
    335             mr_asprintf(command, "umount -d %s", g_selfmounted_isodir);
     374            sprintf(command, "umount -d %s", g_selfmounted_isodir);
    336375            run_program_and_log_output(command, 5);
    337             mr_free(command);
    338             mr_asprintf(command, "rmdir %s", g_selfmounted_isodir);
     376            sprintf(command, "rmdir %s", g_selfmounted_isodir);
    339377            run_program_and_log_output(command, 5);
    340             mr_free(command);
    341378        }
    342379
    343380        if (!g_text_mode) {
    344             log_msg(0, "-------FATAL ERROR---------");
     381            log_msg(0, fatalstr);
    345382            log_msg(0, error_string);
     383            //      popup_and_OK (error_string);
     384            newtFinished();
    346385        }
    347386
    348387        printf("---FATALERROR--- %s\n", error_string);
    349         printf("If you require technical support, please contact the mailing list.\n");
     388        printf
     389                ("If you require technical support, please contact the mailing list.\n");
    350390        printf("See http://www.mondorescue.org for details.\n");
    351         printf("The list's members can help you, if you attach that file to your e-mail.\n");
     391        printf
     392                ("The list's members can help you, if you attach that file to your e-mail.\n");
    352393        printf("Log file: %s\n", MONDO_LOGFILE);
    353394        printf("Mondo has aborted.\n");
     
    355396            log_msg(3, "FYI - g_main_pid is blank");
    356397        }
     398        paranoid_free(tmp);
     399        paranoid_free(command);
    357400        finish(254);
    358401    }
     
    377420 * @note This function never returns.
    378421 */
    379 void finish(int signal) {
    380 
     422    void
     423     finish(int signal) {
    381424        char *command = NULL;
     425
     426        /*  if (signal==0) { popup_and_OK("Please press <enter> to quit."); } */
     427
     428        /* newtPopHelpLine(); */
    382429
    383430        /*  Before removing dir, make sure we're out of them */
     
    389436            mr_asprintf(command, "umount -d %s", g_selfmounted_isodir);
    390437            run_program_and_log_output(command, 1);
    391             mr_free(command);
    392 
     438            paranoid_free(command);
    393439            mr_asprintf(command, "rmdir %s", g_selfmounted_isodir);
    394440            run_program_and_log_output(command, 1);
    395             mr_free(command);
    396         }
     441            paranoid_free(command);
     442        }
     443        if (!g_text_mode) {
     444            if (does_file_exist("/THIS-IS-A-RAMDISK")) {
     445                log_msg(1, "Calling newtFinished()");
     446                newtFinished();
     447            } else {
     448                log_msg(1, "Calling newtSuspend()");
     449                newtSuspend();
     450            }
     451        }
     452        printf("Execution run ended; result=%d\n", signal);
     453        printf("Type 'less %s' to see the output log\n", MONDO_LOGFILE);
    397454        if (bkpinfo->tmpdir) {
    398455            log_msg(8,"tempdir is %s",bkpinfo->tmpdir);
     
    419476        mr_free(bkpinfo->exclude_paths);
    420477        mr_free(bkpinfo->subdir);
     478
    421479        /* Then free the structure */
    422480        paranoid_free(bkpinfo);
    423 
    424481        free_libmondo_global_strings();
    425482        free_newt_stuff();
    426         if (!g_text_mode) {
    427             if (does_file_exist("/THIS-IS-A-RAMDISK")) {
    428                 log_msg(1, "Calling newtFinished()");
    429                 newtFinished();
    430             } else {
    431                 log_msg(1, "Calling newtSuspend()");
    432                 newtSuspend();
    433             }
    434         }
    435         printf("Execution run ended; result=%d\n", signal);
    436         printf("Type 'less %s' to see the output log\n", MONDO_LOGFILE);
    437483        exit(signal);
    438484    }
     485
     486
     487
    439488
    440489
     
    445494 * @param grep_for_me If not "", then only give lines in @p filename that match this regular expression.
    446495 */
    447 void log_file_end_to_screen(char *filename, char *grep_for_me) {
     496    void
     497     log_file_end_to_screen(char *filename, char *grep_for_me) {
    448498
    449499        /*@ buffers ********************************************************** */
     
    465515        }
    466516        if (grep_for_me[0] != '\0') {
    467             mr_asprintf(command, "grep '%s' %s | tail -n%d", grep_for_me, filename, g_noof_log_lines);
    468         } else {
    469             mr_asprintf(command, "tail -n%d %s", g_noof_log_lines, filename);
     517            mr_asprintf(command, "grep '%s' %s | tail -n%d",
     518                    grep_for_me, filename, g_noof_log_lines);
     519        } else {
     520            mr_asprintf(command, "tail -n%d %s", g_noof_log_lines,
     521                    filename);
    470522        }
    471523        fin = popen(command, "r");
     
    505557 * @note The message is also written to the logfile.
    506558 */
    507 void log_to_screen(const char *fmt, ...) {
     559    void
     560     log_to_screen(const char *fmt, ...) {
    508561
    509562        /*@ int ************************************************************** */
     
    561614 * @param output The string to write.
    562615 */
    563 void mvaddstr_and_log_it(int y, int x, char *output) {
    564 
     616    void
     617     mvaddstr_and_log_it(int y, int x, char *output) {
    565618        assert_string_is_neither_NULL_nor_zerolength(output);
    566619        log_msg(0, output);
     
    580633 * @param ttl The title to use for the evalcall form.
    581634 */
    582 void open_evalcall_form(char *ttl) {
     635    void
     636     open_evalcall_form(char *ttl) {
    583637
    584638        /*@ buffers ********************************************************* */
    585         char *tmp = NULL;
     639        char *title;
     640        char *tmp;
    586641
    587642        /*@ initialize ****************************************************** */
    588643        g_isoform_old_progress = -1;
    589644        g_mysterious_dot_counter = 0;
     645        malloc_string(title);
     646        malloc_string(tmp);
    590647
    591648        assert(ttl != NULL);
    592         malloc_string(tmp);
    593         strcpy(g_isoform_header_str, ttl);
     649        strcpy(title, ttl);
     650        strcpy(g_isoform_header_str, title);
     651//  center_string (title, 80);
    594652        if (g_text_mode) {
    595             log_msg(0, ttl);
    596         } else {
    597             strcpy(tmp, ttl);
     653            log_msg(0, title);
     654        } else {
     655            strcpy(tmp, title);
    598656            center_string(tmp, 80);
    599657            newtPushHelpLine(tmp);
     
    606664            g_isoform_header = newtLabel(1, 1, g_isoform_header_str);
    607665            g_isoform_scale = newtScale(3, 3, 34, 100);
    608             newtCenteredWindow(40, 7, ttl);
     666            //      newtOpenWindow (20, 6, 40, 7, title);      // "Please Wait");
     667            newtCenteredWindow(40, 7, title);
    609668            g_isoform_main = newtForm(NULL, NULL, 0);
    610669            g_isoform_timeline = newtLabel(1, 5, "                    ");
     
    618677        update_evalcall_form(0);
    619678        paranoid_free(tmp);
     679        paranoid_free(title);
    620680    }
    621681
     
    631691 * @param max_val The maximum amount of progress (number of filesets, etc.)
    632692 */
    633 void open_progress_form(char *title, char *b1, char *b2, char *b3, long max_val) {
     693    void
     694     open_progress_form(char *title, char *b1, char *b2, char *b3,
     695                        long max_val) {
    634696
    635697        /*@ buffers ********************************************************* */
    636698        char *b1c;
    637         char *blurb1 = NULL;
    638         char *blurb2 = NULL;
    639         char *blurb3 = NULL;
     699        char *blurb1;
     700        char *blurb2;
     701        char *blurb3;
    640702
    641703        /*@ initialize ****************************************************** */
     
    643705
    644706        malloc_string(b1c);
     707        malloc_string(blurb1);
     708        malloc_string(blurb2);
     709        malloc_string(blurb3);
    645710
    646711        assert(title != NULL);
     
    649714        assert(b3 != NULL);
    650715
    651         mr_asprintf(blurb1,  "%s", b1);
    652         mr_asprintf(blurb2,  "%s", b2);
    653         mr_asprintf(blurb3,  "%s", b3);
    654 
     716        strcpy(blurb1, b1);
     717        strcpy(blurb2, b2);
     718        strcpy(blurb3, b3);
    655719        strcpy(b1c, b1);
    656720        center_string(b1c, 80);
     
    673737            g_blurb2 = newtLabel(2, 2, blurb3);
    674738            g_blurb3 = newtLabel(2, 4, blurb2);
     739            //      newtOpenWindow (10, 4, 60, 11, title);
    675740            newtCenteredWindow(60, 11, title);
    676             g_scale = newtScale(3, 6, 54, (long long)g_maximum_progress);
     741            g_scale = newtScale(3, 6, 54, g_maximum_progress);
    677742            g_progressForm = newtForm(NULL, NULL, 0);
    678743            g_percentline = newtLabel(10, 9, "                       ");
    679744            g_timeline = newtLabel(10, 8, "                    ");
    680             newtFormAddComponents(g_progressForm, g_percentline, g_timeline, g_scale, g_blurb1, g_blurb3, g_blurb2, NULL);
     745            newtFormAddComponents(g_progressForm, g_percentline,
     746                                  g_timeline, g_scale, g_blurb1, g_blurb3,
     747                                  g_blurb2, NULL);
    681748            newtPushHelpLine(b1c);
    682749            newtDrawForm(g_progressForm);
     
    685752        update_progress_form_full(blurb1, blurb2, blurb3);
    686753        paranoid_free(b1c);
    687         mr_free(blurb1);
    688         mr_free(blurb2);
    689         mr_free(blurb3);
     754        paranoid_free(blurb1);
     755        paranoid_free(blurb2);
     756        paranoid_free(blurb3);
    690757    }
    691758
     
    694761 * @param prompt The message.
    695762 */
    696 void popup_and_OK(char *prompt) {
    697 
     763    void
     764     popup_and_OK(char *prompt) {
    698765        char ch;
    699766
     
    702769        log_msg(0, prompt);
    703770        if (g_text_mode) {
    704             printf("---promptpopup---1--- %s\n---promptpopup---Q--- [OK] ---\n--> ", prompt);
     771            printf
     772                ("---promptpopup---1--- %s\n---promptpopup---Q--- [OK] ---\n--> ",
     773                 prompt);
    705774            while (((ch = getchar()) != '\n') && (ch != EOF));
    706775        } else {
     
    717786 * @return TRUE if the user pressed OK, FALSE if they pressed Cancel.
    718787 */
    719     bool popup_and_get_string(char *title, char *b, char *output, int maxsize) {
     788    bool popup_and_get_string(char *title, char *b, char *output,
     789                              int maxsize) {
    720790
    721791        /*@ newt ************************************************************ */
     
    731801
    732802        /*@ buffers ********************************************************** */
    733         char *blurb = NULL;
     803        char *blurb;
    734804        char *p;
    735         char *original_contents = NULL;
    736 
     805        char *original_contents;
     806
     807        blurb = malloc(MAX_NEWT_COMMENT_LEN);
     808        original_contents = malloc(MAX_NEWT_COMMENT_LEN);
    737809        assert_string_is_neither_NULL_nor_zerolength(title);
    738810        assert(b != NULL);
     
    740812
    741813        if (g_text_mode) {
    742             printf("---promptstring---1--- %s\n---promptstring---2--- %s\n---promptstring---Q---\n-->  ", title, b);
     814            printf
     815                ("---promptstring---1--- %s\n---promptstring---2--- %s\n---promptstring---Q---\n-->  ",
     816                 title, b);
    743817            p = fgets(output, maxsize, stdin);
    744818            if (!p) {
     
    747821            if (output[strlen(output) - 1] == '\n')
    748822                output[strlen(output) - 1] = '\0';
     823            paranoid_free(blurb);
     824            paranoid_free(original_contents);
    749825            return (TRUE);
    750826        }
    751        
    752         blurb = malloc(MAX_NEWT_COMMENT_LEN);
    753827        strcpy(blurb, b);
    754828        text = newtTextboxReflowed(2, 1, blurb, 48, 5, 5, 0);
    755         mr_asprintf(original_contents, "%s", output);
     829        strcpy(original_contents, output);
    756830        output[0] = '\0';
    757         type_here = newtEntry(2, newtTextboxGetNumLines(text) + 2, original_contents, 50,
     831        type_here =
     832            newtEntry(2, newtTextboxGetNumLines(text) + 2,
     833                      original_contents, 50,
    758834#ifdef __cplusplus
    759835                      0, NEWT_FLAG_RETURNEXIT
     
    764840        b_1 = newtButton(6, newtTextboxGetNumLines(text) + 4, "  OK  ");
    765841        b_2 = newtButton(18, newtTextboxGetNumLines(text) + 4, "Cancel");
     842        //  newtOpenWindow (8, 5, 54, newtTextboxGetNumLines (text) + 9, title);
    766843        newtCenteredWindow(54, newtTextboxGetNumLines(text) + 9, title);
    767844        myForm = newtForm(NULL, NULL, 0);
     
    774851        newtFormDestroy(myForm);
    775852        newtPopWindow();
    776         paranoid_free(blurb);
    777 
    778853        if (b_res == b_2) {
    779854            strcpy(output, original_contents);
    780             mr_free(original_contents);
     855            paranoid_free(blurb);
     856            paranoid_free(original_contents);
    781857            return (FALSE);
    782858        } else {
    783             mr_free(original_contents);
     859            paranoid_free(blurb);
     860            paranoid_free(original_contents);
    784861            return (TRUE);
    785862        }
     
    794871 * @return TRUE if @p button1 was pushed, FALSE otherwise.
    795872 */
    796 bool popup_with_buttons(char *p, char *button1, char *button2) {
     873    bool popup_with_buttons(char *p, char *button1, char *button2) {
    797874
    798875        /*@ buffers *********************************************************** */
    799         char *prompt = NULL;
     876        char *prompt;
     877        char *q;
    800878
    801879        /*@ newt ************************************************************** */
     
    809887        assert(button1 != NULL);
    810888        assert(button2 != NULL);
     889        prompt = malloc(MAX_NEWT_COMMENT_LEN);
    811890        if (g_text_mode) {
    812891            if (strlen(button2) == 0) {
     
    815894                printf("%s (%s or %s) --> ", p, button1, button2);
    816895            }
    817             mr_getline(prompt, stdin);
    818             while (strcmp(prompt, button1) && (strlen(button2) == 0 || strcmp(prompt, button2))) {
     896            for (prompt[0] = '\0';
     897                 strcmp(prompt, button1) && (strlen(button2) == 0
     898                                          || strcmp(prompt, button2));) {
    819899                printf("--> ");
    820                 mr_free(prompt);
    821                 mr_getline(prompt, stdin);
     900                q = fgets(prompt, MAX_NEWT_COMMENT_LEN, stdin);
     901                if (!q) {
     902                    // FIXME
     903                }
    822904            }
    823905            if (!strcmp(prompt, button1)) {
    824                 mr_free(prompt);
     906                paranoid_free(prompt);
    825907                return (TRUE);
    826908            } else {
    827                 mr_free(prompt);
     909                paranoid_free(prompt);
    828910                return (FALSE);
    829911            }
    830912        }
    831913
    832         prompt = malloc(MAX_NEWT_COMMENT_LEN);
    833914        strncpy(prompt, p, MAX_NEWT_COMMENT_LEN - 1);
    834915        prompt[MAX_NEWT_COMMENT_LEN - 1] = '\0';
    835916        text = newtTextboxReflowed(1, 1, prompt, 40, 5, 5, 0);
    836         b_1 = newtButton(20 - ((button2[0] != '\0') ? strlen(button1) + 2 : strlen(button1) / 2), newtTextboxGetNumLines(text) + 3, button1);
     917        b_1 =
     918            newtButton(20 -
     919                       ((button2[0] !=
     920                         '\0') ? strlen(button1) +
     921                        2 : strlen(button1) / 2),
     922                       newtTextboxGetNumLines(text) + 3, button1);
    837923        if (button2[0] != '\0') {
    838             b_2 = newtButton(24, newtTextboxGetNumLines(text) + 3, button2);
     924            b_2 =
     925                newtButton(24, newtTextboxGetNumLines(text) + 3, button2);
    839926        } else {
    840927            b_2 = NULL;
    841928        }
     929        //  newtOpenWindow (25, 5, 46, newtTextboxGetNumLines (text) + 7, "Alert");
    842930        newtCenteredWindow(46, newtTextboxGetNumLines(text) + 7, "Alert");
    843931        myForm = newtForm(NULL, NULL, 0);
     
    865953 * on the screen.
    866954 */
    867 void refresh_log_screen() {
     955    void
     956     refresh_log_screen() {
    868957
    869958        /*@ int *********************************************************** */
     
    892981 * only allocate some memory.
    893982 */
    894 void setup_newt_stuff() {
     983    void
     984     setup_newt_stuff() {
    895985
    896986        /*@ int *********************************************************** */
     
    901991            newtInit();
    902992            newtCls();
    903             newtPushHelpLine("Welcome to Mondo Rescue, by Dev Team and the Internet. All rights reversed.");
     993            newtPushHelpLine
     994                ("Welcome to Mondo Rescue, by Dev Team and the Internet. All rights reversed.");
     995            /*  newtDrawRootText(28,0,"Welcome to Mondo Rescue"); */
    904996            newtDrawRootText(18, 0, WELCOME_STRING);
    905997            newtRefresh();
     
    9081000        }
    9091001
    910         err_log_lines = (char **) mr_malloc(sizeof(char *) * g_noof_log_lines);
     1002        err_log_lines =
     1003            (char **) malloc(sizeof(char *) * g_noof_log_lines);
     1004        if (!err_log_lines) {
     1005            fatal_error("Out of memory");
     1006        }
    9111007
    9121008        for (i = 0; i < g_noof_log_lines; i++) {
    913             err_log_lines[i] = (char *) mr_malloc(MAX_NEWT_COMMENT_LEN);
     1009            err_log_lines[i] = (char *) malloc(MAX_NEWT_COMMENT_LEN);
     1010            if (!err_log_lines[i]) {
     1011                fatal_error("Out of memory");
     1012            }
    9141013        }
    9151014
     
    9251024 * @param denom The denomenator of the ratio.
    9261025 */
    927 void update_evalcall_form_ratio(int num, int denom) {
     1026    void
     1027     update_evalcall_form_ratio(int num, int denom) {
    9281028
    9291029        /*@ long ************************************************************ */
    930         long current_time = 0L;
    931         long time_taken = 0L;
    932         long time_total_est = 0L;
    933         long time_remaining = 0L;
     1030        long current_time = 0;
     1031        long time_taken = 0;
     1032        long time_total_est = 0;
     1033        long time_remaining = 0;
    9341034
    9351035        /*@ buffers ********************************************************** */
    936         char *timeline_str = NULL;
     1036        char *timeline_str;
    9371037        char *pcline_str = NULL;
    9381038        char *taskprogress = NULL;
     
    9431043        int j = 0;
    9441044
     1045        malloc_string(timeline_str);
     1046        timeline_str[0] = '\0';
     1047//  log_it("update_eval_call_form called");
    9451048        if (num * 100 < denom) {
    9461049            percentage = 1;
     
    9551058            time_remaining = time_total_est - time_taken;
    9561059        } else {
    957             time_remaining = 0L;
     1060            time_remaining = 0;
    9581061        }
    9591062        if (!g_text_mode) {
     
    9661069            || percentage > g_isoform_old_progress) {
    9671070            g_isoform_old_progress = percentage;
    968             mr_asprintf(timeline_str, "%2ld:%02ld taken            %2ld:%02ld remaining", (long) time_taken / 60, (long) time_taken % 60, (long) time_remaining / 60, (long) time_remaining % 60);
     1071            sprintf(timeline_str,
     1072                    "%2ld:%02ld taken            %2ld:%02ld remaining",
     1073                    (long) time_taken / 60, (long) time_taken % 60, (long) time_remaining / 60,
     1074                    (long) time_remaining % 60);
    9691075            if (percentage < 3) {
    9701076                mr_asprintf(pcline_str, " Working");
     
    9771083                mr_strcat(pcline_str, " %c", special_dot_char(g_mysterious_dot_counter));
    9781084            } else {
    979                 mr_asprintf(pcline_str, " %3d%% done              %3d%% to go", percentage, 100 - percentage);
     1085                mr_asprintf(pcline_str, " %3d%% done              %3d%% to go",
     1086                        percentage, 100 - percentage);
    9801087            }
    9811088            if (g_text_mode) {
     
    9881095                }
    9891096                if (percentage >= 3) {
    990                     mr_strcat(taskprogress, "] %3d%% done; %2ld:%02ld to go", percentage, (long) time_remaining / 60, (long) time_remaining % 60);
    991                     printf("---evalcall---1--- %s\n", g_isoform_header_str);
     1097                    mr_strcat(taskprogress, "] %3d%% done; %2ld:%02ld to go", percentage,
     1098                            (long) time_remaining / 60, (long) time_remaining % 60);
     1099                    printf("---evalcall---1--- %s\n",
     1100                           g_isoform_header_str);
    9921101                    printf("---evalcall---2--- %s\n", taskprogress);
    9931102                    printf("---evalcall---E---\n");
    9941103                }
    995                 mr_free(taskprogress);
     1104                paranoid_free(taskprogress);
    9961105            } else {
    997                 newtScaleSet(g_isoform_scale, (unsigned long long) percentage);
     1106                newtScaleSet(g_isoform_scale,
     1107                             (unsigned long long) percentage);
    9981108                if (g_isoform_pcline) {
    9991109                    newtLabelSetText(g_isoform_pcline, pcline_str);
     
    10031113                }
    10041114            }
    1005             mr_free(pcline_str);
    1006             mr_free(timeline_str);
     1115            paranoid_free(pcline_str);
    10071116        }
    10081117        if (!g_text_mode) {
     1118//      log_it("refreshing");
    10091119            newtDrawForm(g_isoform_main);
    10101120            newtRefresh();
    10111121        }
     1122        paranoid_free(timeline_str);
    10121123    }
    10131124
     
    10181129 * @param curr The current amount of progress (percentage) in the evalcall form.
    10191130 */
    1020 void update_evalcall_form(int curr) {
    1021 
     1131    void
     1132     update_evalcall_form(int curr) {
    10221133        update_evalcall_form_ratio(curr, 100);
    1023 }
     1134    }
    10241135
    10251136
     
    10301141 * @param blurb3 The new third line of the blurb; use @p g_blurb_str_2 (no, that's not a typo) to keep it the same.
    10311142 */
    1032 void update_progress_form(char *blurb3) {
    1033 
     1143    void
     1144     update_progress_form(char *blurb3) {
     1145        /*  log_it("update_progress_form --- called"); */
    10341146        if (g_current_progress == -999) {
     1147            /* log_it("You're trying to update progress form when it ain't open. Aww, that's OK. I'll let it go. It's a bit naughty but it's a nonfatal error. No prob, Bob."); */
    10351148            return;
    10361149        }
    10371150        strcpy(g_blurb_str_2, blurb3);
    1038         update_progress_form_full(g_blurb_str_1, g_blurb_str_2, g_blurb_str_3);
    1039 }
     1151        update_progress_form_full(g_blurb_str_1, g_blurb_str_2,
     1152                                  g_blurb_str_3);
     1153    }
    10401154
    10411155
     
    10461160 * @param blurb3 The third line of the blurb. Use @p g_blurb_str_2 (no, that's not a typo either) to keep it the same.
    10471161 */
    1048 void update_progress_form_full(char *blurb1, char *blurb2, char *blurb3) {
    1049 
     1162    void
     1163     update_progress_form_full(char *blurb1, char *blurb2, char *blurb3) {
    10501164        /*@ long ***************************************************** */
    10511165        long current_time = 0L;
     
    10591173
    10601174        /*@ buffers *************************************************** */
    1061         char *percentline_str = NULL;
    1062         char *timeline_str = NULL;
     1175        char *percentline_str;
     1176        char *timeline_str;
    10631177        char *taskprogress = NULL;
    1064 
     1178        char *tmp;
     1179
     1180//  log_msg(1, "'%s' '%s' '%s'", blurb1, blurb2, blurb3);
     1181        percentline_str = malloc(MAX_NEWT_COMMENT_LEN);
     1182        timeline_str = malloc(MAX_NEWT_COMMENT_LEN);
     1183        malloc_string(tmp);
    10651184        if (!g_text_mode) {
    10661185            assert(blurb1 != NULL);
     
    10701189        }
    10711190
     1191        percentline_str[0] = '\0';
     1192
    10721193        current_time = get_time();
    10731194        time_taken = current_time - g_start_time;
     
    10761197        } else {
    10771198            if (g_current_progress > g_maximum_progress) {
    1078                 log_msg(0, "update_progress_form_full(%s,%s,%s) --- g_current_progress=%ld; g_maximum_progress=%ld", blurb1, blurb2, blurb3, g_current_progress, g_maximum_progress);
     1199                sprintf(tmp,
     1200                        "update_progress_form_full(%s,%s,%s) --- g_current_progress=%ld; g_maximum_progress=%ld",
     1201                        blurb1, blurb2, blurb3, g_current_progress,
     1202                        g_maximum_progress);
     1203                log_msg(0, tmp);
    10791204                g_current_progress = g_maximum_progress;
    10801205            }
    1081             percentage = (int) ((g_current_progress * 100L) / g_maximum_progress);
     1206            percentage =
     1207                (int) ((g_current_progress * 100L) / g_maximum_progress);
    10821208        }
    10831209        if (percentage < 1) {
     
    10881214        }
    10891215        if (g_current_progress) {
    1090             time_total_est = time_taken * (long) g_maximum_progress / (long) g_current_progress;
     1216            time_total_est =
     1217                time_taken * (long) g_maximum_progress /
     1218                (long) (g_current_progress);
    10911219            time_remaining = time_total_est - time_taken;
    10921220        } else {
     
    10941222        }
    10951223        g_mysterious_dot_counter = (g_mysterious_dot_counter + 1) % 27;
     1224        sprintf(timeline_str,
     1225                "%2ld:%02ld taken               %2ld:%02ld remaining  ",
     1226                (long) time_taken / 60, time_taken % 60, time_remaining / 60,
     1227                time_remaining % 60);
     1228        sprintf(percentline_str, " %3d%% done                 %3d%% to go",
     1229                percentage, 100 - percentage);
     1230
    10961231        if (g_text_mode) {
    10971232            printf("---progress-form---1--- %s\n", blurb1);
     
    11091244                log_msg(2, "percentage = %d", percentage);
    11101245            }
    1111             mr_strcat(taskprogress, "] %3d%% done; %2ld:%02ld to go", percentage, (long) time_remaining / 60, (long) time_remaining % 60);
     1246            mr_strcat(taskprogress, "] %3d%% done; %2ld:%02ld to go", percentage,
     1247                            (long) time_remaining / 60, (long) time_remaining % 60);
    11121248            printf("---progress-form---4--- %s\n", taskprogress);
    11131249            paranoid_free(taskprogress);
    11141250        } else {
    1115             mr_asprintf(timeline_str, "%2ld:%02ld taken               %2ld:%02ld remaining  ", (long) time_taken / 60, (long) time_taken % 60, (long) time_remaining / 60, (long) time_remaining % 60);
    1116             mr_asprintf(percentline_str, " %3d%% done                 %3d%% to go", percentage, 100 - percentage);
    1117 
    11181251            center_string(blurb1, 54);
    11191252            center_string(blurb2, 54);
     
    11321265                newtLabelSetText(g_timeline, timeline_str);
    11331266            }
    1134             mr_free(timeline_str);
    1135 
    11361267            if (g_percentline) {
    11371268                newtLabelSetText(g_percentline, percentline_str);
    11381269            }
    1139             mr_free(percentline_str);
    1140 
    11411270            newtDrawForm(g_progressForm);
    11421271            newtRefresh();
    11431272        }
    1144     }
     1273        paranoid_free(percentline_str);
     1274        paranoid_free(timeline_str);
     1275        paranoid_free(tmp);
     1276    }
     1277
     1278
     1279
     1280
     1281
     1282
     1283
     1284
     1285
     1286
     1287
     1288
    11451289
    11461290
     
    11531297 * @return The backup type chosen, or @c none if the user chose "Exit to shell".
    11541298 */
    1155 t_bkptype which_backup_media_type(bool restoring) {
     1299    t_bkptype which_backup_media_type(bool restoring) {
    11561300
    11571301        /*@ char ************************************************************ */
     
    11601304
    11611305        /*@ newt ************************************************************ */
    1162         char *title_sz = NULL;
    1163         char *minimsg_sz = NULL;
    1164         static t_bkptype possible_bkptypes[] = { none, cdr, cdrw, dvd, tape, cdstream, udev, netfs, iso };
    1165         static char *possible_responses[] = { "none", "cdr", "cdrw", "dvd", "tape", "cdstream", "udev", "netfs", "iso", NULL };
    1166         char *outstr = NULL;
     1306        char *title_sz;
     1307        char *minimsg_sz;
     1308        static t_bkptype possible_bkptypes[] =
     1309            { none, cdr, cdrw, dvd, tape, cdstream, udev, netfs, iso };
     1310        static char *possible_responses[] =
     1311            { "none", "cdr", "cdrw", "dvd", "tape", "cdstream", "udev",
     1312"netfs", "iso", NULL };
     1313        char *outstr;
     1314        char *p;
    11671315        t_bkptype backup_type;
    11681316        int i;
     
    11791327        newtComponent myForm;
    11801328
     1329        title_sz = malloc(MAX_NEWT_COMMENT_LEN);
     1330        minimsg_sz = malloc(MAX_NEWT_COMMENT_LEN);
     1331        outstr = malloc(MAX_NEWT_COMMENT_LEN);
    11811332        if (g_text_mode) {
    11821333            for (backup_type = none; backup_type == none;) {
     
    11871338                }
    11881339                printf(")\n--> ");
    1189                 mr_getline(outstr, stdin);
    1190                 mr_strip_spaces(outstr);
     1340                p = fgets(outstr, MAX_NEWT_COMMENT_LEN, stdin);
     1341                if (!p) {
     1342                    // FIXME
     1343                }
     1344                strip_spaces(outstr);
    11911345                for (i = 0; possible_responses[i]; i++) {
    11921346                    if (!strcmp(possible_responses[i], outstr)) {
     
    11941348                    }
    11951349                }
    1196                 mr_free(outstr);
    1197             }
     1350            }
     1351            paranoid_free(title_sz);
     1352            paranoid_free(minimsg_sz);
     1353            paranoid_free(outstr);
    11981354            return (backup_type);
    11991355        }
    12001356        newtDrawRootText(18, 0, WELCOME_STRING);
    12011357        if (restoring) {
    1202             mr_asprintf(title_sz, "Please choose the backup media from which you want to read data.");
    1203             mr_asprintf(minimsg_sz, "Read from:");
    1204         } else {
    1205             mr_asprintf(title_sz, "Please choose the backup media to which you want to archive data.");
    1206             mr_asprintf(minimsg_sz, "Backup to:");
     1358            strcpy(title_sz,
     1359                   "Please choose the backup media from which you want to read data.");
     1360            strcpy(minimsg_sz, "Read from:");
     1361        } else {
     1362            strcpy(title_sz,
     1363                   "Please choose the backup media to which you want to archive data.");
     1364            strcpy(minimsg_sz, "Backup to:");
    12071365        }
    12081366        newtPushHelpLine(title_sz);
     1367        //  newtOpenWindow (23, 3, 34, 17, minimsg_sz);
    12091368        newtCenteredWindow(34, 17, minimsg_sz);
    12101369        b1 = newtButton(1, 1, "CD-R disks ");
     
    12401399        }
    12411400        newtPopHelpLine();
    1242         mr_free(title_sz);
    1243         mr_free(minimsg_sz);
     1401        paranoid_free(title_sz);
     1402        paranoid_free(minimsg_sz);
     1403        paranoid_free(outstr);
    12441404        return (output);
    12451405    }
     
    12631423        newtComponent b2;
    12641424        newtComponent b3;
    1265         newtComponent b4;
     1425        //newtComponent b4;
    12661426        newtComponent b5;
    12671427        newtComponent b_res;
     
    12751435        b2 = newtButton(18, 1, "gzip");
    12761436        b3 = newtButton(4, 5, "lzo");
    1277         b4 = newtButton(18, 5, "lzma");
     1437        //b4 = newtButton(18, 5, "lzma");
    12781438        b5 = newtButton(4, 9, "         Exit        ");
    12791439        myForm = newtForm(NULL, NULL, 0);
     
    12881448        } else if (b_res == b3) {
    12891449            mr_asprintf(output, "%s", "lzo");
    1290         } else if (b_res == b4) {
    1291             mr_asprintf(output, "%s", "lzma");
     1450        //} else if (b_res == b4) {
     1451            //mr_asprintf(output, "%s", "lzma");
    12921452        }
    12931453        newtPopHelpLine();
     
    13011461 * @return The compression level (0-9) chosen, or -1 for "Exit".
    13021462 */
    1303 int which_compression_level() {
     1463    int
     1464     which_compression_level() {
    13041465
    13051466        /*@ char ************************************************************ */
     
    13181479
    13191480        newtDrawRootText(18, 0, WELCOME_STRING);
    1320         newtPushHelpLine("   Please specify the level of compression that you want.");
     1481        newtPushHelpLine
     1482            ("   Please specify the level of compression that you want.");
     1483        //  newtOpenWindow (23, 3, 34, 13, "How much compression?");
    13211484        newtCenteredWindow(34, 13, "How much compression?");
    13221485        b1 = newtButton(4, 1, "Maximum (9)");
     
    13551518 * @param source_file The file containing a list of filenames to load into @p filelist.
    13561519 */
    1357 int load_filelist_into_array(struct s_filelist *filelist, char *source_file) {
    1358 
     1520    int load_filelist_into_array(struct s_filelist *filelist,
     1521                                 char *source_file) {
    13591522        int i;
    13601523        int j = 0;
    13611524        bool done;
    1362         char *tmp = NULL;
     1525        char *tmp;
     1526        char *p;
    13631527        char *tmp1 = NULL;
    13641528        FILE *fin, *fout;
     
    13791543        if (!(fout = fopen(tmp1, "a"))) {
    13801544            log_msg(2, "Can't write to %s", tmp1);
    1381             mr_free(tmp1);
    13821545            return(1);
    13831546            }
    13841547
     1548        malloc_string(tmp);
    13851549        log_msg(2, "Loading %s", source_file);
    1386         for (filelist->entries = 0; filelist->entries <= ARBITRARY_MAXIMUM; ) {
    1387             mr_free(tmp);
     1550        for (filelist->entries = 0; filelist->entries <= ARBITRARY_MAXIMUM;
     1551             filelist->entries++) {
     1552          god_i_hate_gotos:
    13881553            if (feof(fin)) {
    13891554                break;
    13901555            }
    1391             mr_getline(tmp, fin);
     1556            p = fgets(tmp, MAX_NEWT_COMMENT_LEN, fin);
     1557            if (!p) {
     1558                // FIXME
     1559            }
    13921560            i = (int) strlen(tmp);
    13931561            if (i < 2) {
    1394                 continue;
     1562                goto god_i_hate_gotos;
    13951563            }
    13961564            if (tmp[i - 1] < 32) {
     
    13981566            }
    13991567            if (i < 2) {
    1400                 continue;
     1568                goto god_i_hate_gotos;
    14011569            }
    14021570            if (!does_file_exist(tmp) && !feof(fin)) {
    14031571                j++;
    14041572                fprintf(fout, "%s\n", tmp);
    1405                 continue;
    1406             }
    1407             filelist->el[filelist->entries].severity = severity_of_difference(tmp, NULL);
     1573
     1574                goto god_i_hate_gotos;
     1575            }
     1576            filelist->el[filelist->entries].severity =
     1577                severity_of_difference(tmp, NULL);
    14081578            strcpy(filelist->el[filelist->entries].filename, tmp);
    14091579            if (feof(fin)) {
    14101580                break;
    14111581            }
    1412             filelist->entries++;
    1413         }
    1414         mr_free(tmp);
     1582        }
    14151583        paranoid_fclose(fin);
    14161584        paranoid_fclose(fout);
     
    14181586            log_to_screen("%d files listed in %s/changed.files have been deleted since backup was made\nand are referenced in %s", j, bkpinfo->tmpdir,tmp1);
    14191587        }
    1420         mr_free(tmp1);
     1588        paranoid_free(tmp1);
    14211589        if (filelist->entries >= ARBITRARY_MAXIMUM) {
    14221590            log_to_screen("Arbitrary limits suck, man!");
     1591            paranoid_free(tmp);
    14231592            return (1);
    14241593        }
     
    14481617            }
    14491618        }
     1619        paranoid_free(tmp);
    14501620        log_it("leaving");
    14511621        return (0);
    14521622    }
     1623
    14531624
    14541625
     
    14591630 * @note The returned value points to static storage that will be overwritten with each call.
    14601631 */
    1461 char *filelist_entry_to_string(struct s_filelist_entry *flentry) {
     1632    char *filelist_entry_to_string(struct s_filelist_entry *flentry) {
    14621633        static char comment[100];
    14631634        char *tmp = NULL;
    14641635
    1465         log_msg(8, "entering");
     1636        log_it("entering");
    14661637        assert(flentry != NULL);
    14671638        if (flentry->severity == 0) {
     
    14771648        mr_strcat(tmp, flentry->filename);
    14781649        strncpy(comment, tmp, 99);
    1479         mr_free(tmp);
     1650        paranoid_free(tmp);
    14801651
    14811652        log_it("leaving");
    14821653        return (comment);
    14831654    }
     1655
     1656
     1657
    14841658
    14851659
     
    14891663 * @param source_file The file containing a list of changed files.
    14901664 */
    1491 void popup_changelist_from_file(char *source_file) {
    1492 
    1493         char *reason = NULL;
     1665    void popup_changelist_from_file(char *source_file) {
     1666        char *reason;
    14941667        newtComponent myForm;
    14951668        newtComponent bClose;
     
    15121685
    15131686        /*@ buffers ********************************************************* */
    1514         char *tmp = NULL;
    1515         char *differ_sz = NULL;
     1687        char *tmp;
     1688        char *differ_sz;
    15161689
    15171690        struct s_filelist *filelist;
     1691        malloc_string(reason);
     1692        tmp = malloc(5000);
     1693        malloc_string(differ_sz);
    15181694        assert_string_is_neither_NULL_nor_zerolength(source_file);
    15191695        if (g_text_mode) {
    15201696            log_msg(2, "Text mode. Therefore, no popup list.");
    1521             return;
     1697            goto free_to_go;
    15221698        }
    15231699        log_msg(2, "Examining file %s", source_file);
     
    15261702        if (lng < 1) {
    15271703            log_msg(2, "No lines in file. Therefore, no popup list.");
    1528             return;
     1704            paranoid_free(reason);
     1705            goto free_to_go;
    15291706        } else if (lng >= ARBITRARY_MAXIMUM) {
    15301707            log_msg(2, "Too many files differ for me to list.");
    1531             return;
     1708            goto free_to_go;
    15321709        }
    15331710
     
    15381715
    15391716        if (load_filelist_into_array(filelist, source_file)) {
    1540             log_msg(2, "Can't open %s; therefore, cannot popup list", source_file);
     1717            log_msg(2, "Can't open %s; therefore, cannot popup list",
     1718                    source_file);
     1719            paranoid_free(reason);
    15411720            return;
    15421721        }
    1543         log_msg(2, "%d files loaded into filelist array", filelist->entries);
     1722        log_msg(2, "%d files loaded into filelist array",
     1723                filelist->entries);
    15441724        for (i = 0; i < filelist->entries; i++) {
    15451725            keylist[i] = (void *) i;
     
    15501730                                   keylist[i]);
    15511731        }
    1552         mr_asprintf(differ_sz, "  %ld files differ. Hit 'Select' to pick a file. Hit 'Close' to quit the list.", i);
     1732        sprintf(differ_sz,
     1733                "  %ld files differ. Hit 'Select' to pick a file. Hit 'Close' to quit the list.",
     1734                i);
    15531735        newtPushHelpLine(differ_sz);
    1554         mr_free(differ_sz);
    1555 
    15561736        bClose = newtCompactButton(10, 15, " Close  ");
    15571737        bSelect = newtCompactButton(30, 15, " Select ");
    1558         mr_asprintf(tmp, "%-10s               %-20s", "Priority", "Filename");
     1738        sprintf(tmp, "%-10s               %-20s", "Priority", "Filename");
    15591739        headerMsg = newtLabel(2, 1, tmp);
    1560         mr_free(tmp);
    1561 
    15621740        newtOpenWindow(5, 4, 70, 16, "Non-matching files");
    15631741        myForm = newtForm(NULL, NULL, 0);
    1564         newtFormAddComponents(myForm, headerMsg, fileListbox, bClose, bSelect, NULL);
    1565 
     1742        newtFormAddComponents(myForm, headerMsg, fileListbox, bClose,
     1743                              bSelect, NULL);
    15661744        while (!finished) {
    15671745            b_res = newtRunForm(myForm);
     
    15781756                    currline = i;
    15791757                    if (filelist->entries > 0) {
    1580                         malloc_string(reason);
    1581                         severity_of_difference(filelist->el[currline].  filename, &reason);
    1582                         mr_asprintf(tmp, "%s --- %s", filelist->el[currline].filename, reason);
    1583 
     1758                        severity_of_difference(filelist->el[currline].
     1759                                               filename, reason);
     1760                        sprintf(tmp, "%s --- %s",
     1761                                filelist->el[currline].filename, reason);
    15841762                        popup_and_OK(tmp);
    1585                         mr_free(tmp);
    1586                         paranoid_free(reason);
    15871763                    }
    15881764                }
     
    15921768        newtPopWindow();
    15931769        newtPopHelpLine();
     1770      free_to_go:
     1771        paranoid_free(reason);
     1772        paranoid_free(tmp);
     1773        paranoid_free(differ_sz);
    15941774        return;
    15951775    }
Note: See TracChangeset for help on using the changeset viewer.