aboutsummaryrefslogtreecommitdiff
path: root/lib/xwrap.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/xwrap.c')
-rw-r--r--lib/xwrap.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/xwrap.c b/lib/xwrap.c
index 51bd2b43..5310506c 100644
--- a/lib/xwrap.c
+++ b/lib/xwrap.c
@@ -514,3 +514,14 @@ long xparsetime(char *arg, long units, long *fraction)
return l;
}
+
+// Compile a regular expression into a regex_t
+void xregcomp(regex_t *preg, char *regex, int cflags)
+{
+ int rc = regcomp(preg, regex, cflags);
+
+ if (rc) {
+ regerror(rc, preg, libbuf, sizeof(libbuf));
+ error_exit("xregcomp: %s", libbuf);
+ }
+}