aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2017-05-29 18:01:14 +0100
committerThomas Adam <thomas@xteddy.org>2017-05-29 18:01:14 +0100
commitd3959a21185d7a1682d033982921753baa689a41 (patch)
treee646a6d7612e355b48b9955b64d155ebb8cf0992
parentbfd7209053669f58cf2ddfa86bb3ed2f9340acd8 (diff)
parent12575014995582b30165d80efa1096eee7622a81 (diff)
downloadrtmux-d3959a21185d7a1682d033982921753baa689a41.tar.gz
rtmux-d3959a21185d7a1682d033982921753baa689a41.tar.bz2
rtmux-d3959a21185d7a1682d033982921753baa689a41.zip
Merge branch 'obsd-master'
-rw-r--r--format.c9
-rw-r--r--tmux.17
2 files changed, 16 insertions, 0 deletions
diff --git a/format.c b/format.c
index d017aa0a..294f8801 100644
--- a/format.c
+++ b/format.c
@@ -22,6 +22,7 @@
#include <ctype.h>
#include <errno.h>
+#include <fnmatch.h>
#include <libgen.h>
#include <netdb.h>
#include <stdarg.h>
@@ -885,6 +886,12 @@ format_replace(struct format_tree *ft, const char *key, size_t keylen,
/* Is there a length limit or whatnot? */
switch (copy[0]) {
+ case 'm':
+ if (copy[1] != ':')
+ break;
+ compare = -2;
+ copy += 2;
+ break;
case '!':
if (copy[1] == '=' && copy[2] == ':') {
compare = -1;
@@ -960,6 +967,8 @@ format_replace(struct format_tree *ft, const char *key, size_t keylen,
value = xstrdup("1");
else if (compare == -1 && strcmp(left, right) != 0)
value = xstrdup("1");
+ else if (compare == -2 && fnmatch(left, right, 0) == 0)
+ value = xstrdup("1");
else
value = xstrdup("0");
free(right);
diff --git a/tmux.1 b/tmux.1
index 563d0452..5f9709b4 100644
--- a/tmux.1
+++ b/tmux.1
@@ -3448,6 +3448,13 @@ if running on
.Ql myhost ,
otherwise by
.Ql 0.
+An
+.Ql m
+specifies a
+.Xr fnmatch 3
+comparison - the first argument is the pattern and the second the string to
+compare. For example,
+.Ql #{m:*foo*,#{host}} .
.Pp
A limit may be placed on the length of the resultant string by prefixing it
by an