1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-28 05:29:48 +00:00

textproc/sgmlformat: fix broken regexp -> regex conversion

- Maintainer's timeout (kuriyama@FreeBSD.org)

PR:		184632
Submitted by:	Christian Weisgerber <naddy@FreeBSD.org>
This commit is contained in:
Bartek Rutkowski 2015-03-14 10:27:54 +00:00
parent 4a98411960
commit 939b26e8f5
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=381256
2 changed files with 90 additions and 129 deletions

View File

@ -3,7 +3,7 @@
PORTNAME= sgmlformat PORTNAME= sgmlformat
PORTVERSION= 1.7 PORTVERSION= 1.7
PORTREVISION= 5 PORTREVISION= 6
CATEGORIES= textproc print CATEGORIES= textproc print
MASTER_SITES= ${MASTER_SITE_LOCAL} MASTER_SITES= ${MASTER_SITE_LOCAL}
MASTER_SITE_SUBDIR= kuriyama MASTER_SITE_SUBDIR= kuriyama

View File

@ -1,5 +1,5 @@
--- instant/tables.c --- instant/tables.c.orig 1996-09-08 03:55:10.000000000 +0200
+++ instant/tables.c +++ instant/tables.c 2013-11-30 23:51:25.000000000 +0100
@@ -84,7 +84,7 @@ @@ -84,7 +84,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <errno.h> #include <errno.h>
@ -9,42 +9,8 @@
#include "general.h" #include "general.h"
#include "translate.h" #include "translate.h"
--- instant/translate.h --- instant/traninit.c.orig 1997-07-16 18:44:12.000000000 +0200
+++ instant/translate.h +++ instant/traninit.c 2013-11-30 23:51:25.000000000 +0100
@@ -75,7 +75,7 @@
typedef struct {
char *name; /* attribute name string */
char *val; /* attribute value string */
- regexp *rex; /* attribute value reg expr (compiled) */
+ regex_t rex; /* attribute value reg expr (compiled) */
} AttPair_t;
typedef struct _Trans {
@@ -83,19 +83,19 @@
char *gi; /* element name of tag under consideration */
char **gilist; /* list of element names (multiple gi's) */
char *context; /* context in tree - looking depth levels up */
- regexp *context_re; /* tree heirarchy looking depth levels up */
+ regex_t context_re; /* tree heirarchy looking depth levels up */
int depth; /* number of levels to look up the tree */
AttPair_t *attpair; /* attr name-value pairs */
int nattpairs; /* number of name-value pairs */
char *parent; /* GI has this element as parent */
int nth_child; /* GI is Nth child of this of parent element */
char *content; /* element has this string in content */
- regexp *content_re; /* content reg expr (compiled) */
+ regex_t content_re; /* content reg expr (compiled) */
char *pattrset; /* is this attr set (any value) in parent? */
char *var_name; /* variable name */
char *var_value; /* variable value */
char *var_RE_name; /* variable name (for VarREValue) */
- regexp *var_RE_value; /* variable value (compiled, for VarREValue) */
+ regex_t var_RE_value; /* variable value (compiled, for VarREValue) */
Map_t *relations; /* various relations to check */
/* actions */
--- instant/traninit.c
+++ instant/traninit.c
@@ -69,7 +69,7 @@ @@ -69,7 +69,7 @@
#include <memory.h> #include <memory.h>
#include <sys/types.h> #include <sys/types.h>
@ -54,47 +20,32 @@
#include "general.h" #include "general.h"
#include "translate.h" #include "translate.h"
@@ -392,7 +392,7 @@ @@ -100,6 +100,23 @@
tok = Split(cp, &i, S_STRDUP); void AddSDATA(const char *from, const char *to);
T.var_RE_name = tok[0];
ExpandVariables(tok[1], buf, 0);
- if (!(T.var_RE_value=regcomp(buf))) {
+ if (regcomp(&T.var_RE_value, buf, 0) != 0) {
fprintf(stderr, "Regex error in VarREValue Content: %s\n",
tok[1]);
}
@@ -454,7 +454,7 @@
if (do_regex) { /* ______________________________________________________________________ */
t->depth = MAX_DEPTH; +/* minimal compatibility wrapper for UNIX V8 regexp, match only
- if (!(t->context_re=regcomp(t->context))) { + */
+ if (regcomp(&t->context_re, t->context, 0) != 0) { +
fprintf(stderr, "Regex error in Context: %s\n", t->context); +static regex_t *v8_regcomp(const char *pattern)
} +{
} + regex_t *re;
@@ -493,17 +493,17 @@ + if ((re = malloc(sizeof(regex_t))) != NULL) {
else { /* value not found */ + if (regcomp(re, pattern, REG_EXTENDED|REG_NOSUB)) {
t->attpair[i].val = "."; + free(re);
} + return NULL;
- if (!(t->attpair[i].rex=regcomp(t->attpair[i].val))) { + }
+ if (regcomp(&t->attpair[i].rex, t->attpair[i].val, 0) != 0) { + }
fprintf(stderr, "Regex error in AttValue: %s %s\n", + return re;
t->attpair[i].name, t->attpair[i].val); +}
} +#define regcomp v8_regcomp
} +
+/* ______________________________________________________________________ */
/* Compile regular expression for content */ /* Read the translation specs from the input file, storing in memory.
- t->content_re = 0; * Arguments:
+ //t->content_re = 0; * Name of translation spec file.
if (t->content) { --- instant/translate.c.orig 1996-09-08 03:55:10.000000000 +0200
ExpandVariables(t->content, buf, 0); +++ instant/translate.c 2013-11-30 23:51:25.000000000 +0100
- if (!(t->content_re=regcomp(buf)))
+ if (regcomp(&t->content_re, buf, 0) != 0)
fprintf(stderr, "Regex error in Content: %s\n",
t->content);
}
--- instant/translate.c
+++ instant/translate.c
@@ -69,7 +69,7 @@ @@ -69,7 +69,7 @@
#include <memory.h> #include <memory.h>
#include <sys/types.h> #include <sys/types.h>
@ -104,46 +55,66 @@
#include "general.h" #include "general.h"
#define STORAGE #define STORAGE
@@ -418,9 +418,9 @@ @@ -82,6 +82,18 @@
FindContext(e, t->depth, context); static void WasProcessed(Element_t *);
/* If reg expr set, do regex compare; else just string compare. */ /* ______________________________________________________________________ */
- if (t->context_re) { +/* minimal compatibility wrapper for UNIX V8 regexp, match only
- if (! regexec(t->context_re, context)) continue; + */
- } +
+ //if (t->context_re) { +static int v8_regexec(const regex_t *re, const char *string)
+ if (! regexec(&t->context_re, context, 0, NULL, 0)) continue; +{
+ //} + if (re == NULL)
else { + return 0;
/* Is depth of spec deeper than element's depth? */ + return !regexec(re, string, 0, NULL, 0);
if (t->depth > e->depth) continue; +}
@@ -439,7 +439,7 @@ +#define regexec v8_regexec
match = 0; +
break; +/* ______________________________________________________________________ */
} /* Translate the subtree starting at 'e'. Output goes to 'fp'.
- if (!regexec(t->attpair[a].rex, atval)) match = 0; * This is the entry point for translating an instance.
+ if (!regexec(&t->attpair[a].rex, atval, 0, NULL, 0)) match = 0; * Arguments:
} --- instant/translate.h.orig 1996-09-08 03:55:10.000000000 +0200
if (!match) continue; +++ instant/translate.h 2013-11-30 23:51:25.000000000 +0100
} @@ -75,7 +75,7 @@
@@ -499,13 +499,13 @@ typedef struct {
/* check for variable regular expression match */ char *name; /* attribute name string */
if ( t->var_RE_name ) { char *val; /* attribute value string */
cp = FindMappingVal(Variables, t->var_RE_name); - regexp *rex; /* attribute value reg expr (compiled) */
- if (!cp || !regexec(t->var_RE_value, cp)) continue; + regex_t *rex; /* attribute value reg expr (compiled) */
+ if (!cp || !regexec(&t->var_RE_value, cp, 0, NULL, 0)) continue; } AttPair_t;
}
/* check content */ typedef struct _Trans {
if (t->content) { /* no att specified -> a match */ @@ -83,19 +83,19 @@
for (match=0,i=0; i<e->ndcont; i++) { char *gi; /* element name of tag under consideration */
- if (regexec(t->content_re, e->dcont[i])) { char **gilist; /* list of element names (multiple gi's) */
+ if (regexec(&t->content_re, e->dcont[i], 0, NULL, 0)) { char *context; /* context in tree - looking depth levels up */
match = 1; - regexp *context_re; /* tree heirarchy looking depth levels up */
break; + regex_t *context_re; /* tree heirarchy looking depth levels up */
} int depth; /* number of levels to look up the tree */
--- instant/tranvar.c AttPair_t *attpair; /* attr name-value pairs */
+++ instant/tranvar.c int nattpairs; /* number of name-value pairs */
char *parent; /* GI has this element as parent */
int nth_child; /* GI is Nth child of this of parent element */
char *content; /* element has this string in content */
- regexp *content_re; /* content reg expr (compiled) */
+ regex_t *content_re; /* content reg expr (compiled) */
char *pattrset; /* is this attr set (any value) in parent? */
char *var_name; /* variable name */
char *var_value; /* variable value */
char *var_RE_name; /* variable name (for VarREValue) */
- regexp *var_RE_value; /* variable value (compiled, for VarREValue) */
+ regex_t *var_RE_value; /* variable value (compiled, for VarREValue) */
Map_t *relations; /* various relations to check */
/* actions */
@@ -150,4 +150,3 @@
void OSFtable(Element_t *, FILE *, char **, int);
/* ______________________________________________________________________ */
-
--- instant/tranvar.c.orig 1997-02-07 03:40:45.000000000 +0100
+++ instant/tranvar.c 2013-11-30 23:51:25.000000000 +0100
@@ -66,7 +66,7 @@ @@ -66,7 +66,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <errno.h> #include <errno.h>
@ -153,8 +124,8 @@
#include "general.h" #include "general.h"
#include "translate.h" #include "translate.h"
--- instant/util.c --- instant/util.c.orig 1996-09-08 03:55:10.000000000 +0200
+++ instant/util.c +++ instant/util.c 2013-11-30 23:51:25.000000000 +0100
@@ -85,7 +85,7 @@ @@ -85,7 +85,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/file.h> #include <sys/file.h>
@ -164,13 +135,3 @@
/* CSS don't have it and I don't see where it's used /* CSS don't have it and I don't see where it's used
#include <values.h> #include <values.h>
*/ */
--- instant/Makefile
+++ instant/Makefile
@@ -6,7 +6,6 @@
SRCS+= sgmls.c
CFLAGS+=-DTRANSPEC_DIR=\"${TRANSPEC_DIR}\"
-LDADD= -lcompat
MAN1= instant.1
MAN5= transpec.5