]> mj.ucw.cz Git - libucw.git/blobdiff - lib/regex.c
Better explanation.
[libucw.git] / lib / regex.c
index b74fb6a290f5abdfe6b0fa5b3f70aec4942056f5..a80ed74185f68b8c5cef60b174a5dbff2574f06e 100644 (file)
@@ -16,7 +16,7 @@
 #include <string.h>
 #include <stdlib.h>
 
-#if 1
+#if !defined(CONFIG_PCRE) && !defined(CONFIG_POSIX_RE)
 
 /* BSD regular expression library */
 
@@ -117,7 +117,7 @@ rx_subst(regex *r, byte *by, byte *src, byte *dest, uns destlen)
   return 1;
 }
 
-#elif 0
+#elif defined(CONFIG_POSIX_RE)
 
 /* POSIX regular expression library */
 
@@ -312,9 +312,16 @@ rx_subst(regex *r, byte *by, byte *src, byte *dest, uns destlen)
 int main(int argc, char **argv)
 {
   regex *r;
-  byte buf1[256], buf2[256];
+  byte buf1[4096], buf2[4096];
+  int opt_i = 0;
 
-  r = rx_compile(argv[1], 0);
+  if (!strcmp(argv[1], "-i"))
+    {
+      opt_i = 1;
+      argv++;
+      argc--;
+    }
+  r = rx_compile(argv[1], opt_i);
   while (fgets(buf1, sizeof(buf1), stdin))
     {
       char *p = strchr(buf1, '\n');