add retest, a regex testing program
This commit is contained in:
parent
56b9a549c7
commit
08bcc77a5c
@ -4,7 +4,7 @@
|
|||||||
# Makefile for regex
|
# Makefile for regex
|
||||||
#
|
#
|
||||||
# IDENTIFICATION
|
# IDENTIFICATION
|
||||||
# $Header: /cvsroot/pgsql/src/backend/regex/Makefile,v 1.8 1998/07/26 04:30:34 scrappy Exp $
|
# $Header: /cvsroot/pgsql/src/backend/regex/Makefile,v 1.9 1999/05/21 06:27:54 ishii Exp $
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -14,9 +14,13 @@ include ../../Makefile.global
|
|||||||
CFLAGS += -I..
|
CFLAGS += -I..
|
||||||
CFLAGS += -DPOSIX_MISTAKE
|
CFLAGS += -DPOSIX_MISTAKE
|
||||||
|
|
||||||
|
DEBUGOBJ =
|
||||||
|
|
||||||
OBJS = regcomp.o regerror.o regexec.o regfree.o
|
OBJS = regcomp.o regerror.o regexec.o regfree.o
|
||||||
|
|
||||||
ifdef MULTIBYTE
|
ifdef MULTIBYTE
|
||||||
CFLAGS+= $(MBFLAGS)
|
CFLAGS+= $(MBFLAGS)
|
||||||
|
DEBUGOBJ += ../utils/mb/SUBSYS.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
all: SUBSYS.o
|
all: SUBSYS.o
|
||||||
@ -24,11 +28,14 @@ all: SUBSYS.o
|
|||||||
SUBSYS.o: $(OBJS)
|
SUBSYS.o: $(OBJS)
|
||||||
$(LD) -r -o SUBSYS.o $(OBJS)
|
$(LD) -r -o SUBSYS.o $(OBJS)
|
||||||
|
|
||||||
|
retest: retest.o SUBSYS.o $(DEBUGOBJ)
|
||||||
|
$(CC) -o retest retest.o SUBSYS.o $(DEBUGOBJ)
|
||||||
|
|
||||||
depend dep:
|
depend dep:
|
||||||
$(CC) -MM $(CFLAGS) *.c >depend
|
$(CC) -MM $(CFLAGS) *.c >depend
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f SUBSYS.o $(OBJS)
|
rm -f SUBSYS.o $(OBJS) retest retest.o
|
||||||
|
|
||||||
ifeq (depend,$(wildcard depend))
|
ifeq (depend,$(wildcard depend))
|
||||||
include depend
|
include depend
|
||||||
|
42
src/backend/regex/retest.c
Normal file
42
src/backend/regex/retest.c
Normal file
@ -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,...)
|
||||||
|
{}
|
Loading…
x
Reference in New Issue
Block a user