Changeset 273 in MondoRescue for branches/2.06/mondo/mondo/mondorestore


Ignore:
Timestamp:
Jan 3, 2006, 4:09:12 PM (18 years ago)
Author:
bcornec
Message:

Patches from Sébastien Aperghis-Tramoni <maddingue@…>

replace several occurences of "cat .. | grep .."
or with similar commands that accept filenames as arguments.
+ some sort | uniq replaced by sort -u

Location:
branches/2.06/mondo/mondo/mondorestore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2.06/mondo/mondo/mondorestore/mondo-restore.c

    r251 r273  
    30983098    fatal_error("This will fail");
    30993099    sprintf(command,
    3100             "cat %s | grep -x \"%s.*\" > %s",
    3101             g_filelist_full, restore_this_directory, g_filelist_full);
     3100            "grep -x \"%s.*\" %s > %s",
     3101            restore_this_directory, g_filelist_full, g_filelist_full);
    31023102    if (system(command)) {
    31033103        retval++;
     
    31083108    fatal_error("This will fail");
    31093109    sprintf(command,
    3110             "cat %s | grep -x \"%s.*\" > %s",
    3111             g_biggielist_txt, restore_this_directory, g_biggielist_txt);
     3110            "grep -x \"%s.*\" %s > %s",
     3111            restore_this_directory, g_biggielist_txt, g_biggielist_txt);
    31123112    if (system(command)) {
    31133113        log_msg(1,
  • branches/2.06/mondo/mondo/mondorestore/mondo-rstr-newt.c

    r128 r273  
    605605    assert(raidrec != NULL);
    606606    system
    607         ("cat /proc/mdstat | grep Pers > /tmp/raid-personalities.txt 2> /dev/null");
     607        ("grep Pers /proc/mdstat > /tmp/raid-personalities.txt 2> /dev/null");
    608608    strcpy(personalities,
    609609           last_line_of_file("/tmp/raid-personalities.txt"));
  • branches/2.06/mondo/mondo/mondorestore/mondo-rstr-tools.c

    r253 r273  
    400400            f, file);
    401401    log_msg(2, tmp);
    402     sprintf(command, "cat %s | grep -x \"%s\"", list_fname, file);
     402    sprintf(command, "grep -x \"%s\" %s", file, list_fname);
    403403    res = run_program_and_log_output(command, FALSE);
    404404    paranoid_free(command);
     
    558558    }
    559559    sprintf(newfile_fname, "%s/rc.local.mondorescue", path);
    560     sprintf(tmp, "cat %s | grep mondorescue > /dev/null 2> /dev/null",
     560    sprintf(tmp, "grep mondorescue %s > /dev/null 2> /dev/null",
    561561            rclocal_fname);
    562562    if (system(tmp)) {
     
    569569\\n\
    570570\\n\
    571 cat %s | grep -v mondorescue > %s\\n\
     571grep -v mondorescue %s > %s\\n\
    572572rm -f /var/lock/subsys/*xfs*\\n\
    573573rm -f /var/run/xfs.*\\n\
     
    13711371            paranoid_system(command);
    13721372        }
    1373         sprintf(command, "cat %s | grep  -x \"/dev/.*\" > %s",
     1373        sprintf(command, "grep  -x \"/dev/.*\" %s > %s",
    13741374                g_biggielist_txt, g_filelist_imagedevs);
    13751375        paranoid_system(command);
Note: See TracChangeset for help on using the changeset viewer.