summaryrefslogtreecommitdiff
path: root/src/sysdeps/tryemptyregex.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2019-05-11 06:22:36 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2019-05-11 06:22:36 +0000
commit92e40f4f3b8e153b86093996d2a6d2a1160e105d (patch)
tree59c223865b9bce061ddf32f3fcd0f31df6911ace /src/sysdeps/tryemptyregex.c
parentab0416faed65154c408e4fb5066cd8433a4bfa11 (diff)
downloadskalibs-92e40f4f3b8e153b86093996d2a6d2a1160e105d.tar.xz
Add tryemptyregex/skalibs_regcomp, prepare for 2.8.1.0
Diffstat (limited to 'src/sysdeps/tryemptyregex.c')
-rw-r--r--src/sysdeps/tryemptyregex.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/sysdeps/tryemptyregex.c b/src/sysdeps/tryemptyregex.c
new file mode 100644
index 0000000..a2243f7
--- /dev/null
+++ b/src/sysdeps/tryemptyregex.c
@@ -0,0 +1,16 @@
+/* ISC license. */
+
+#include <regex.h>
+
+int main (void)
+{
+ regex_t re ;
+ int r = regcomp(&re, "", REG_EXTENDED | REG_NOSUB) ;
+ switch (r)
+ {
+ case 0 : break ;
+ case REG_ESPACE : return 111 ;
+ default : return 1 ;
+ }
+ return !!regexec(&re, "a", 0, 0, 0) ;
+}