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-devices.c

    r2291 r2296  
    257257        mr_asprintf(&command, "cdcontrol -f %s close", dev);
    258258    } else {
    259         mr_asprintf(&command, "camcontrol load `echo %s | sed 's|/dev/||'`",
    260                 dev);
     259        mr_asprintf(&command, "camcontrol load `echo %s | sed 's|/dev/||'`", dev);
    261260    }
    262261#else
     
    343342#ifdef __FreeBSD__
    344343    // We assume here that this is running from mondorestore. (It is.)
    345     mr_asprintf(&program, "ls %s %s >/dev/null 2>&1", drive,
    346             build_partition_name(tmp, drive, partno));
     344    mr_asprintf(&program, "ls %s %s >/dev/null 2>&1", drive, build_partition_name(tmp, drive, partno));
    347345    res = system(program);
    348346    mr_free(program);
     
    399397    assert_string_is_neither_NULL_nor_zerolength(str);
    400398
    401     mr_asprintf(&command,
    402             "dd if=%s bs=446 count=1 2> /dev/null | strings | grep \"%s\" > /dev/null 2> /dev/null",
    403             dev, str);
     399    mr_asprintf(&command, "dd if=%s bs=446 count=1 2> /dev/null | strings | grep \"%s\" > /dev/null 2> /dev/null", dev, str);
    404400    i = system(command);
    405401    mr_free(command);
     
    425421    int i;
    426422
    427     mr_asprintf(&command,
    428             "dd if=%s bs=512 count=%i 2> /dev/null | strings | grep \"%s\" > /dev/null 2> /dev/null",
    429             dev, n, str);
     423    mr_asprintf(&command, "dd if=%s bs=512 count=%i 2> /dev/null | strings | grep \"%s\" > /dev/null 2> /dev/null", dev, n, str);
    430424    i = system(command);
    431425    mr_free(command);
     
    530524    }
    531525    if (find_home_of_exe(cdr_exe)) {
    532         mr_asprintf(&command,
    533                 "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep CD | cut -d' ' -f2 | head -n1",
    534                 cdr_exe);
     526        mr_asprintf(&command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep CD | cut -d' ' -f2 | head -n1", cdr_exe);
    535527        mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
    536528        mr_free(command);
     
    848840    }
    849841
    850     mr_asprintf(&command,
    851             "%s -scanbus | grep \"[0-9],[0-9],[0-9]\" | grep \"[D|C][V|D]\" | grep -n \"\" | grep \"%s\" | cut -d':' -f2",
    852             cdr_exe, g_cdrw_drive_is_here);
     842    mr_asprintf(&command, "%s -scanbus | grep \"[0-9],[0-9],[0-9]\" | grep \"[D|C][V|D]\" | grep -n \"\" | grep \"%s\" | cut -d':' -f2", cdr_exe, g_cdrw_drive_is_here);
    853843    log_msg(1, "command=%s", command);
    854844    mr_asprintf(&tmp1, "%s", call_program_and_get_last_line_of_output(command));
     
    10421032
    10431033#ifdef __FreeBSD__
    1044     mr_asprintf(&command,
    1045             "lsvfs | tr -s '\t' ' ' | grep -v Filesys | grep -v -- -- | cut -d' ' -f1 | tr -s '\n' ' '");
     1034    mr_asprintf(&command, "lsvfs | tr -s '\t' ' ' | grep -v Filesys | grep -v -- -- | cut -d' ' -f1 | tr -s '\n' ' '");
    10461035#else
    1047     mr_asprintf(&command,
    1048             "grep -v nodev /proc/filesystems | tr -s '\t' ' ' | cut -d' ' -f2 | tr -s '\n' ' '");
     1036    mr_asprintf(&command, "grep -v nodev /proc/filesystems | tr -s '\t' ' ' | cut -d' ' -f2 | tr -s '\n' ' '");
    10491037#endif
    10501038
     
    12431231
    12441232#ifdef __FreeBSD__
    1245     mr_asprintf(&command, "mount_vfat %s %s 2>> %s",
    1246             device, mountpoint, MONDO_LOGFILE);
     1233    mr_asprintf(&command, "mount_vfat %s %s 2>> %s", device, mountpoint, MONDO_LOGFILE);
    12471234
    12481235#else
    1249     mr_asprintf(&command, "mount %s -t vfat %s 2>> %s",
    1250             device, mountpoint, MONDO_LOGFILE);
     1236    mr_asprintf(&command, "mount %s -t vfat %s 2>> %s", device, mountpoint, MONDO_LOGFILE);
    12511237#endif
    12521238
     
    13821368        mr_free(tmp);
    13831369
    1384         mr_asprintf(&tmp, "%s/%s/%s-%d.iso", bkpinfo->isodir,
    1385                 bkpinfo->nfs_remote_dir, bkpinfo->prefix,
    1386                 cd_number_i_want);
     1370        mr_asprintf(&tmp, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, cd_number_i_want);
    13871371        if (!does_file_exist(tmp)) {
    13881372            mr_free(tmp);
    1389             mr_asprintf(&tmp, "%s/isodir/%s/%s-%d.iso", bkpinfo->tmpdir,
    1390                     bkpinfo->nfs_remote_dir, bkpinfo->prefix,
    1391                     cd_number_i_want);
     1373            mr_asprintf(&tmp, "%s/isodir/%s/%s-%d.iso", bkpinfo->tmpdir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, cd_number_i_want);
    13921374            if (does_file_exist(tmp)) {
    13931375                log_msg(1,
     
    15501532            mr_free(tmp);
    15511533
    1552             mr_asprintf(&comment,
    1553                     "How much data (in Megabytes) will each %s store?", mds);
     1534            mr_asprintf(&comment, "How much data (in Megabytes) will each %s store?", mds);
    15541535            mr_free(mds);
    15551536            if (!popup_and_get_string("Size", comment, sz_size, 5)) {
     
    15881569                log_msg(1, "bkpinfo->media_device = %s",
    15891570                        bkpinfo->media_device);
    1590                 mr_asprintf(&comment,
    1591                         "Please specify your %s drive's /dev entry", mds);
     1571                mr_asprintf(&comment, "Please specify your %s drive's /dev entry", mds);
    15921572                if (!popup_and_get_string
    15931573                    ("Device?", comment, bkpinfo->media_device,
     
    17611741
    17621742            if (!bkpinfo->restore_data) {
    1763                 mr_asprintf(&comment,
    1764                     "How much data (in Megabytes) will each media store?");
     1743                mr_asprintf(&comment, "How much data (in Megabytes) will each media store?");
    17651744                if (!popup_and_get_string("Size", comment, sz_size, 5)) {
    17661745                    mr_free(comment);
Note: See TracChangeset for help on using the changeset viewer.