aboutsummaryrefslogtreecommitdiff
path: root/utility.c
diff options
context:
space:
mode:
Diffstat (limited to 'utility.c')
-rw-r--r--utility.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/utility.c b/utility.c
index 46907e46a..cbbc02f98 100644
--- a/utility.c
+++ b/utility.c
@@ -1721,6 +1721,22 @@ char *get_last_path_component(char *path)
}
#endif
+#if defined BB_GREP || defined BB_SED
+int bb_regcomp(regex_t *preg, const char *regex, int cflags)
+{
+ int ret;
+ if ((ret = regcomp(preg, regex, cflags)) != 0) {
+ int errmsgsz = regerror(ret, preg, NULL, 0);
+ char *errmsg = xmalloc(errmsgsz);
+ regerror(ret, preg, errmsg, errmsgsz);
+ errorMsg("bb_regcomp: %s\n", errmsg);
+ free(errmsg);
+ regfree(preg);
+ }
+ return ret;
+}
+#endif
+
/* END CODE */
/*
Local Variables: