diff lib/xregcomp.c @ 114:ce6956dfc0cf

Add sync and an incomplete version of mdev.
author Rob Landley <rob@landley.net>
date Mon, 23 Apr 2007 15:45:55 -0400
parents
children 86e2bdb2ad66
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/xregcomp.c	Mon Apr 23 15:45:55 2007 -0400
@@ -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);
+	}
+}