From 8a11cc1f6be91c64c9805576d30d1de9d6505dfc Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Thu, 12 Oct 2017 16:36:41 +0200 Subject: perc_match: patterns with ** match against full path too --- xe.1 | 4 +++- xe.c | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/xe.1 b/xe.1 index a7769eb..9661c73 100644 --- a/xe.1 +++ b/xe.1 @@ -139,7 +139,9 @@ is regarded as a pattern, see .Sx PERCENT RULES below. -Patterns without a slash are matched against the basenames only. +Patterns without a slash (or +.Sq Li \&*\&* ) +are matched against the basenames only. .Pp Multiple runs of patterns and commands are separated by .Sq Li \&+ . diff --git a/xe.c b/xe.c index 7e75a57..000c0b3 100644 --- a/xe.c +++ b/xe.c @@ -493,7 +493,7 @@ perc(char *pat, char *str, int lvl) int perc_match(char *pat, char *arg) { - if (!strchr(pat, '/')) { + if (!strchr(pat, '/') && !strstr(pat, "**")) { char *d = strrchr(arg, '/'); if (d) arg = d + 1; @@ -515,7 +515,7 @@ perc_subst(char *pat, char *base, char *arg) if (strcmp(arg, replace) == 0) return base; - if (!strchr(pat, '/')) { + if (!strchr(pat, '/') && !strstr(pat, "**")) { char *d = strrchr(base, '/'); if (d) base = d + 1; -- cgit 1.4.1