Changeset 2402


Ignore:
Timestamp:
Sep 16, 2009, 1:04:17 PM (10 years ago)
Author:
bruno
Message:

Use dir for shell related commands and dir1 for C related actions in open_and_list_dir to avoid missing some files with { in names e.g.

File:
1 edited

Legend:

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

    r2369 r2402  
    13481348    time_t this_time;
    13491349
     1350    /* dir is needed when we pass it to the shell */
    13501351    dir = mr_stresc(dir1, "`$\\\"(){}'[]&*?|!#~", '\\');
    13511352    p = strrchr(dir, '/');
     
    13831384            1 + atol(call_program_and_get_last_line_of_output(tmp));
    13841385        paranoid_free(tmp);
    1385         sprintf(name_of_evalcall_form, "Making catalog of %s", dir);
     1386        sprintf(name_of_evalcall_form, "Making catalog of %s", dir1);
    13861387        open_evalcall_form(name_of_evalcall_form);
    13871388        find_skeleton_marker[0] = '\0';
     
    14091410#ifndef _XWIN
    14101411                if (!g_text_mode) {
    1411                     mr_asprintf(&tmp, "Reading %-68s", dir);
     1412                    mr_asprintf(&tmp, "Reading %-68s", dir1);
    14121413                    newtDrawRootText(0, g_noof_rows - 3, tmp);
    14131414                    paranoid_free(tmp);
     
    14271428        mr_asprintf(&skip_these, " %s ", sth);
    14281429    }
    1429     mr_asprintf(&new_with_spaces, " %s ", dir);
    1430     if ((dip = opendir(dir)) == NULL) {
    1431         mr_asprintf(&tmp,"opendir %s", dir);
     1430    mr_asprintf(&new_with_spaces, " %s ", dir1);
     1431    if ((dip = opendir(dir1)) == NULL) {
     1432        mr_asprintf(&tmp,"opendir %s", dir1);
    14321433        log_OS_error(tmp);
    14331434        paranoid_free(tmp);
    14341435    } else if (strstr(skip_these, new_with_spaces)) {
    1435         fprintf(fout, "%s\n", dir); // if excluded dir then print dir ONLY
     1436        fprintf(fout, "%s\n", dir1);    // if excluded dir then print dir ONLY
    14361437    } else {
    1437         fprintf(fout, "%s\n", dir);
     1438        fprintf(fout, "%s\n", dir1);
    14381439        while ((dit = readdir(dip)) != NULL) {
    14391440            i++;
    1440             if (strcmp(dir, "/")) {
    1441                 mr_asprintf(&new,"%s/%s",dir,dit->d_name);
     1441            if (strcmp(dir1, "/")) {
     1442                mr_asprintf(&new,"%s/%s",dir1,dit->d_name);
    14421443            } else {
    1443                 mr_asprintf(&new,"%s%s",dir,dit->d_name);
     1444                mr_asprintf(&new,"%s%s",dir1,dit->d_name);
    14441445            }
    14451446            paranoid_free(new_with_spaces);
Note: See TracChangeset for help on using the changeset viewer.