Ignore:
Timestamp:
Sep 29, 2013, 9:31:34 AM (11 years ago)
Author:
Bruno Cornec
Message:
  • Finish with backports from 3.1 for now. Still some work to do, but we will now make that version compile and work again and serve as a base

so the gettext patch can be added

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mondo/src/mondoarchive/mondoarchive.c

    r3185 r3193  
    1010#include "my-stuff.h"
    1111#include "mr_mem.h"
     12#include "mr_str.h"
    1213#include "../common/mondostructures.h"
    1314#include "../common/libmondo.h"
     
    3233
    3334/***************** global vars, used only by main.c ******************/
    34 long diffs;
     35long diffs = 0L;
    3536
    3637extern t_bkptype g_backup_media_type;
    3738extern int g_loglevel;
     39
     40extern char *g_magicdev_command;
    3841
    3942/**
     
    7477    char *tmp = NULL;
    7578
    76     log_msg(0, "Mondo Archive v%s --- http://www.mondorescue.org",
    77             PACKAGE_VERSION);
     79    log_msg(0, "Mondo Archive v%s --- http://www.mondorescue.org", PACKAGE_VERSION);
    7880    log_msg(0, "running %s binaries", get_architecture());
    7981    tmp = get_uname_m();
    8082    log_msg(0, "running on %s architecture", tmp);
    8183    mr_free(tmp);
    82     log_msg(0,
    83             "-----------------------------------------------------------");
    84     log_msg(0,
    85             "NB: Mondo logs almost everything, so don't panic if you see");
    86     log_msg(0,
    87             "some error messages.  Please read them carefully before you");
    88     log_msg(0,
    89             "decide to break out in a cold sweat.    Despite (or perhaps");
    90     log_msg(0,
    91             "because of) the wealth of messages. some users are inclined");
    92     log_msg(0,
    93             "to stop reading this log. If Mondo stopped for some reason,");
    94     log_msg(0,
    95             "chances are it's detailed here.  More than likely there's a");
    96     log_msg(0,
    97             "message at the very end of this log that will tell you what");
    98     log_msg(0,
    99             "is wrong. Please read it!                          -Devteam");
    100     log_msg(0,
    101             "-----------------------------------------------------------");
     84    log_msg(0, "-----------------------------------------------------------");
     85    log_msg(0, "NB: Mondo logs almost everything, so don't panic if you see");
     86    log_msg(0, "some error messages.  Please read them carefully before you");
     87    log_msg(0, "decide to break out in a cold sweat.    Despite (or perhaps");
     88    log_msg(0, "because of) the wealth of messages. some users are inclined");
     89    log_msg(0, "to stop reading this log. If Mondo stopped for some reason,");
     90    log_msg(0, "chances are it's detailed here.  More than likely there's a");
     91    log_msg(0, "message at the very end of this log that will tell you what");
     92    log_msg(0, "is wrong. Please read it!                          -Devteam");
     93    log_msg(0, "-----------------------------------------------------------");
    10294
    10395    log_msg(0, "Zero...");
     
    113105}
    114106
    115 
    116 extern char *g_magicdev_command;
    117107
    118108/**
     
    170160    char *tmp = NULL;
    171161    char *tmp1 = NULL;
    172     int res, retval;
     162    int res = 0;
     163    int i = 0;
     164    int retval = 0;
    173165    char *say_at_end = NULL;
    174166    FILE *fin = NULL;
     
    181173
    182174/* If -V, -v or --version then echo version no. and quit */
    183     if (argc == 2
    184         && (!strcmp(argv[argc - 1], "-v") || !strcmp(argv[argc - 1], "-V")
    185             || !strcmp(argv[argc - 1], "--version"))) {
     175    if (argc == 2 && (!strcmp(argv[argc - 1], "-v") || !strcmp(argv[argc - 1], "-V") || !strcmp(argv[argc - 1], "--version"))) {
    186176        printf("mondoarchive v%s\nSee man page for help\n", PACKAGE_VERSION);
    187177        exit(0);
     
    196186    reset_bkpinfo();
    197187
    198     res = 0;
    199     retval = 0;
    200     diffs = 0;
     188    /* Memory allocation is done in those functions */
    201189    malloc_libmondo_global_strings();
    202190
     
    208196    mr_asprintf(tmp1,"%s:/sbin:/usr/sbin:/usr/local/sbin",getenv("PATH"));
    209197    setenv("PATH", tmp1, 1);
    210     paranoid_free(tmp1);
     198    mr_free(tmp1);
    211199
    212200    /* Add the ARCH environment variable for ia64 purposes */
    213201    mr_asprintf(tmp1,"%s",get_architecture());
    214202    setenv("ARCH", tmp1, 1);
    215     paranoid_free(tmp1);
     203    mr_free(tmp1);
    216204
    217205    /* Add MONDO_SHARE environment variable for mindi */
     
    255243        g_text_mode = TRUE;
    256244        setup_newt_stuff();
    257         malloc_string(tmp);
    258         turn_wildcard_chars_into_literal_chars(tmp, argv[2]);
    259         printf("in=%s; out=%s\n", argv[2], tmp);
    260         paranoid_free(tmp);
     245        tmp1 = mr_stresc(argv[2], "[]*?", '\\');
     246        printf("in=%s; out=%s\n", argv[2], tmp1);
     247        mr_free(tmp1);
    261248        finish(1);
    262249    }
     
    311298            printf("CD-ROM is at %s\n", tmp);
    312299        }
    313         paranoid_free(tmp);
     300        mr_free(tmp);
    314301        finish(0);
    315302    }
     
    325312            printf("DVD is at %s\n", tmp);
    326313        }
    327         paranoid_free(tmp);
     314        mr_free(tmp);
    328315        finish(0);
    329316    }
     
    343330
    344331    if (pre_param_configuration()) {
    345         fatal_error
    346             ("Pre-param initialization phase failed. Please review the error messages above, make the specified changes, then try again. Exiting...");
    347     }
    348 
    349 /* Process command line, if there is one. If not, ask user for info. */
     332        fatal_error("Pre-param initialization phase failed. Please review the error messages above, make the specified changes, then try again. Exiting...");
     333    }
     334
     335    /* Process command line, if there is one. If not, ask user for info. */
    350336    if (argc == 1) {
    351337        g_text_mode = FALSE;
     
    353339        res = interactively_obtain_media_parameters_from_user(TRUE);    /* yes, archiving */
    354340        if (res) {
    355             fatal_error
    356                 ("Syntax error. Please review the parameters you have supplied and try again.");
     341            fatal_error("Syntax error. Please review the parameters you have supplied and try again.");
    357342        }
    358343    } else {
    359344        res = handle_incoming_parameters(argc, argv);
    360345        if (res) {
    361             printf
    362                 ("Errors were detected in the command line you supplied.\n");
     346            printf("Errors were detected in the command line you supplied.\n");
    363347            printf("Please review the log file - %s\n", MONDO_LOGFILE );
    364348            log_msg(1, "Mondoarchive will now exit.");
     
    370354/* Finish configuring global structures */
    371355    if (post_param_configuration()) {
    372         fatal_error
    373             ("Post-param initialization phase failed. Perhaps bad parameters were supplied to mondoarchive? Please review the documentation, error messages and logs. Exiting...");
    374     }
    375 
    376     log_to_screen
    377         ("BusyBox's sources are available from http://www.busybox.net");
     356        fatal_error("Post-param initialization phase failed. Perhaps bad parameters were supplied to mondoarchive? Please review the documentation, error messages and logs. Exiting...");
     357    }
    378358
    379359    /* If we're meant to backup then backup */
     
    392372        res = verify_data();
    393373        if (res < 0) {
    394             mr_asprintf(tmp, "%d difference%c found.", -res,
    395                     (-res != 1) ? 's' : ' ');
     374            mr_asprintf(tmp, "%d difference%c found.", -res, (-res != 1) ? 's' : ' ');
    396375            mr_asprintf(say_at_end, "%s", tmp);
    397376            log_to_screen(tmp);
     
    430409    if (say_at_end != NULL) {
    431410        log_to_screen(say_at_end);
    432         paranoid_free(say_at_end);
     411        mr_free(say_at_end);
    433412    }
    434413    mr_asprintf(tmp, "umount %s/tmpfs", bkpinfo->tmpdir);
     
    437416    if (bkpinfo->backup_media_type == usb) {
    438417        log_msg(1, "Unmounting USB device.");
     418        if (bkpinfo->media_device == NULL) {
     419            fatal_error("USB device set to NULL");
     420        }
    439421        mr_asprintf(tmp, "umount %s1", bkpinfo->media_device);
    440422        run_program_and_log_output(tmp, TRUE);
     
    471453
    472454    if (!g_text_mode) {
    473         popup_and_OK
    474             ("Mondo Archive has finished its run. Please press ENTER to return to the shell prompt.");
     455        popup_and_OK("Mondo Archive has finished its run. Please press ENTER to return to the shell prompt.");
    475456        log_to_screen("See %s for details of backup run.", MONDO_LOGFILE);
    476457    } else {
Note: See TracChangeset for help on using the changeset viewer.