about summary refs log tree commit diff
path: root/mshow.c
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-07-23 00:46:48 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2016-07-23 00:46:48 +0200
commit3ed3878b2b01a301687e13ce95049c0c67c98cc2 (patch)
treee5fe79eef79b38d3e64180f11391b0421c88800e /mshow.c
parent25f110951aa3caae0bce3545dfae892505024fcf (diff)
downloadmblaze-3ed3878b2b01a301687e13ce95049c0c67c98cc2.tar.gz
mblaze-3ed3878b2b01a301687e13ce95049c0c67c98cc2.tar.xz
mblaze-3ed3878b2b01a301687e13ce95049c0c67c98cc2.zip
mshow: use fnmatch for extraction
Diffstat (limited to 'mshow.c')
-rw-r--r--mshow.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/mshow.c b/mshow.c
index fbe1683..a5c078c 100644
--- a/mshow.c
+++ b/mshow.c
@@ -4,6 +4,7 @@
 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <fnmatch.h>
 #include <iconv.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -402,7 +403,8 @@ extract_mime(int depth, struct message *msg, char *body, size_t bodylen)
 					printf("%s\n", bufptr);
 					writefile(bufptr, body, bodylen);
 				}
-			} else if (filename && strcmp(a, filename) == 0) {
+			} else if (filename &&
+				   fnmatch(a, filename, FNM_PATHNAME) == 0) {
 				// extract by name
 				if (extract_stdout) {
 					fwrite(body, 1, bodylen, stdout);