diff options
author | Tatsuo Ishii <ishii@postgresql.org> | 1999-05-21 06:27:54 +0000 |
---|---|---|
committer | Tatsuo Ishii <ishii@postgresql.org> | 1999-05-21 06:27:54 +0000 |
commit | 08bcc77a5cd3ba876662728c0b783fdfee532f62 (patch) | |
tree | 14ca01ff761cdbb05c31fe3b0f81e230254f610e /src/backend/regex/retest.c | |
parent | 56b9a549c7c9d61044010e12303353aeeb5cecd9 (diff) | |
download | postgresql-08bcc77a5cd3ba876662728c0b783fdfee532f62.tar.gz postgresql-08bcc77a5cd3ba876662728c0b783fdfee532f62.zip |
add retest, a regex testing program
Diffstat (limited to 'src/backend/regex/retest.c')
-rw-r--r-- | src/backend/regex/retest.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/backend/regex/retest.c b/src/backend/regex/retest.c new file mode 100644 index 00000000000..13dd0761f02 --- /dev/null +++ b/src/backend/regex/retest.c @@ -0,0 +1,42 @@ +/* + * a simple regexp debug program + * + * $Header: /cvsroot/pgsql/src/backend/regex/Attic/retest.c,v 1.1 1999/05/21 06:27:54 ishii Exp $ + */ + +#include <stdio.h> +#include <string.h> +#include "postgres.h" +#include <regex/regex.h> + +int main() +{ + int sts; + regex_t re; + char buf[1024]; + char *p; + + printf("type in regexp string: "); + if (!fgets(buf,sizeof(buf),stdin)) { + exit(0); + } + p = strchr(buf, '\n'); + if (p) *p = '\0'; + + sts = pg95_regcomp(&re, buf, 1); + printf("regcomp: parses \"%s\" and returns %d\n",buf, sts); + for (;;) { + printf("type in target string: "); + if (!fgets(buf,sizeof(buf),stdin)) { + exit(0); + } + p = strchr(buf, '\n'); + if (p) *p = '\0'; + + sts = pg95_regexec(&re, buf, 0, 0, 0); + printf("regexec: returns %d\n", sts); + } +} + +void elog(int lev, const char *fmt,...) +{} |