Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit08bcc77

Browse files
committed
add retest, a regex testing program
1 parent56b9a54 commit08bcc77

File tree

2 files changed

+51
-2
lines changed

2 files changed

+51
-2
lines changed

‎src/backend/regex/Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Makefile for regex
55
#
66
# IDENTIFICATION
7-
# $Header: /cvsroot/pgsql/src/backend/regex/Makefile,v 1.8 1998/07/26 04:30:34 scrappy Exp $
7+
# $Header: /cvsroot/pgsql/src/backend/regex/Makefile,v 1.9 1999/05/21 06:27:54 ishii Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -14,21 +14,28 @@ include ../../Makefile.global
1414
CFLAGS += -I..
1515
CFLAGS += -DPOSIX_MISTAKE
1616

17+
DEBUGOBJ =
18+
1719
OBJS = regcomp.o regerror.o regexec.o regfree.o
20+
1821
ifdefMULTIBYTE
1922
CFLAGS+=$(MBFLAGS)
23+
DEBUGOBJ += ../utils/mb/SUBSYS.o
2024
endif
2125

2226
all: SUBSYS.o
2327

2428
SUBSYS.o:$(OBJS)
2529
$(LD) -r -o SUBSYS.o$(OBJS)
2630

31+
retest: retest.o SUBSYS.o$(DEBUGOBJ)
32+
$(CC) -o retest retest.o SUBSYS.o$(DEBUGOBJ)
33+
2734
dependdep:
2835
$(CC) -MM$(CFLAGS)*.c>depend
2936

3037
clean:
31-
rm -f SUBSYS.o$(OBJS)
38+
rm -f SUBSYS.o$(OBJS)retest retest.o
3239

3340
ifeq (depend,$(wildcard depend))
3441
include depend

‎src/backend/regex/retest.c

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* a simple regexp debug program
3+
*
4+
* $Header: /cvsroot/pgsql/src/backend/regex/Attic/retest.c,v 1.1 1999/05/21 06:27:54 ishii Exp $
5+
*/
6+
7+
#include<stdio.h>
8+
#include<string.h>
9+
#include"postgres.h"
10+
#include<regex/regex.h>
11+
12+
intmain()
13+
{
14+
intsts;
15+
regex_tre;
16+
charbuf[1024];
17+
char*p;
18+
19+
printf("type in regexp string: ");
20+
if (!fgets(buf,sizeof(buf),stdin)) {
21+
exit(0);
22+
}
23+
p=strchr(buf,'\n');
24+
if (p)*p='\0';
25+
26+
sts=pg95_regcomp(&re,buf,1);
27+
printf("regcomp: parses \"%s\" and returns %d\n",buf,sts);
28+
for (;;) {
29+
printf("type in target string: ");
30+
if (!fgets(buf,sizeof(buf),stdin)) {
31+
exit(0);
32+
}
33+
p=strchr(buf,'\n');
34+
if (p)*p='\0';
35+
36+
sts=pg95_regexec(&re,buf,0,0,0);
37+
printf("regexec: returns %d\n",sts);
38+
}
39+
}
40+
41+
voidelog(intlev,constchar*fmt,...)
42+
{}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp