aboutsummaryrefslogtreecommitdiff
path: root/lib/xregcomp.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2007-04-23 15:45:55 -0400
committerRob Landley <rob@landley.net>2007-04-23 15:45:55 -0400
commitc92fde0bc75ade9d06c0d843c4693b9e2e338938 (patch)
treeae47a9a3ea727cc9170c67fbc044aa039f22a480 /lib/xregcomp.c
parent4f34f0aa4d4f0874a6dbcafe8e43cc8ef2182092 (diff)
downloadtoybox-c92fde0bc75ade9d06c0d843c4693b9e2e338938.tar.gz
Add sync and an incomplete version of mdev.
Diffstat (limited to 'lib/xregcomp.c')
-rw-r--r--lib/xregcomp.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/xregcomp.c b/lib/xregcomp.c
new file mode 100644
index 00000000..60446ef8
--- /dev/null
+++ b/lib/xregcomp.c
@@ -0,0 +1,23 @@
+/* vi: set ts=4:
+ * Call regcomp() and handle errors.
+ *
+ * Copyright 2007 Rob Landley <rob@landley.net>
+ *
+ * This is a separate file so environments that haven't got regular expression
+ * support can configure this out and avoid a build break.
+ */
+
+#include "toys.h"
+#include "xregcomp.h"
+
+void xregcomp(regex_t *preg, char *rexec, int cflags)
+{
+ int rc = regcomp(preg, rexec, cflags);
+
+ if (rc) {
+ char msg[256];
+ regerror(rc, preg, msg, 255);
+ msg[255]=0;
+ error_exit("xregcomp: %s", msg);
+ }
+}