diff -ru fortune.orig/files/patch-fortune-Makefile fortune/files/patch-fortune-Makefile
old
|
new
|
|
5 | 5 | |
6 | 6 | PROG= fortune |
7 | 7 | -MAN= fortune.6 |
| 8 | -CFLAGS+=-DDEBUG -Wall -I${.CURDIR}/../strfile |
8 | 9 | +MAN6= fortune.6 |
9 | | CFLAGS+=-DDEBUG -Wall -I${.CURDIR}/../strfile |
| 10 | +CFLAGS+=-DDEBUG -DREGCOMP -Wall -I${.CURDIR}/../strfile |
10 | 11 | DPADD= ${LIBCOMPAT} |
11 | 12 | -LDADD= -lcompat |
12 | 13 | +LDADD= -LXXPREFIX/lib -lcompat |
diff -ru fortune.orig/files/patch-fortune.c fortune/files/patch-fortune.c
old
|
new
|
|
1 | | --- fortune/fortune.c.orig Tue Oct 8 17:16:06 2002 |
2 | | +++ fortune/fortune.c Tue Oct 8 17:16:21 2002 |
3 | | @@ -204,7 +204,7 @@ |
| 1 | --- fortune/fortune.c.orig 2001-07-02 02:35:27.000000000 +0200 |
| 2 | +++ fortune/fortune.c 2007-09-15 12:21:05.000000000 +0200 |
| 3 | @@ -169,6 +169,14 @@ |
| 4 | #endif |
| 5 | |
| 6 | #ifndef NO_REGEX |
| 7 | +#ifdef REGCOMP |
| 8 | +#include <regex.h> |
| 9 | +# define RE_COMP(p) (regcomp(&Re_pat, (p), REG_EXTENDED)) |
| 10 | +# define BAD_COMP(f) ((f) != NULL) |
| 11 | +# define RE_EXEC(p) (!regexec(&Re_pat, (p), NULL, NULL, NULL)) |
| 12 | + |
| 13 | +regex_t Re_pat; |
| 14 | +#else |
| 15 | #ifdef REGCMP |
| 16 | # define RE_COMP(p) (Re_pat = regcmp(p, NULL)) |
| 17 | # define BAD_COMP(f) ((f) == NULL) |
| 18 | @@ -184,6 +192,7 @@ |
| 19 | |
| 20 | #endif |
| 21 | #endif |
| 22 | +#endif |
| 23 | |
| 24 | int |
| 25 | main(ac, av) |
| 26 | @@ -204,7 +213,7 @@ |
4 | 27 | #endif |
5 | 28 | |
6 | 29 | init_prob(); |
… |
… |
|
9 | 32 | do { |
10 | 33 | get_fort(); |
11 | 34 | } while ((Short_only && fortlen() > SLEN) || |
| 35 | @@ -388,11 +397,15 @@ |
| 36 | if (ignore_case) |
| 37 | pat = conv_pat(pat); |
| 38 | if (BAD_COMP(RE_COMP(pat))) { |
| 39 | +#ifdef REGCOMP |
| 40 | + fprintf(stderr, "bad pattern: %s\n", pat); |
| 41 | +#else |
| 42 | #ifndef REGCMP |
| 43 | fprintf(stderr, "%s\n", pat); |
| 44 | #else /* REGCMP */ |
| 45 | fprintf(stderr, "bad pattern: %s\n", pat); |
| 46 | #endif /* REGCMP */ |
| 47 | +#endif /* REGCOMP */ |
| 48 | } |
| 49 | } |
| 50 | # endif /* NO_REGEX */ |