-/* $OpenBSD: format.c,v 1.138 2017/05/12 22:43:15 nicm Exp $ */
+/* $OpenBSD: format.c,v 1.139 2017/05/29 15:43:48 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
#include <ctype.h>
#include <errno.h>
+#include <fnmatch.h>
#include <libgen.h>
#include <netdb.h>
#include <stdarg.h>
/* 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;
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);
-.\" $OpenBSD: tmux.1,v 1.552 2017/05/29 07:46:32 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.553 2017/05/29 15:43:48 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\"
.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