retest.c
上传用户:blenddy
上传日期:2007-01-07
资源大小:6495k
文件大小:1k
- /*
- * a simple regexp debug program
- *
- * $Header: /usr/local/cvsroot/pgsql/src/backend/regex/retest.c,v 1.2 1999/05/25 16:10:45 momjian 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 = ' ';
- sts = pg95_regcomp(&re, buf, 1);
- printf("regcomp: parses "%s" and returns %dn", buf, sts);
- for (;;)
- {
- printf("type in target string: ");
- if (!fgets(buf, sizeof(buf), stdin))
- exit(0);
- p = strchr(buf, 'n');
- if (p)
- *p = ' ';
- sts = pg95_regexec(&re, buf, 0, 0, 0);
- printf("regexec: returns %dn", sts);
- }
- }
- void
- elog(int lev, const char *fmt,...)
- {
- }