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
|
|
506 | 506 | continue; |
507 | 507 | } |
508 | 508 | c = regexp_match (reg_exp_t, current_panel->dir.list[i].fname, |
509 | | match_file); |
| 509 | match_file, 0); |
510 | 510 | if (c == -1) { |
511 | 511 | message (1, MSG_ERROR, _(" Malformed regular expression ")); |
512 | 512 | g_free (reg_exp); |
diff -Naur mc-mod.orig/src/dir.c mc-mod/src/dir.c
old
|
new
|
|
322 | 322 | *stale_link = 1; |
323 | 323 | } |
324 | 324 | 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)) |
326 | 326 | return 0; |
327 | 327 | |
328 | 328 | /* Need to grow the *list? */ |
diff -Naur mc-mod.orig/src/ext.c mc-mod/src/ext.c
old
|
new
|
|
393 | 393 | } |
394 | 394 | |
395 | 395 | 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)) { |
397 | 397 | found = 1; |
398 | 398 | } |
399 | 399 | |
… |
… |
|
517 | 517 | /* Do not transform shell patterns, you can use shell/ for |
518 | 518 | * that |
519 | 519 | */ |
520 | | if (regexp_match (p, filename, match_regex)) |
| 520 | if (regexp_match (p, filename, match_regex, 0)) |
521 | 521 | found = 1; |
522 | 522 | } else if (!strncmp (p, "directory/", 10)) { |
523 | 523 | if (S_ISDIR (mystat.st_mode) |
524 | | && regexp_match (p + 10, filename, match_regex)) |
| 524 | && regexp_match (p + 10, filename, match_regex, 0)) |
525 | 525 | found = 1; |
526 | 526 | } else if (!strncmp (p, "shell/", 6)) { |
527 | 527 | p += 6; |
diff -Naur mc-mod.orig/src/find.c mc-mod/src/find.c
old
|
new
|
|
613 | 613 | struct stat tmp_stat; |
614 | 614 | static int pos; |
615 | 615 | static int subdirs_left = 0; |
| 616 | int cflags = 0; |
616 | 617 | |
617 | 618 | if (!h) { /* someone forces me to close dirp */ |
618 | 619 | if (dirp) { |
… |
… |
|
624 | 625 | dp = 0; |
625 | 626 | return 1; |
626 | 627 | } |
| 628 | |
| 629 | if (case_sensitive == 0) |
| 630 | cflags |= REG_ICASE; |
627 | 631 | do_search_begin: |
628 | 632 | while (!dp){ |
629 | 633 | |
… |
… |
|
700 | 704 | g_free (tmp_name); |
701 | 705 | } |
702 | 706 | |
703 | | if (regexp_match (find_pattern, dp->d_name, match_file)){ |
| 707 | if (regexp_match (find_pattern, dp->d_name, match_file, cflags)){ |
704 | 708 | if (content_pattern) { |
705 | 709 | if (search_content (h, directory, dp->d_name)) { |
706 | 710 | return 1; |
diff -Naur mc-mod.orig/src/subshell.c mc-mod/src/subshell.c
old
|
new
|
|
395 | 395 | subshell_type = ZSH; |
396 | 396 | else if (strstr (shell, "/tcsh")) |
397 | 397 | subshell_type = TCSH; |
| 398 | else if (strstr (shell, "/csh")) |
| 399 | subshell_type = TCSH; |
398 | 400 | else if (strstr (shell, "/bash") || getenv ("BASH")) |
399 | 401 | subshell_type = BASH; |
400 | 402 | else { |
diff -Naur mc-mod.orig/src/user.c mc-mod/src/user.c
old
|
new
|
|
412 | 412 | break; |
413 | 413 | case 'f': /* file name pattern */ |
414 | 414 | 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); |
416 | 416 | break; |
417 | 417 | case 'y': /* syntax pattern */ |
418 | 418 | if (edit_widget && edit_widget->syntax_type) { |
419 | 419 | p = extract_arg (p, arg, sizeof (arg)); |
420 | 420 | *condition = panel && |
421 | | regexp_match (arg, edit_widget->syntax_type, match_normal); |
| 421 | regexp_match (arg, edit_widget->syntax_type, match_normal, 0); |
422 | 422 | } |
423 | 423 | break; |
424 | 424 | case 'd': |
425 | 425 | 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); |
427 | 427 | break; |
428 | 428 | case 't': |
429 | 429 | p = extract_arg (p, arg, sizeof (arg)); |
diff -Naur mc-mod.orig/src/util.c mc-mod/src/util.c
old
|
new
|
|
581 | 581 | } |
582 | 582 | |
583 | 583 | int |
584 | | regexp_match (const char *pattern, const char *string, int match_type) |
| 584 | regexp_match (const char *pattern, const char *string, int match_type, int cflags) |
585 | 585 | { |
586 | 586 | static regex_t r; |
587 | 587 | static char *old_pattern = NULL; |
588 | 588 | static int old_type; |
| 589 | static int old_cflags; |
589 | 590 | int rval; |
590 | 591 | char *my_pattern; |
591 | 592 | |
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){ |
593 | 595 | if (old_pattern){ |
594 | 596 | regfree (&r); |
595 | 597 | g_free (old_pattern); |
596 | 598 | old_pattern = NULL; |
597 | 599 | } |
598 | 600 | 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)) { |
600 | 602 | g_free (my_pattern); |
601 | 603 | return -1; |
602 | 604 | } |
| 605 | old_cflags = cflags; |
603 | 606 | old_pattern = my_pattern; |
604 | 607 | old_type = match_type; |
605 | 608 | } |
diff -Naur mc-mod.orig/src/util.h mc-mod/src/util.h
old
|
new
|
|
126 | 126 | |
127 | 127 | extern int easy_patterns; |
128 | 128 | char *convert_pattern (const char *pattern, int match_type, int do_group); |
129 | | int regexp_match (const char *pattern, const char *string, int match_type); |
| 129 | int regexp_match (const char *pattern, const char *string, int match_type, int cflags); |
130 | 130 | |
131 | 131 | /* Error pipes */ |
132 | 132 | void open_error_pipe (void); |