summaryrefslogtreecommitdiff
path: root/lib/libcompat/regexp/regerror.c
diff options
context:
space:
mode:
authorJason Downs <downsj@cvs.openbsd.org>1999-08-02 17:10:48 +0000
committerJason Downs <downsj@cvs.openbsd.org>1999-08-02 17:10:48 +0000
commit903d8d7a4265eb1a319e39ac2ab1bd4f0ebedd8a (patch)
treefc7dc50ddf5a6436899ea766f712bc838d40f322 /lib/libcompat/regexp/regerror.c
parent835096904992fef0e0da9dc303f1f2d4d3f5eef1 (diff)
Add a hook to regexp/regerror.c for overriding the default regerror()
function. Add support for overriding the default regerror() function in 4.3/regex.c, and avoiding free()ing things multiple times.
Diffstat (limited to 'lib/libcompat/regexp/regerror.c')
-rw-r--r--lib/libcompat/regexp/regerror.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/libcompat/regexp/regerror.c b/lib/libcompat/regexp/regerror.c
index 1063b9722d2..c1b96806d47 100644
--- a/lib/libcompat/regexp/regerror.c
+++ b/lib/libcompat/regexp/regerror.c
@@ -1,15 +1,27 @@
-/* $OpenBSD: regerror.c,v 1.2 1996/07/24 05:39:11 downsj Exp $ */
+/* $OpenBSD: regerror.c,v 1.3 1999/08/02 17:10:47 downsj Exp $ */
#ifndef lint
-static char *rcsid = "$OpenBSD: regerror.c,v 1.2 1996/07/24 05:39:11 downsj Exp $";
+static char *rcsid = "$OpenBSD: regerror.c,v 1.3 1999/08/02 17:10:47 downsj Exp $";
#endif /* not lint */
#include <regexp.h>
#include <stdio.h>
+static void (*_new_regerror)() = NULL;
+
void
v8_regerror(s)
-const char *s;
+ const char *s;
{
- warnx(s);
+ if (_new_regerror != NULL)
+ _new_regerror(s);
+ else
+ warnx(s);
return;
}
+
+void
+v8_setregerror(f)
+ void (*f)();
+{
+ _new_regerror = f;
+}