1999-05-21 08:27:54 +02:00
|
|
|
/*
|
|
|
|
* a simple regexp debug program
|
1999-05-25 18:15:34 +02:00
|
|
|
*
|
1999-07-17 22:18:55 +02:00
|
|
|
* $Header: /cvsroot/pgsql/src/backend/regex/Attic/retest.c,v 1.4 1999/07/17 20:17:34 momjian Exp $
|
1999-05-21 08:27:54 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "postgres.h"
|
1999-07-16 01:04:24 +02:00
|
|
|
#include "regex/regex.h"
|
1999-05-21 08:27:54 +02:00
|
|
|
|
1999-05-25 18:15:34 +02:00
|
|
|
int
|
|
|
|
main()
|
1999-05-21 08:27:54 +02:00
|
|
|
{
|
1999-05-25 18:15:34 +02:00
|
|
|
int sts;
|
|
|
|
regex_t re;
|
|
|
|
char buf[1024];
|
|
|
|
char *p;
|
1999-05-21 08:27:54 +02:00
|
|
|
|
1999-05-25 18:15:34 +02:00
|
|
|
printf("type in regexp string: ");
|
|
|
|
if (!fgets(buf, sizeof(buf), stdin))
|
|
|
|
exit(0);
|
|
|
|
p = strchr(buf, '\n');
|
|
|
|
if (p)
|
|
|
|
*p = '\0';
|
1999-05-21 08:27:54 +02:00
|
|
|
|
1999-05-25 18:15:34 +02:00
|
|
|
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';
|
1999-05-21 08:27:54 +02:00
|
|
|
|
1999-05-25 18:15:34 +02:00
|
|
|
sts = pg95_regexec(&re, buf, 0, 0, 0);
|
|
|
|
printf("regexec: returns %d\n", sts);
|
|
|
|
}
|
1999-05-21 08:27:54 +02:00
|
|
|
}
|
|
|
|
|
1999-05-25 18:15:34 +02:00
|
|
|
void
|
|
|
|
elog(int lev, const char *fmt,...)
|
|
|
|
{
|
|
|
|
}
|