home *** CD-ROM | disk | FTP | other *** search
- diff -cbBw orig/dfa.c grep/dfa.c
- *** orig/dfa.c Mon May 07 09:08:54 1990
- --- grep/dfa.c Sun Jan 19 18:42:02 1992
- ***************
- *** 109,114 ****
- --- 109,115 ----
- #include <assert.h>
- #include <ctype.h>
- #include "dfa.h"
- + #include "regex.h"
-
- #ifdef __STDC__
- typedef void *ptr_t;
- diff -cbBw orig/dfa.h grep/dfa.h
- *** orig/dfa.h Mon May 07 09:08:54 1990
- --- grep/dfa.h Sun Jan 19 18:40:38 1992
- ***************
- *** 115,126 ****
- #ifdef __STDC__
-
- /* Missing include files for GNU C. */
- ! /* #include <stdlib.h> */
- typedef int size_t;
- extern void *calloc(int, size_t);
- extern void *malloc(size_t);
- extern void *realloc(void *, size_t);
- extern void free(void *);
-
- extern char *bcopy(), *bzero();
-
- --- 115,129 ----
- #ifdef __STDC__
-
- /* Missing include files for GNU C. */
- ! #ifdef OS2
- ! #include <stdlib.h>
- ! #else
- typedef int size_t;
- extern void *calloc(int, size_t);
- extern void *malloc(size_t);
- extern void *realloc(void *, size_t);
- extern void free(void *);
- + #endif
-
- extern char *bcopy(), *bzero();
-
- ***************
- *** 149,154 ****
- --- 152,159 ----
-
- #endif /* ! __STDC__ */
-
- + #if 0 /* This is really defined in regex.h */
- +
- /* 1 means plain parentheses serve as grouping, and backslash
- parentheses are needed for literal searching.
- 0 means backslash-parentheses are grouping, and plain parentheses
- ***************
- *** 186,193 ****
- --- 191,202 ----
- #define RE_SYNTAX_GREP (RE_BK_PLUS_QM | RE_NEWLINE_OR)
- #define RE_SYNTAX_EMACS 0
-
- + #endif
- +
- /* The NULL pointer. */
- + #ifndef OS2
- #define NULL 0
- + #endif
-
- /* Number of bits in an unsigned char. */
- #define CHARBITS 8
- diff -cbBw orig/grep.c grep/grep.c
- *** orig/grep.c Mon May 07 09:08:54 1990
- --- grep/grep.c Sun Jan 19 18:40:38 1992
- ***************
- *** 127,134 ****
- --- 127,136 ----
-
- extern char *optarg;
- extern optind, opterr;
- + #ifndef OS2
- extern errno;
- extern char *sys_errlist[];
- + #endif
-
- #define MAX(a, b) ((a) > (b) ? (a) : (b))
-
- ***************
- *** 373,378 ****
- --- 375,382 ----
- next_line - matching_line - 1,
- NULL) < 0)
- {
- + --match_count; /* debugged by kaoru. August 15, 1990. */
- + ++line_count; /* debugged by kaoru. August 15, 1990. */
- resume = next_line;
- if (resume == search_limit)
- break;
- ***************
- *** 533,549 ****
- return nonmatching_lines ? (line_count - 1) - match_count : match_count;
- }
-
- void
- usage_and_die()
- {
- ! fprintf(stderr,
- ! "usage: %s [-CVbchilnsvwx] [-<num>] [-AB <num>] [-f file] [-e] expr [files]\n",
- ! prog);
- exit(ERROR);
- }
-
- - static char version[] = "GNU e?grep, version 1.5";
- -
- main(argc, argv)
- int argc;
- char **argv;
- --- 537,581 ----
- return nonmatching_lines ? (line_count - 1) - match_count : match_count;
- }
-
- +
- + #ifdef EGREP
- + static char version[] = "GNU egrep, version 1.5";
- + #else
- + static char version[] = "GNU grep, version 1.5";
- + #endif
- +
- void
- usage_and_die()
- {
- ! printf("\n%s\n", version);
- ! printf("\nUsage: %s [-CVbchilnsvwx] [-<num>] [-AB <num>]"
- ! " [-f file] [-e] expr [files]\n\n", prog);
- ! printf(
- ! " -A <num> print <num> lines of context after every matching line\n"
- ! " -B <num> print <num> lines of context before every matching line\n"
- ! " -C print 2 lines of context on each side of every match\n"
- ! " -<num> print <num> lines of context on each side\n"
- ! " -V print the version number on stderr\n"
- ! );
- ! printf(
- ! " -b print every match preceded by its byte offset\n"
- ! " -c print a total count of matching lines only\n"
- ! " -e <expr> search for <expr>; useful if <expr> begins with -\n"
- ! " -f <file> take <expr> from the given <file>\n"
- ! " -h don't display filenames on matches\n"
- ! " -i ignore case difference when comparing strings\n"
- ! );
- ! printf(
- ! " -l list files containing matches only\n"
- ! " -n print each match preceded by its line number\n"
- ! " -s run silently producing no output except error messages\n"
- ! " -v print only lines that contain no matches for the <expr>\n"
- ! " -w print only lines where the match is a complete word\n"
- ! " -x print only lines where the match is a whole line\n");
- !
- exit(ERROR);
- }
-
- main(argc, argv)
- int argc;
- char **argv;
- ***************
- *** 607,613 ****
- break;
-
- case 'V':
- ! fprintf(stderr, "%s\n", version);
- break;
-
- case 'b':
- --- 639,646 ----
- break;
-
- case 'V':
- ! fprintf(stderr, "\n%s\n", version);
- ! exit(ERROR);
- break;
-
- case 'b':
- diff -cbBw orig/regex.c grep/regex.c
- *** orig/regex.c Mon May 07 09:08:56 1990
- --- grep/regex.c Sun Jan 19 14:30:04 1992
- ***************
- *** 20,25 ****
- --- 20,26 ----
- You are forbidden to forbid anyone else to use, share and improve
- what you give them. Help stamp out software-hoarding! */
-
- + #define USG
-
- /* To test, compile with -Dtest.
- This Dtestable feature turns this into a self-contained program
- ***************
- *** 39,48 ****
- --- 40,51 ----
- #else /* not emacs */
-
- #ifdef USG
- + #ifndef BSTRING
- #define bcopy(s,d,n) memcpy((d),(s),(n))
- #define bcmp(s1,s2,n) memcmp((s1),(s2),(n))
- #define bzero(s,n) memset((s),0,(n))
- #endif
- + #endif
-
- /* Make alloca work the best possible way. */
- #ifdef __GNUC__
- ***************
- *** 53,58 ****
- --- 56,68 ----
- #endif
- #endif
-
- + #ifdef OS2
- + #include <stdlib.h>
- + #include <string.h>
- + #include <memory.h>
- + #include <malloc.h>
- + #endif
- +
- /*
- * Define the syntax stuff, so we can do the \<...\> things.
- */
- ***************
- *** 72,78 ****
- static char re_syntax_table[256];
-
- static void
- ! init_syntax_once ()
- {
- register int c;
- static int done = 0;
- --- 82,88 ----
- static char re_syntax_table[256];
-
- static void
- ! init_syntax_once (void)
- {
- register int c;
- static int done = 0;
- ***************
- *** 91,96 ****
- --- 101,108 ----
- for (c = '0'; c <= '9'; c++)
- re_syntax_table[c] = Sword;
-
- + re_syntax_table['_'] = Sword;
- +
- done = 1;
- }
-
- ***************
- *** 112,120 ****
- #define BYTEWIDTH 8
-
- #ifndef SIGN_EXTEND_CHAR
- ! #define SIGN_EXTEND_CHAR(x) (x)
- #endif
- !
- static int obscure_syntax = 0;
-
- /* Specify the precise syntax of regexp for compilation.
- --- 124,132 ----
- #define BYTEWIDTH 8
-
- #ifndef SIGN_EXTEND_CHAR
- ! #define SIGN_EXTEND_CHAR(x) ((int) (signed char) x)
- #endif
- !
- static int obscure_syntax = 0;
-
- /* Specify the precise syntax of regexp for compilation.
- ***************
- *** 125,131 ****
- RE_NO_BK_PARENS and RE_NO_BK_VBAR. */
-
- int
- ! re_set_syntax (syntax)
- {
- int ret;
-
- --- 137,143 ----
- RE_NO_BK_PARENS and RE_NO_BK_VBAR. */
-
- int
- ! re_set_syntax (int syntax)
- {
- int ret;
-
- ***************
- *** 133,139 ****
- obscure_syntax = syntax;
- return ret;
- }
- !
- /* re_compile_pattern takes a regular-expression string
- and converts it into a buffer full of byte commands for matching.
-
- --- 145,151 ----
- obscure_syntax = syntax;
- return ret;
- }
- !
- /* re_compile_pattern takes a regular-expression string
- and converts it into a buffer full of byte commands for matching.
-
- ***************
- *** 163,187 ****
-
- #define PATUNFETCH p--
-
- #define EXTEND_BUFFER \
- { char *old_buffer = bufp->buffer; \
- ! if (bufp->allocated == (1<<16)) goto too_big; \
- bufp->allocated *= 2; \
- ! if (bufp->allocated > (1<<16)) bufp->allocated = (1<<16); \
- ! if (!(bufp->buffer = (char *) realloc (bufp->buffer, bufp->allocated))) \
- goto memory_exhausted; \
- ! c = bufp->buffer - old_buffer; \
- ! b += c; \
- if (fixup_jump) \
- ! fixup_jump += c; \
- if (laststart) \
- ! laststart += c; \
- ! begalt += c; \
- if (pending_exact) \
- ! pending_exact += c; \
- }
-
- - static int store_jump (), insert_jump ();
-
- char *
- re_compile_pattern (pattern, size, bufp)
- --- 175,248 ----
-
- #define PATUNFETCH p--
-
- + #ifndef OS2
- + #define EXTEND_BUFFER \
- + { char *old_buffer = bufp->buffer; \
- + if (bufp->allocated == (1L<<16)) goto too_big; \
- + bufp->allocated *= 2; \
- + if (bufp->allocated > (1L<<16)) bufp->allocated = (1L<<16); \
- + bufp->buffer = (char *) realloc (bufp->buffer, bufp->allocated); \
- + if (bufp->buffer == 0) \
- + goto memory_exhausted; \
- + b = (b - old_buffer) + bufp->buffer; \
- + if (fixup_jump) \
- + fixup_jump = (fixup_jump - old_buffer) + bufp->buffer; \
- + if (laststart) \
- + laststart = (laststart - old_buffer) + bufp->buffer; \
- + begalt = (begalt - old_buffer) + bufp->buffer; \
- + if (pending_exact) \
- + pending_exact = (pending_exact - old_buffer) + bufp->buffer; \
- + }
- + #else
- #define EXTEND_BUFFER \
- { char *old_buffer = bufp->buffer; \
- ! if (bufp->allocated == (1L<<15)) goto too_big; \
- bufp->allocated *= 2; \
- ! if (bufp->allocated > (1L<<15)) bufp->allocated = (1L<<15); \
- ! bufp->buffer = (char *) realloc (bufp->buffer, bufp->allocated); \
- ! if (bufp->buffer == 0) \
- goto memory_exhausted; \
- ! b = (b - old_buffer) + bufp->buffer; \
- if (fixup_jump) \
- ! fixup_jump = (fixup_jump - old_buffer) + bufp->buffer; \
- if (laststart) \
- ! laststart = (laststart - old_buffer) + bufp->buffer; \
- ! begalt = (begalt - old_buffer) + bufp->buffer; \
- if (pending_exact) \
- ! pending_exact = (pending_exact - old_buffer) + bufp->buffer; \
- ! }
- ! #endif
- !
- ! /* Store where `from' points a jump operation to jump to where `to' points.
- ! `opcode' is the opcode to store. */
- !
- ! static void
- ! store_jump (char *from, char opcode, char *to)
- ! {
- ! from[0] = opcode;
- ! from[1] = (char) ((to - (from + 3)) & 0377);
- ! from[2] = (char) ((to - (from + 3)) >> 8);
- ! }
- !
- ! /* Open up space at char FROM, and insert there a jump to TO.
- ! CURRENT_END gives te end of the storage no in use,
- ! so we know how much data to copy up.
- ! OP is the opcode of the jump to insert.
- !
- ! If you call this function, you must zero out pending_exact. */
- !
- ! static void
- ! insert_jump (char op, char *from, char *to, char *current_end)
- ! {
- ! register char *pto = current_end + 3;
- ! register char *pfrom = current_end;
- !
- ! while (pfrom != from)
- ! *--pto = *--pfrom;
- !
- ! store_jump (from, op, to);
- }
-
-
- char *
- re_compile_pattern (pattern, size, bufp)
- ***************
- *** 254,260 ****
- #endif
- #endif
-
- ! if (bufp->allocated == 0)
- {
- bufp->allocated = 28;
- if (bufp->buffer)
- --- 315,321 ----
- #endif
- #endif
-
- ! if (bufp->allocated < 28)
- {
- bufp->allocated = 28;
- if (bufp->buffer)
- ***************
- *** 420,425 ****
- --- 481,495 ----
- while (1)
- {
- PATFETCH (c);
- +
- + /* If awk, \ escapes characters when inside [...]. */
- + if ((obscure_syntax & RE_AWK_CLASS_HACK) && c == '\\')
- + {
- + PATFETCH(c1);
- + b[c1 / BYTEWIDTH] |= 1 << (c1 % BYTEWIDTH);
- + continue;
- + }
- +
- if (c == ']' && p != p1 + 1) break;
- if (*p == '-' && p[1] != ']')
- {
- ***************
- *** 587,596 ****
- case '8':
- case '9':
- c1 = c - '0';
- ! if (c1 >= regnum)
- goto normal_char;
- for (stackt = stackp - 2; stackt > stackb; stackt -= 4)
- ! if (*stackt == c1)
- goto normal_char;
- laststart = b;
- PATPUSH (duplicate);
- --- 657,666 ----
- case '8':
- case '9':
- c1 = c - '0';
- ! if ((int) c1 >= regnum)
- goto normal_char;
- for (stackt = stackp - 2; stackt > stackb; stackt -= 4)
- ! if (*stackt == (int) c1)
- goto normal_char;
- laststart = b;
- PATPUSH (duplicate);
- ***************
- *** 660,697 ****
- return "Memory exhausted";
- }
-
- - /* Store where `from' points a jump operation to jump to where `to' points.
- - `opcode' is the opcode to store. */
- -
- - static int
- - store_jump (from, opcode, to)
- - char *from, *to;
- - char opcode;
- - {
- - from[0] = opcode;
- - from[1] = (to - (from + 3)) & 0377;
- - from[2] = (to - (from + 3)) >> 8;
- - }
- -
- - /* Open up space at char FROM, and insert there a jump to TO.
- - CURRENT_END gives te end of the storage no in use,
- - so we know how much data to copy up.
- - OP is the opcode of the jump to insert.
- -
- - If you call this function, you must zero out pending_exact. */
- -
- - static int
- - insert_jump (op, from, to, current_end)
- - char op;
- - char *from, *to, *current_end;
- - {
- - register char *pto = current_end + 3;
- - register char *pfrom = current_end;
- - while (pfrom != from)
- - *--pto = *--pfrom;
- - store_jump (from, op, to);
- - }
- -
- /* Given a pattern, compute a fastmap from it.
- The fastmap records which of the (1 << BYTEWIDTH) possible characters
- can start a string that matches the pattern.
- --- 730,735 ----
- ***************
- *** 706,716 ****
- struct re_pattern_buffer *bufp;
- {
- unsigned char *pattern = (unsigned char *) bufp->buffer;
- ! int size = bufp->used;
- register char *fastmap = bufp->fastmap;
- register unsigned char *p = pattern;
- register unsigned char *pend = pattern + size;
- ! register int j, k;
- unsigned char *translate = (unsigned char *) bufp->translate;
-
- unsigned char *stackb[NFAILURES];
- --- 744,757 ----
- struct re_pattern_buffer *bufp;
- {
- unsigned char *pattern = (unsigned char *) bufp->buffer;
- ! int size = (int) bufp->used;
- register char *fastmap = bufp->fastmap;
- register unsigned char *p = pattern;
- register unsigned char *pend = pattern + size;
- ! register int j;
- ! #ifdef emacs
- ! register int k;
- ! #endif
- unsigned char *translate = (unsigned char *) bufp->translate;
-
- unsigned char *stackb[NFAILURES];
- ***************
- *** 879,885 ****
- break;
- }
- }
- !
- /* Like re_search_2, below, but only one string is specified. */
-
- int
- --- 920,926 ----
- break;
- }
- }
- !
- /* Like re_search_2, below, but only one string is specified. */
-
- int
- ***************
- *** 986,996 ****
-
- val = re_match_2 (pbufp, string1, size1, string2, size2, startpos, regs, mstop);
- if (0 <= val)
- ! {
- if (val == -2)
- return -2;
- - return startpos;
- - }
-
- #ifdef C_ALLOCA
- alloca (0);
- --- 1027,1035 ----
-
- val = re_match_2 (pbufp, string1, size1, string2, size2, startpos, regs, mstop);
- if (0 <= val)
- ! return startpos;
- if (val == -2)
- return -2;
-
- #ifdef C_ALLOCA
- alloca (0);
- ***************
- *** 1002,1008 ****
- }
- return -1;
- }
- !
- #ifndef emacs /* emacs never uses this */
- int
- re_match (pbufp, string, size, pos, regs)
- --- 1041,1047 ----
- }
- return -1;
- }
- !
- #ifndef emacs /* emacs never uses this */
- int
- re_match (pbufp, string, size, pos, regs)
- ***************
- *** 1019,1025 ****
-
- int re_max_failures = 2000;
-
- ! static int bcmp_translate();
- /* Match the pattern described by PBUFP
- against data which is the virtual concatenation of STRING1 and STRING2.
- SIZE1 and SIZE2 are the sizes of the two data strings.
- --- 1058,1066 ----
-
- int re_max_failures = 2000;
-
- ! static int bcmp_translate (unsigned char *s1, unsigned char *s2, int len,
- ! unsigned char *translate);
- !
- /* Match the pattern described by PBUFP
- against data which is the virtual concatenation of STRING1 and STRING2.
- SIZE1 and SIZE2 are the sizes of the two data strings.
- ***************
- *** 1037,1045 ****
- of the substring which was matched. */
-
- int
- ! re_match_2 (pbufp, string1, size1, string2, size2, pos, regs, mstop)
- struct re_pattern_buffer *pbufp;
- ! unsigned char *string1, *string2;
- int size1, size2;
- int pos;
- struct re_registers *regs;
- --- 1078,1086 ----
- of the substring which was matched. */
-
- int
- ! re_match_2 (pbufp, string1_arg, size1, string2_arg, size2, pos, regs, mstop)
- struct re_pattern_buffer *pbufp;
- ! char *string1_arg, *string2_arg;
- int size1, size2;
- int pos;
- struct re_registers *regs;
- ***************
- *** 1047,1052 ****
- --- 1088,1095 ----
- {
- register unsigned char *p = (unsigned char *) pbufp->buffer;
- register unsigned char *pend = p + pbufp->used;
- + unsigned char *string1 = (unsigned char *) string1_arg;
- + unsigned char *string2 = (unsigned char *) string2_arg;
- /* End of first string */
- unsigned char *end1;
- /* End of second string */
- ***************
- *** 1191,1202 ****
-
- case start_memory:
- regstart[*p] = d;
- ! regstart_seg1[*p++] = (dend == end_match_1);
- break;
-
- case stop_memory:
- regend[*p] = d;
- ! regend_seg1[*p++] = (dend == end_match_1);
- break;
-
- case duplicate:
- --- 1234,1245 ----
-
- case start_memory:
- regstart[*p] = d;
- ! regstart_seg1[*p++] = (char) (dend == end_match_1);
- break;
-
- case stop_memory:
- regend[*p] = d;
- ! regend_seg1[*p++] = (char) (dend == end_match_1);
- break;
-
- case duplicate:
- ***************
- *** 1341,1347 ****
- register unsigned char *p1 = p + mcnt;
- /* p1[0] ... p1[2] are an on_failure_jump.
- Examine what follows that */
- ! if (p1[3] == (unsigned char) exactn && p1[5] != c)
- p[-3] = (unsigned char) finalize_jump;
- else if (p1[3] == (unsigned char) charset
- || p1[3] == (unsigned char) charset_not)
- --- 1384,1390 ----
- register unsigned char *p1 = p + mcnt;
- /* p1[0] ... p1[2] are an on_failure_jump.
- Examine what follows that */
- ! if (p1[3] == (unsigned char) exactn && p1[5] != (char) c)
- p[-3] = (unsigned char) finalize_jump;
- else if (p1[3] == (unsigned char) charset
- || p1[3] == (unsigned char) charset_not)
- ***************
- *** 1545,1554 ****
- }
-
- static int
- ! bcmp_translate (s1, s2, len, translate)
- ! unsigned char *s1, *s2;
- ! register int len;
- ! unsigned char *translate;
- {
- register unsigned char *p1 = s1, *p2 = s2;
- while (len)
- --- 1588,1594 ----
- }
-
- static int
- ! bcmp_translate (unsigned char *s1, unsigned char *s2, int len, unsigned char *translate)
- {
- register unsigned char *p1 = s1, *p2 = s2;
- while (len)
- ***************
- *** 1558,1564 ****
- }
- return 0;
- }
- !
- /* Entry points compatible with bsd4.2 regex library */
-
- #ifndef emacs
- --- 1598,1604 ----
- }
- return 0;
- }
- !
- /* Entry points compatible with bsd4.2 regex library */
-
- #ifndef emacs
- ***************
- *** 1596,1602 ****
- }
-
- #endif /* emacs */
- !
- #ifdef test
-
- #include <stdio.h>
- --- 1636,1642 ----
- }
-
- #endif /* emacs */
- !
- #ifdef test
-
- #include <stdio.h>
- ***************
- *** 1638,1651 ****
- 0370, 0371, 0372, 0373, 0374, 0375, 0376, 0377
- };
-
- ! main (argc, argv)
- ! int argc;
- ! char **argv;
- {
- char pat[80];
- struct re_pattern_buffer buf;
- int i;
- - char c;
- char fastmap[(1 << BYTEWIDTH)];
-
- /* Allow a command argument to specify the style of syntax. */
- --- 1678,1733 ----
- 0370, 0371, 0372, 0373, 0374, 0375, 0376, 0377
- };
-
- ! #ifdef NOTDEF
- ! print_buf (bufp)
- ! struct re_pattern_buffer *bufp;
- ! {
- ! int i;
- !
- ! printf ("buf is :\n----------------\n");
- ! for (i = 0; i < bufp->used; i++)
- ! printchar (bufp->buffer[i]);
- !
- ! printf ("\n%d allocated, %d used.\n", bufp->allocated, bufp->used);
- !
- ! printf ("Allowed by fastmap: ");
- ! for (i = 0; i < (1 << BYTEWIDTH); i++)
- ! if (bufp->fastmap[i])
- ! printchar (i);
- ! printf ("\nAllowed by translate: ");
- ! if (bufp->translate)
- ! for (i = 0; i < (1 << BYTEWIDTH); i++)
- ! if (bufp->translate[i])
- ! printchar (i);
- ! printf ("\nfastmap is%s accurate\n", bufp->fastmap_accurate ? "" : "n't");
- ! printf ("can %s be null\n----------", bufp->can_be_null ? "" : "not");
- ! }
- ! #endif
- !
- ! void printchar (int c)
- ! {
- ! if (c < 041 || c >= 0177)
- ! {
- ! putchar ('\\');
- ! putchar (((c >> 6) & 3) + '0');
- ! putchar (((c >> 3) & 7) + '0');
- ! putchar ((c & 7) + '0');
- ! }
- ! else
- ! putchar (c);
- ! }
- !
- ! void error (char *string)
- ! {
- ! puts (string);
- ! exit (1);
- ! }
- !
- ! void main (int argc, char **argv)
- {
- char pat[80];
- struct re_pattern_buffer buf;
- int i;
- char fastmap[(1 << BYTEWIDTH)];
-
- /* Allow a command argument to specify the style of syntax. */
- ***************
- *** 1684,1736 ****
- i = re_match (&buf, pat, strlen (pat), 0, 0);
- printf ("Match value %d.\n", i);
- }
- - }
- -
- - #ifdef NOTDEF
- - print_buf (bufp)
- - struct re_pattern_buffer *bufp;
- - {
- - int i;
- -
- - printf ("buf is :\n----------------\n");
- - for (i = 0; i < bufp->used; i++)
- - printchar (bufp->buffer[i]);
- -
- - printf ("\n%d allocated, %d used.\n", bufp->allocated, bufp->used);
- -
- - printf ("Allowed by fastmap: ");
- - for (i = 0; i < (1 << BYTEWIDTH); i++)
- - if (bufp->fastmap[i])
- - printchar (i);
- - printf ("\nAllowed by translate: ");
- - if (bufp->translate)
- - for (i = 0; i < (1 << BYTEWIDTH); i++)
- - if (bufp->translate[i])
- - printchar (i);
- - printf ("\nfastmap is%s accurate\n", bufp->fastmap_accurate ? "" : "n't");
- - printf ("can %s be null\n----------", bufp->can_be_null ? "" : "not");
- - }
- - #endif
- -
- - printchar (c)
- - char c;
- - {
- - if (c < 041 || c >= 0177)
- - {
- - putchar ('\\');
- - putchar (((c >> 6) & 3) + '0');
- - putchar (((c >> 3) & 7) + '0');
- - putchar ((c & 7) + '0');
- - }
- - else
- - putchar (c);
- - }
- -
- - error (string)
- - char *string;
- - {
- - puts (string);
- - exit (1);
- }
-
- #endif /* test */
- --- 1766,1771 ----
- diff -cbBw orig/regex.h grep/regex.h
- *** orig/regex.h Mon May 07 09:08:56 1990
- --- grep/regex.h Sun Jan 19 18:59:04 1992
- ***************
- *** 1,4 ****
- ! /* Definitions for data structures callers pass the regex library.
- Copyright (C) 1985, 1989 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- --- 1,6 ----
- ! /* GNU regex library
- !
- ! Definitions for data structures callers pass the regex library.
- Copyright (C) 1985, 1989 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- ***************
- *** 18,24 ****
-
- In other words, you are welcome to use, share and improve this program.
- You are forbidden to forbid anyone else to use, share and improve
- ! what you give them. Help stamp out software-hoarding! */
-
-
- /* Define number of parens for which we record the beginnings and ends.
- --- 20,27 ----
-
- In other words, you are welcome to use, share and improve this program.
- You are forbidden to forbid anyone else to use, share and improve
- ! what you give them. Help stamp out software-hoarding!
- ! */
-
-
- /* Define number of parens for which we record the beginnings and ends.
- ***************
- *** 61,69 ****
- *, +, ? - only special when not after the beginning, (, or | */
- #define RE_CONTEXT_INDEP_OPS 32
-
- /* Now define combinations of bits for the standard possibilities. */
- ! #define RE_SYNTAX_AWK (RE_NO_BK_PARENS | RE_NO_BK_VBAR | RE_CONTEXT_INDEP_OPS)
- ! #define RE_SYNTAX_EGREP (RE_SYNTAX_AWK | RE_NEWLINE_OR)
- #define RE_SYNTAX_GREP (RE_BK_PLUS_QM | RE_NEWLINE_OR)
- #define RE_SYNTAX_EMACS 0
-
- --- 64,79 ----
- *, +, ? - only special when not after the beginning, (, or | */
- #define RE_CONTEXT_INDEP_OPS 32
-
- + /* 0 means that \ before anything inside [ and ] is taken as a real \.
- + 1 means that such a \ escapes the following character. This is a
- + special case for AWK. */
- + #define RE_AWK_CLASS_HACK 64
- +
- /* Now define combinations of bits for the standard possibilities. */
- ! #define RE_SYNTAX_AWK \
- ! (RE_NO_BK_PARENS | RE_NO_BK_VBAR | RE_CONTEXT_INDEP_OPS | RE_AWK_CLASS_HACK)
- ! #define RE_SYNTAX_EGREP \
- ! (RE_NO_BK_PARENS | RE_NO_BK_VBAR | RE_CONTEXT_INDEP_OPS | RE_NEWLINE_OR)
- #define RE_SYNTAX_GREP (RE_BK_PLUS_QM | RE_NEWLINE_OR)
- #define RE_SYNTAX_EMACS 0
-
- ***************
- *** 169,185 ****
- followed by a byte which contains a syntax code, Sword or such like */
- notsyntaxspec /* Matches any character whose syntax differs from the specified. */
- };
- -
- - extern char *re_compile_pattern ();
- - /* Is this really advertised? */
- - extern void re_compile_fastmap ();
- - extern int re_search (), re_search_2 ();
- - extern int re_match (), re_match_2 ();
-
- ! /* 4.2 bsd compatibility (yuck) */
- ! extern char *re_comp ();
- ! extern int re_exec ();
-
- ! #ifdef SYNTAX_TABLE
- ! extern char *re_syntax_table;
- ! #endif
- --- 179,203 ----
- followed by a byte which contains a syntax code, Sword or such like */
- notsyntaxspec /* Matches any character whose syntax differs from the specified. */
- };
-
- ! extern char *re_compile_pattern(char *pattern, int size,
- ! struct re_pattern_buffer *bufp);
-
- ! extern void re_compile_fastmap(struct re_pattern_buffer *bufp);
- !
- ! extern int re_search(struct re_pattern_buffer *pbufp, char *string, int size,
- ! int startpos, int range, struct re_registers *regs);
- !
- ! extern int re_search_2(struct re_pattern_buffer *pbufp, char *string1,
- ! int size1, char *string2, int size2, int startpos, int range,
- ! struct re_registers *regs, int mstop);
- !
- ! extern int re_match(struct re_pattern_buffer *pbufp, char *string, int size,
- ! int pos, struct re_registers *regs);
- !
- ! extern int re_match_2(struct re_pattern_buffer *pbufp, char *string1_arg, int size1,
- ! char *string2_arg, int size2, int pos, struct re_registers *regs, int mstop);
- !
- ! /* 4.2 bsd compatibility (yuck) */
- ! extern char *re_comp(char *s);
- ! extern int re_exec(char *s);
-