mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-06 08:27:08 +02:00
43 lines
833 B
C
43 lines
833 B
C
|
/*
|
||
|
* 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,...)
|
||
|
{}
|