Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 28800
Collapse All | Expand All

(-)mc-4.6.0-orig/src/cmd.c (-2 / +2 lines)
Lines 542-548 Link Here
542
            if (dirflag)
542
            if (dirflag)
543
                continue;
543
                continue;
544
	}
544
	}
545
	c = regexp_match (reg_exp_t, cpanel->dir.list [i].fname, match_file);
545
	c = regexp_match (reg_exp_t, cpanel->dir.list [i].fname, match_file, 0);
546
	if (c == -1){
546
	if (c == -1){
547
	    message (1, MSG_ERROR, _("  Malformed regular expression  "));
547
	    message (1, MSG_ERROR, _("  Malformed regular expression  "));
548
	    g_free (reg_exp);
548
	    g_free (reg_exp);
Lines 588-594 Link Here
588
            if (dirflag)
588
            if (dirflag)
589
                continue;
589
                continue;
590
        }
590
        }
591
	c = regexp_match (reg_exp_t, cpanel->dir.list [i].fname, match_file);
591
	c = regexp_match (reg_exp_t, cpanel->dir.list [i].fname, match_file, 0);
592
	if (c == -1){
592
	if (c == -1){
593
	    message (1, MSG_ERROR, _("  Malformed regular expression  "));
593
	    message (1, MSG_ERROR, _("  Malformed regular expression  "));
594
	    g_free (reg_exp);
594
	    g_free (reg_exp);
(-)mc-4.6.0-orig/src/dir.c (-1 / +1 lines)
Lines 404-410 Link Here
404
	    *stale_link = 1;
404
	    *stale_link = 1;
405
    }
405
    }
406
    if (!(S_ISDIR (buf1->st_mode) || *link_to_dir) && filter
406
    if (!(S_ISDIR (buf1->st_mode) || *link_to_dir) && filter
407
	&& !regexp_match (filter, dp->d_name, match_file))
407
	&& !regexp_match (filter, dp->d_name, match_file, 0))
408
	return 0;
408
	return 0;
409
409
410
    /* Need to grow the *list? */
410
    /* Need to grow the *list? */
(-)mc-4.6.0-orig/src/ext.c (-3 / +3 lines)
Lines 450-456 Link Here
450
450
451
    if (content_string && content_string[0]
451
    if (content_string && content_string[0]
452
	&& regexp_match (ptr, content_string + content_shift,
452
	&& regexp_match (ptr, content_string + content_shift,
453
			 match_normal)) {
453
			 match_normal, 0)) {
454
	found = 1;
454
	found = 1;
455
    }
455
    }
456
456
Lines 593-603 Link Here
593
		/* Do not transform shell patterns, you can use shell/ for
593
		/* Do not transform shell patterns, you can use shell/ for
594
		 * that
594
		 * that
595
		 */
595
		 */
596
		if (regexp_match (p, filename, match_normal))
596
		if (regexp_match (p, filename, match_normal, 0))
597
		    found = 1;
597
		    found = 1;
598
	    } else if (!strncmp (p, "directory/", 10)) {
598
	    } else if (!strncmp (p, "directory/", 10)) {
599
		if (S_ISDIR (mystat.st_mode)
599
		if (S_ISDIR (mystat.st_mode)
600
		    && regexp_match (p + 10, filename, match_normal))
600
		    && regexp_match (p + 10, filename, match_normal, 0))
601
		    found = 1;
601
		    found = 1;
602
	    } else if (!strncmp (p, "shell/", 6)) {
602
	    } else if (!strncmp (p, "shell/", 6)) {
603
		p += 6;
603
		p += 6;
(-)mc-4.6.0-orig/src/find.c (-1 / +6 lines)
Lines 507-512 Link Here
507
    static int pos;
507
    static int pos;
508
    static int subdirs_left = 0;
508
    static int subdirs_left = 0;
509
    char *tmp_name;		/* For building file names */
509
    char *tmp_name;		/* For building file names */
510
    int flags = 0;
510
511
511
    if (!h) { /* someone forces me to close dirp */
512
    if (!h) { /* someone forces me to close dirp */
512
	if (dirp) {
513
	if (dirp) {
Lines 516-521 Link Here
516
        dp = 0;
517
        dp = 0;
517
	return 1;
518
	return 1;
518
    }
519
    }
520
521
    if (!(case_sense->state & C_BOOL))
522
        flags |= REG_ICASE;
523
519
 do_search_begin:
524
 do_search_begin:
520
    while (!dp){
525
    while (!dp){
521
	
526
	
Lines 589-595 Link Here
589
	}
594
	}
590
    }
595
    }
591
596
592
    if (regexp_match (find_pattern, dp->d_name, match_file)){
597
    if (regexp_match (find_pattern, dp->d_name, match_file, flags)){
593
	if (content_pattern)
598
	if (content_pattern)
594
	    search_content (h, directory, dp->d_name);
599
	    search_content (h, directory, dp->d_name);
595
	else 
600
	else 
(-)mc-4.6.0-orig/src/user.c (-3 / +3 lines)
Lines 390-407 Link Here
390
	    break;
390
	    break;
391
	case 'f': /* file name pattern */
391
	case 'f': /* file name pattern */
392
	    p = extract_arg (p, arg);
392
	    p = extract_arg (p, arg);
393
	    *condition = panel && regexp_match (arg, panel->dir.list [panel->selected].fname, match_file);
393
	    *condition = panel && regexp_match (arg, panel->dir.list [panel->selected].fname, match_file, 0);
394
	    break;
394
	    break;
395
	case 'y': /* syntax pattern */
395
	case 'y': /* syntax pattern */
396
            if (edit_widget && edit_widget->syntax_type) {
396
            if (edit_widget && edit_widget->syntax_type) {
397
	        p = extract_arg (p, arg);
397
	        p = extract_arg (p, arg);
398
	        *condition = panel &&
398
	        *condition = panel &&
399
                    regexp_match (arg, edit_widget->syntax_type, match_normal);
399
                    regexp_match (arg, edit_widget->syntax_type, match_normal, 0);
400
	    }
400
	    }
401
                break;
401
                break;
402
	case 'd':
402
	case 'd':
403
	    p = extract_arg (p, arg);
403
	    p = extract_arg (p, arg);
404
	    *condition = panel && regexp_match (arg, panel->cwd, match_file);
404
	    *condition = panel && regexp_match (arg, panel->cwd, match_file, 0);
405
	    break;
405
	    break;
406
	case 't':
406
	case 't':
407
	    p = extract_arg (p, arg);
407
	    p = extract_arg (p, arg);
(-)mc-4.6.0-orig/src/util.c (-3 / +6 lines)
Lines 537-562 Link Here
537
	return  g_strdup (pattern);
537
	return  g_strdup (pattern);
538
}
538
}
539
539
540
int regexp_match (char *pattern, char *string, int match_type)
540
int regexp_match (char *pattern, char *string, int match_type, int flags)
541
{
541
{
542
    static regex_t r;
542
    static regex_t r;
543
    static char *old_pattern = NULL;
543
    static char *old_pattern = NULL;
544
    static int old_type;
544
    static int old_type;
545
    static int old_flags;
545
    int    rval;
546
    int    rval;
546
547
547
    if (!old_pattern || STRCOMP (old_pattern, pattern) || old_type != match_type){
548
    if (!old_pattern || STRCOMP (old_pattern, pattern) || old_type != match_type || old_flags != flags){
548
	if (old_pattern){
549
	if (old_pattern){
549
	    regfree (&r);
550
	    regfree (&r);
550
	    g_free (old_pattern);
551
	    g_free (old_pattern);
551
	    old_pattern = NULL;
552
	    old_pattern = NULL;
552
	}
553
	}
553
	pattern = convert_pattern (pattern, match_type, 0);
554
	pattern = convert_pattern (pattern, match_type, 0);
554
	if (regcomp (&r, pattern, REG_EXTENDED|REG_NOSUB|MC_ARCH_FLAGS)) {
555
	
556
	if (regcomp (&r, pattern, REG_EXTENDED|REG_NOSUB|MC_ARCH_FLAGS|flags)) {
555
	    g_free (pattern);
557
	    g_free (pattern);
556
	    return -1;
558
	    return -1;
557
	}
559
	}
558
	old_pattern = pattern;
560
	old_pattern = pattern;
559
	old_type = match_type;
561
	old_type = match_type;
562
	old_flags = flags;
560
    }
563
    }
561
    rval = !regexec (&r, string, 0, NULL, 0);
564
    rval = !regexec (&r, string, 0, NULL, 0);
562
    return rval;
565
    return rval;
(-)mc-4.6.0-orig/src/util.h (-1 / +1 lines)
Lines 65-71 Link Here
65
enum { match_file, match_normal };
65
enum { match_file, match_normal };
66
extern int easy_patterns;
66
extern int easy_patterns;
67
char *convert_pattern (char *pattern, int match_type, int do_group);
67
char *convert_pattern (char *pattern, int match_type, int do_group);
68
int regexp_match (char *pattern, char *string, int match_type);
68
int regexp_match (char *pattern, char *string, int match_type, int flags);
69
69
70
/* Error pipes */
70
/* Error pipes */
71
void open_error_pipe (void);
71
void open_error_pipe (void);

Return to bug 28800