Ignore:
Timestamp:
Jul 23, 2009, 2:53:30 PM (15 years ago)
Author:
Bruno Cornec
Message:
  • Replace sprintf by mr_asprintf in mondo-rstr-compare.c
  • All mr_asprintf call should be on one line (for quality script) and use a string as second param
  • Improve quality script
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.10/mondo/src/common/libmondo-stream.c

    r2266 r2296  
    273273        strcpy(cdr_exe, "dvdrecord");
    274274    }
    275     mr_asprintf(&command, "%s -scanbus 2> /dev/null | grep -i tape | wc -l",
    276             cdr_exe);
     275    mr_asprintf(&command, "%s -scanbus 2> /dev/null | grep -i tape | wc -l", cdr_exe);
    277276    strcpy(tmp, call_program_and_get_last_line_of_output(command));
    278277    mr_free(command);
     
    284283        return 1;
    285284    }
    286     mr_asprintf(&command,
    287             "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | cut -d' ' -f2 | head -n1",
    288             cdr_exe);
     285    mr_asprintf(&command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | cut -d' ' -f2 | head -n1", cdr_exe);
    289286    strcpy(tmp, call_program_and_get_last_line_of_output(command));
    290287    mr_free(command);
     
    294291        return 1;
    295292    }
    296     mr_asprintf(&command,
    297             "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | cut -d' ' -f3 | cut -d')' -f1 | head -n1",
    298             cdr_exe);
     293    mr_asprintf(&command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | cut -d' ' -f3 | cut -d')' -f1 | head -n1", cdr_exe);
    299294    strcpy(tmp, call_program_and_get_last_line_of_output(command));
    300295    mr_free(command);
     
    475470    log_it("Insisting on tape #%d", tapeno);
    476471    if (g_current_media_number != tapeno) {
    477         mr_asprintf(&tmp,
    478                 "When the tape drive goes quiet, please insert volume %d in this series.",
    479                 tapeno);
     472        mr_asprintf(&tmp, "When the tape drive goes quiet, please insert volume %d in this series.", tapeno);
    480473        popup_and_OK(tmp);
    481474        mr_free(tmp);
     
    869862    (void) getcwd(old_cwd, MAX_STR_LEN);
    870863    chdir(bkpinfo->tmpdir);
    871     mr_asprintf(&tmp, "tar -zxf %s ./tmp/mondo-restore.cfg 2> /dev/null",
    872             outfname);
     864    mr_asprintf(&tmp, "tar -zxf %s ./tmp/mondo-restore.cfg 2> /dev/null", outfname);
    873865    paranoid_system(tmp);
    874866    mr_free(tmp);
     
    11431135    }
    11441136    if (strcmp(temp_cksum, actual_cksum)) {
    1145         mr_asprintf(&tmp, "actual cksum=%s; recorded cksum=%s", actual_cksum,
    1146                 temp_cksum);
     1137        mr_asprintf(&tmp, "actual cksum=%s; recorded cksum=%s", actual_cksum, temp_cksum);
    11471138        log_to_screen(tmp);
    11481139        mr_free(tmp);
    11491140
    1150         mr_asprintf(&tmp, "%s (%ld K) is corrupt on tape", temp_fname,
    1151                 (long) orig_size >> 10);
     1141        mr_asprintf(&tmp, "%s (%ld K) is corrupt on tape", temp_fname, (long) orig_size >> 10);
    11521142        log_to_screen(tmp);
    11531143        mr_free(tmp);
     
    15001490    }
    15011491    if (bkpinfo->backup_media_type == cdstream) {
    1502         mr_asprintf(&command,
    1503                 "cdrecord -eject dev=%s speed=%d fs=24m -waiti - >> %s 2>> %s",
    1504                 bkpinfo->media_device, bkpinfo->cdrw_speed, MONDO_LOGFILE,
    1505                 MONDO_LOGFILE);
     1492        mr_asprintf(&command, "cdrecord -eject dev=%s speed=%d fs=24m -waiti - >> %s 2>> %s", bkpinfo->media_device, bkpinfo->cdrw_speed, MONDO_LOGFILE, MONDO_LOGFILE);
    15061493        log_it("Opening OUT to next CD with the command");
    15071494        log_it(command);
     
    17061693        p++;
    17071694    }
    1708     mr_asprintf(&tmp, "Writing file '%s' to tape (%ld KB)", p,
    1709             (long) filesize >> 10);
     1695    mr_asprintf(&tmp, "Writing file '%s' to tape (%ld KB)", p, (long) filesize >> 10);
    17101696    log_it(tmp);
    17111697    mr_free(tmp);
     
    18121798        fwrite(tempblock, 1, (size_t) TAPE_BLOCK_SIZE,
    18131799               g_tape_stream) / 1024;
    1814     mr_asprintf(&tmp, "%s (fname=%s, size=%ld K)",
    1815             marker_to_string(control_char), p,
    1816             (long) length_of_incoming_file >> 10);
     1800    mr_asprintf(&tmp, "%s (fname=%s, size=%ld K)", marker_to_string(control_char), p, (long) length_of_incoming_file >> 10);
    18171801    log_msg(6, tmp);
    18181802    mr_free(tmp);
Note: See TracChangeset for help on using the changeset viewer.