Ignore:
Timestamp:
Feb 2, 2011, 12:35:51 PM (13 years ago)
Author:
Bruno Cornec
Message:
  • Fix #444. mondoarchive now supports inclusion/exclusion of dirs with spaces in their name. this required a syntax change for the -E/-I options where the list of dirs needs to be separated by '|' now instead of ' '.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mondo/src/common/libmondo-filelist.c

    r2711 r2713  
    12951295    mr_asprintf(&sz_res, "%s", incoming);
    12961296    p = sz_res;
    1297     while ((*p != ' ' || in_quotes) && *p != '\0') {
     1297    while ((*p != '|' || in_quotes) && *p != '\0') {
    12981298        if (*p == '\"') {
    12991299            in_quotes = !in_quotes;
     
    13261326                      time_t time_of_last_full_backup)
    13271327{
    1328     const char delims[] = " ";
     1328    const char delims[] = "|";
    13291329
    13301330    DIR *dip;
     
    13361336    static int percentage = 0;
    13371337    char *skip_these;
    1338     char *new_with_spaces;
     1338    char *new_with_pipe;
    13391339    char *strtmp;
    13401340    char *token;
     
    14341434
    14351435//  log_msg(0, "Cataloguing %s", dir);
    1436     if (sth[0] == ' ') {
    1437         mr_asprintf(&skip_these, "%s", sth);
    1438     } else {
    1439         mr_asprintf(&skip_these, " %s ", sth);
    1440     }
    1441     mr_asprintf(&new_with_spaces, " %s ", dir1);
     1436    mr_asprintf(&skip_these, "|%s|", sth);
     1437   
     1438    mr_asprintf(&new_with_pipe, "|%s|", dir1);
    14421439    if ((dip = opendir(dir1)) == NULL) {
    14431440        mr_asprintf(&tmp,"opendir %s", dir1);
    14441441        log_OS_error(tmp);
    14451442        paranoid_free(tmp);
    1446     } else if (strstr(skip_these, new_with_spaces)) {
     1443    } else if (strstr(skip_these, new_with_pipe)) {
    14471444        log_msg(10, "Found dir ***%s**** excluded", dir1);
    14481445        fprintf(fout, "%s\n", dir1);    // if excluded dir then print dir ONLY
     
    14571454                mr_asprintf(&new,"%s%s",dir1,dit->d_name);
    14581455            }
    1459             paranoid_free(new_with_spaces);
    1460             mr_asprintf(&new_with_spaces, " %s ", new);
    1461             if (strstr(skip_these, new_with_spaces)) {
     1456            paranoid_free(new_with_pipe);
     1457            mr_asprintf(&new_with_pipe, "|%s|", new);
     1458            if (strstr(skip_these, new_with_pipe)) {
    14621459                fprintf(fout, "%s\n", new);
    14631460                log_msg(10, "Found child dir ***%s**** excluded", new);
    1464                 paranoid_free(new_with_spaces);
     1461                paranoid_free(new_with_pipe);
    14651462            } else {
    1466                 paranoid_free(new_with_spaces);
     1463                paranoid_free(new_with_pipe);
    14671464                if (!lstat(new, &statbuf)) {
    14681465                    if (!S_ISLNK(statbuf.st_mode)
     
    14971494        }
    14981495    }
    1499     paranoid_free(new_with_spaces);
     1496    paranoid_free(new_with_pipe);
    15001497    paranoid_free(skip_these);
    15011498    mr_free(dir);
     
    15381535    char *p, *q;
    15391536    char *sz_datefile;
    1540     char *sz_filelist, *exclude_paths, *tmp;
     1537    char *sz_filelist, *tmp;
     1538    char *exclude_paths = NULL;
    15411539    int i;
    15421540    FILE *fout;
     
    15491547    malloc_string(tmp);
    15501548    malloc_string(g_skeleton_filelist);
    1551     if (!(exclude_paths = malloc(8*MAX_STR_LEN))) {
    1552         fatal_error("Cannot malloc exclude_paths");
    1553     }
    15541549    mr_asprintf(&sz_datefile,MONDO_CACHE"/difflevel.%d" , 0);
    15551550    if (!include_paths && !userdef_filelist) {
     
    16191614        paranoid_free(tmp1);
    16201615
    1621         snprintf(exclude_paths, (size_t)8*MAX_STR_LEN," %s %s %s %s %s . .. \
    1622 " MNT_CDROM " " MNT_FLOPPY " /media /tmp \
    1623 /proc /sys /dev/shm " MINDI_CACHE, MONDO_CACHE, excp, tmp2, (tmpdir[0] == '/' && tmpdir[1] == '/') ? (tmpdir + 1) : tmpdir, (scratchdir[0] == '/' && scratchdir[1] == '/') ? (scratchdir + 1) : scratchdir);
     1616        mr_asprintf(&exclude_paths, MONDO_CACHE"|%s|%s|%s|%s|.|..|"MNT_CDROM"|"MNT_FLOPPY"|/media|/tmp|/proc|/sys|/dev/shm|"MINDI_CACHE,excp, tmp2, (tmpdir[0] == '/' && tmpdir[1] == '/') ? (tmpdir + 1) : tmpdir, (scratchdir[0] == '/' && scratchdir[1] == '/') ? (scratchdir + 1) : scratchdir);
    16241617        paranoid_free(tmp2);
    16251618
     
    16481641                p += strlen(q);
    16491642                paranoid_free(q);
    1650                 while (*p == ' ') {
     1643                while (*p == '|') {
    16511644                    p++;
    16521645                }
Note: See TracChangeset for help on using the changeset viewer.