Ticket #56: case-sensitive-find-fix-forcvs_20070206.patch

File case-sensitive-find-fix-forcvs_20070206.patch, 5.9 KB (added by slavazanko, 15 years ago)

added by krix

  • src/cmd.c

    Description: Fixes case-sensitive bug in find dialog
    Status to upstream: Not know, need info, need view CVS
    Source URL and bug desc.: http://www.freebsd.org/cgi/query-pr.cgi?pr=99428
    
    diff -Naur mc-mod.orig/src/cmd.c mc-mod/src/cmd.c
    old new  
    506506                continue; 
    507507        } 
    508508        c = regexp_match (reg_exp_t, current_panel->dir.list[i].fname, 
    509                           match_file); 
     509                          match_file, 0); 
    510510        if (c == -1) { 
    511511            message (1, MSG_ERROR, _("  Malformed regular expression  ")); 
    512512            g_free (reg_exp); 
  • src/dir.c

    diff -Naur mc-mod.orig/src/dir.c mc-mod/src/dir.c
    old new  
    322322            *stale_link = 1; 
    323323    } 
    324324    if (!(S_ISDIR (buf1->st_mode) || *link_to_dir) && filter 
    325         && !regexp_match (filter, dp->d_name, match_file)) 
     325        && !regexp_match (filter, dp->d_name, match_file, 0)) 
    326326        return 0; 
    327327 
    328328    /* Need to grow the *list? */ 
  • src/ext.c

    diff -Naur mc-mod.orig/src/ext.c mc-mod/src/ext.c
    old new  
    393393    } 
    394394 
    395395    if (content_string[0] 
    396         && regexp_match (ptr, content_string + content_shift, match_regex)) { 
     396        && regexp_match (ptr, content_string + content_shift, match_regex, 0)) { 
    397397        found = 1; 
    398398    } 
    399399 
     
    517517                /* Do not transform shell patterns, you can use shell/ for 
    518518                 * that 
    519519                 */ 
    520                 if (regexp_match (p, filename, match_regex)) 
     520                if (regexp_match (p, filename, match_regex, 0)) 
    521521                    found = 1; 
    522522            } else if (!strncmp (p, "directory/", 10)) { 
    523523                if (S_ISDIR (mystat.st_mode) 
    524                     && regexp_match (p + 10, filename, match_regex)) 
     524                    && regexp_match (p + 10, filename, match_regex, 0)) 
    525525                    found = 1; 
    526526            } else if (!strncmp (p, "shell/", 6)) { 
    527527                p += 6; 
  • src/find.c

    diff -Naur mc-mod.orig/src/find.c mc-mod/src/find.c
    old new  
    613613    struct stat tmp_stat; 
    614614    static int pos; 
    615615    static int subdirs_left = 0; 
     616    int cflags = 0; 
    616617 
    617618    if (!h) { /* someone forces me to close dirp */ 
    618619        if (dirp) { 
     
    624625        dp = 0; 
    625626        return 1; 
    626627    } 
     628 
     629    if (case_sensitive == 0) 
     630        cflags |= REG_ICASE; 
    627631 do_search_begin: 
    628632    while (!dp){ 
    629633         
     
    700704        g_free (tmp_name); 
    701705    } 
    702706 
    703     if (regexp_match (find_pattern, dp->d_name, match_file)){ 
     707    if (regexp_match (find_pattern, dp->d_name, match_file, cflags)){ 
    704708        if (content_pattern) { 
    705709            if (search_content (h, directory, dp->d_name)) { 
    706710                return 1; 
  • src/subshell.c

    diff -Naur mc-mod.orig/src/subshell.c mc-mod/src/subshell.c
    old new  
    395395            subshell_type = ZSH; 
    396396        else if (strstr (shell, "/tcsh")) 
    397397            subshell_type = TCSH; 
     398        else if (strstr (shell, "/csh")) 
     399            subshell_type = TCSH; 
    398400        else if (strstr (shell, "/bash") || getenv ("BASH")) 
    399401            subshell_type = BASH; 
    400402        else { 
  • src/user.c

    diff -Naur mc-mod.orig/src/user.c mc-mod/src/user.c
    old new  
    412412            break; 
    413413        case 'f': /* file name pattern */ 
    414414            p = extract_arg (p, arg, sizeof (arg)); 
    415             *condition = panel && regexp_match (arg, panel->dir.list [panel->selected].fname, match_file); 
     415            *condition = panel && regexp_match (arg, panel->dir.list [panel->selected].fname, match_file, 0); 
    416416            break; 
    417417        case 'y': /* syntax pattern */ 
    418418            if (edit_widget && edit_widget->syntax_type) { 
    419419                p = extract_arg (p, arg, sizeof (arg)); 
    420420                *condition = panel && 
    421                     regexp_match (arg, edit_widget->syntax_type, match_normal); 
     421                    regexp_match (arg, edit_widget->syntax_type, match_normal, 0); 
    422422            } 
    423423            break; 
    424424        case 'd': 
    425425            p = extract_arg (p, arg, sizeof (arg)); 
    426             *condition = panel && regexp_match (arg, panel->cwd, match_file); 
     426            *condition = panel && regexp_match (arg, panel->cwd, match_file, 0); 
    427427            break; 
    428428        case 't': 
    429429            p = extract_arg (p, arg, sizeof (arg)); 
  • src/util.c

    diff -Naur mc-mod.orig/src/util.c mc-mod/src/util.c
    old new  
    581581} 
    582582 
    583583int 
    584 regexp_match (const char *pattern, const char *string, int match_type) 
     584regexp_match (const char *pattern, const char *string, int match_type, int cflags) 
    585585{ 
    586586    static regex_t r; 
    587587    static char *old_pattern = NULL; 
    588588    static int old_type; 
     589    static int old_cflags; 
    589590    int    rval; 
    590591    char *my_pattern; 
    591592 
    592     if (!old_pattern || STRCOMP (old_pattern, pattern) || old_type != match_type){ 
     593    if (!old_pattern || STRCOMP (old_pattern, pattern) || 
     594                old_type != match_type || cflags != old_cflags){ 
    593595        if (old_pattern){ 
    594596            regfree (&r); 
    595597            g_free (old_pattern); 
    596598            old_pattern = NULL; 
    597599        } 
    598600        my_pattern = convert_pattern (pattern, match_type, 0); 
    599         if (regcomp (&r, my_pattern, REG_EXTENDED|REG_NOSUB|MC_ARCH_FLAGS)) { 
     601        if (regcomp (&r, my_pattern, REG_EXTENDED|REG_NOSUB|MC_ARCH_FLAGS|cflags)) { 
    600602            g_free (my_pattern); 
    601603            return -1; 
    602604        } 
     605        old_cflags = cflags; 
    603606        old_pattern = my_pattern; 
    604607        old_type = match_type; 
    605608    } 
  • src/util.h

    diff -Naur mc-mod.orig/src/util.h mc-mod/src/util.h
    old new  
    126126 
    127127extern int easy_patterns; 
    128128char *convert_pattern (const char *pattern, int match_type, int do_group); 
    129 int regexp_match (const char *pattern, const char *string, int match_type); 
     129int regexp_match (const char *pattern, const char *string, int match_type, int cflags); 
    130130 
    131131/* Error pipes */ 
    132132void open_error_pipe (void);