summaryrefslogtreecommitdiffstats
path: root/src/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index b68b71f2..528cc91f 100644
--- a/src/util.c
+++ b/src/util.c
@@ -30,6 +30,7 @@
#include <dirent.h>
#include <zlib.h>
#include <libtar.h>
+#include <regex.h>
#include "util.h"
extern unsigned short pmo_verbose;
@@ -427,5 +428,15 @@ int grep(const char *fn, const char *needle)
return(0);
}
+int reg_match(char *string, char *pattern)
+{
+ int result;
+ regex_t reg;
+
+ regcomp(&reg, pattern, REG_EXTENDED | REG_NOSUB);
+ result = regexec(&reg, string, 0, 0, 0);
+ regfree(&reg);
+ return(!(result));
+}
/* vim: set ts=2 sw=2 noet: */