|
| 1 | +diff -u -r --new-file agrep.333/agrep.c agrep.335/agrep.c |
| 2 | +--- agrep.333/agrep.c Tue Apr 08 00:50:01 1997 |
| 3 | ++++ agrep.335/agrep.c Thu Dec 11 02:22:17 1997 |
| 4 | +@@ -1,9 +1,13 @@ |
| 5 | + /* |
| 6 | + AGREP APPROXIMATE PATTERN - GREP. |
| 7 | + |
| 8 | +- Copyright (c) 1994 Sun Wu, Udi Manber, Burra Gopal. |
| 9 | ++ Copyright (c) 1994-1997 Sun Wu, Udi Manber, Burra Gopal, Tom Gries (for OS/2) |
| 10 | + All Rights Reserved. |
| 11 | + |
| 12 | ++[fix] 3.35 TG 11.12.97 agrep.c: -f function did not work because of a simple |
| 13 | ++ problem in the commandline parser: the patternfile preprocessing |
| 14 | ++ prepf() was done before definition of the codepage. Oops. |
| 15 | ++[fix] 3.34 newmgrep.c: input buffer was used before its start address |
| 16 | + [chg] 3.33 TG 02.03.97 when no target filename(s) were given: |
| 17 | + AGREP displays an error message now |
| 18 | + instead of reading from stdin. |
| 19 | +@@ -2418,16 +2422,23 @@ |
| 20 | + PRINT(printf("file=%s\n", argv[0]); |
| 21 | + ) |
| 22 | + strcpy(PAT_FILE_NAME, argv[0]); |
| 23 | +- if (prepf(multifd, NULL, 0) <= -1) { |
| 24 | +- close(multifd); |
| 25 | +- PAT_FILE = OFF; |
| 26 | +- fprintf(stderr, "%s: error in processing pattern file: %s\n", Progname, argv[0]); |
| 27 | +- if (!EXITONERROR) { |
| 28 | +- errno = AGREP_ERROR; |
| 29 | +- return -1; |
| 30 | +- } |
| 31 | +- else exit(2); |
| 32 | +- } |
| 33 | ++ |
| 34 | ++/* TG 11.12.97 [fix] 3.35 |
| 35 | ++ * Postpone the pattern file preprocessing until the codepage has been set up outside the loop ! |
| 36 | ++ * Code is simply moved below (after codepage loading). |
| 37 | ++ * |
| 38 | ++ * if (prepf(multifd, NULL, 0) <= -1) { |
| 39 | ++ * close(multifd); |
| 40 | ++ * PAT_FILE = OFF; |
| 41 | ++ * fprintf(stderr, "%s: error in processing pattern file: %s\n", Progname, argv[0]); |
| 42 | ++ * if (!EXITONERROR) { |
| 43 | ++ * errno = AGREP_ERROR; |
| 44 | ++ * return -1; |
| 45 | ++ * } |
| 46 | ++ * else exit(2); |
| 47 | ++ * } |
| 48 | ++ */ |
| 49 | ++ |
| 50 | + quitwhile = ON; |
| 51 | + break; |
| 52 | + |
| 53 | +@@ -2805,6 +2816,24 @@ |
| 54 | + |
| 55 | + } |
| 56 | + } |
| 57 | ++ |
| 58 | ++ |
| 59 | ++ /* pattern file handling TG 11.12.97 [fix] 3.35 |
| 60 | ++ Simply moved from above, commandline parsing of -f option. */ |
| 61 | ++ |
| 62 | ++ if (PAT_FILE) { |
| 63 | ++ if (prepf(multifd, NULL, 0) <= -1) { |
| 64 | ++ close(multifd); |
| 65 | ++ PAT_FILE = OFF; |
| 66 | ++ fprintf(stderr, "%s: error in processing pattern file: %s\n", Progname, argv[0]); |
| 67 | ++ if (!EXITONERROR) { |
| 68 | ++ errno = AGREP_ERROR; |
| 69 | ++ return -1; |
| 70 | ++ } |
| 71 | ++ else exit(2); |
| 72 | ++ } |
| 73 | ++ } |
| 74 | ++ |
| 75 | + |
| 76 | + if (NOOUTTAIL == ON) OUTTAIL = OFF; |
| 77 | + |
| 78 | +diff -u -r --new-file agrep.333/agrepgdb.mk agrep.335/agrepgdb.mk |
| 79 | +--- agrep.333/agrepgdb.mk Wed Dec 31 19:00:00 1969 |
| 80 | ++++ agrep.335/agrepgdb.mk Wed Oct 22 01:49:55 1997 |
| 81 | +@@ -0,0 +1,164 @@ |
| 82 | ++# |
| 83 | ++# agrepos2.mk |
| 84 | ++# Makefile for the OS/2-only version of AGREP |
| 85 | ++# |
| 86 | ++# creates AGREP2.EXE for OS/2 |
| 87 | ++# does not need any other EXE or DLL |
| 88 | ++# |
| 89 | ++# Operatingsystem | OS/2 | DOS | Win 3.x | |
| 90 | ++# |------------------------|--------------|-----------------------| |
| 91 | ++# | native | DOS-Box | native | DOS-Box | GUI | |
| 92 | ++# | AGREP2.EXE | - | - | - | - | |
| 93 | ++# |
| 94 | ++# If you are running DOS or Windows, |
| 95 | ++# and/or if you want to run AGREP in a DOS-Window of OS/2, |
| 96 | ++# compile and link with |
| 97 | ++# |
| 98 | ++# agrepdos.mk |
| 99 | ++# |
| 100 | ++# to create an executable |
| 101 | ++# |
| 102 | ++# AGREP.EXE |
| 103 | ++# |
| 104 | ++# which DOES need RSX.EXE (see table) when running under a |
| 105 | ++# DPMI server (himem.sys+emm386, 386max, or qemm386) |
| 106 | ++# |
| 107 | ++# | | | | | | |
| 108 | ++# | AGREP.EXE | AGREP.EXE | AGREP.EXE | AGREP.EXE | not impl.| | |
| 109 | ++# prerequisites: | | + RSX.EXE | | + RSX.EXE | | |
| 110 | ++# | | (note 1) | | |
| 111 | ++# |
| 112 | ++# NOTE: |
| 113 | ++# |
| 114 | ++# The AGREP.EXE tries to locate RSX.EXE via the environment variable RSX. |
| 115 | ++# When you have put the RSX.EXE into the subdirectory c:\rsx\bin\rsx.exe then use |
| 116 | ++# |
| 117 | ++# SET RSX=C:\RSX\BIN\RSX.EXE |
| 118 | ++# |
| 119 | ++# in your AUTOEXEC.BAT. |
| 120 | ++# |
| 121 | ++# |
| 122 | ++# Adapted for the emx compiler by Tom Gries < [email protected]> |
| 123 | ++# 02.03.97 |
| 124 | ++# |
| 125 | ++# on the basis of an original: |
| 126 | ++# Copyright (c) 1994 Sun Wu, Udi Manber, Burra Gopal. All Rights Reserved. |
| 127 | ++# |
| 128 | ++ |
| 129 | ++# The switches -Zomf and -Zsys are sufficient to create an |
| 130 | ++# OS/2-only stand-alone executable, which does not need EMX.DLL |
| 131 | ++# |
| 132 | ++# This is the PURE-OS/2 solution. |
| 133 | ++# |
| 134 | ++#CC = gcc -Zomf -Zsys -ansi -O3 |
| 135 | ++ |
| 136 | ++CC = gcc -ansi |
| 137 | ++ |
| 138 | ++# |
| 139 | ++#CC = gcc -ansi -O3 |
| 140 | ++# |
| 141 | ++ |
| 142 | ++# --------------------------------------------------------------------- |
| 143 | ++# Define HAVE_DIRENT_H to be 1 when you don't have <sys/dir.h> |
| 144 | ++# else define it to be 0 (in this case, one of the other 3 flags |
| 145 | ++# may need to be defined to be 1). |
| 146 | ++# --------------------------------------------------------------------- |
| 147 | ++ |
| 148 | ++HAVE_DIRENT_H = 1 |
| 149 | ++HAVE_SYS_DIR_H = 0 |
| 150 | ++HAVE_SYS_NDIR_H = 0 |
| 151 | ++HAVE_NDIR_H = 0 |
| 152 | ++ |
| 153 | ++# --------------------------------------------------------------------- |
| 154 | ++# Define UTIME to be 1 if you have the utime() routine on your system. |
| 155 | ++# Else define it to be 0. |
| 156 | ++# --------------------------------------------------------------------- |
| 157 | ++ |
| 158 | ++UTIME = 1 |
| 159 | ++ |
| 160 | ++# --------------------------------------------------------------------- |
| 161 | ++# Define codepage_SET to be 1 if you want to use the international |
| 162 | ++# 8bit character set. Else define it to be 0. |
| 163 | ++# --------------------------------------------------------------------- |
| 164 | ++# This switch has not been introduced by me ! [TG] 05.10.96 |
| 165 | ++ |
| 166 | ++ISO_CHAR_SET = 1 |
| 167 | ++ |
| 168 | ++###### OPTIMIZEFLAGS = -O3 |
| 169 | ++ |
| 170 | ++DEFINEFLAGS = -DHAVE_DIRENT_H=$(HAVE_DIRENT_H) \ |
| 171 | ++ -DHAVE_SYS_DIR_H=$(HAVE_SYS_DIR_H) \ |
| 172 | ++ -DHAVE_SYS_NDIR_H=$(HAVE_SYS_NDIR_H) \ |
| 173 | ++ -DHAVE_NDIR_H=$(HAVE_NDIR_H) \ |
| 174 | ++ -DUTIME=$(UTIME) \ |
| 175 | ++ -DISO_CHAR_SET=$(ISO_CHAR_SET) \ |
| 176 | ++ -DS_IFLNK=-1 \ |
| 177 | ++ -Dlstat=stat |
| 178 | ++SUBDIRCFLAGS = -g -c -fbounds-checking $(DEFINEFLAGS) $(OPTIMIZEFLAGS) |
| 179 | ++MYDEFINEFLAGS = -DMEASURE_TIMES=0 \ |
| 180 | ++ -DAGREP_POINTER=1 \ |
| 181 | ++ -DDOTCOMPRESSED=0 \ |
| 182 | ++ -D__OS2=1 |
| 183 | ++CFLAGS = $(MYDEFINEFLAGS) $(SUBDIRCFLAGS) |
| 184 | ++OTHERLIBS = |
| 185 | ++ |
| 186 | ++PROG = agrep2 |
| 187 | ++ |
| 188 | ++HDRS = agrep.h checkfil.h re.h defs.h config.h codepage.h version.h |
| 189 | ++ |
| 190 | ++OBJS = follow.o \ |
| 191 | ++ asearch.o \ |
| 192 | ++ asearch1.o \ |
| 193 | ++ agrep.o \ |
| 194 | ++ bitap.o \ |
| 195 | ++ checkfil.o \ |
| 196 | ++ compat.o \ |
| 197 | ++ dummyfil.o \ |
| 198 | ++ main.o \ |
| 199 | ++ maskgen.o \ |
| 200 | ++ parse.o \ |
| 201 | ++ checksg.o \ |
| 202 | ++ preproce.o \ |
| 203 | ++ delim.o \ |
| 204 | ++ asplit.o \ |
| 205 | ++ recursiv.o \ |
| 206 | ++ sgrep.o \ |
| 207 | ++ newmgrep.o \ |
| 208 | ++ utilitie.o \ |
| 209 | ++ codepage.o \ |
| 210 | ++ agrephlp.o |
| 211 | ++ |
| 212 | ++# not use any longer io.o |
| 213 | ++ |
| 214 | ++$(PROG).EXE: $(OBJS) |
| 215 | ++ $(CC) -fbounds-checking -o $(PROG).EXE $(OBJS) |
| 216 | ++ |
| 217 | ++clean: |
| 218 | ++ -del *.o |
| 219 | ++ -del $(PROG).EXE |
| 220 | ++ |
| 221 | ++# The header file config.h should be visible in the whole source code |
| 222 | ++# Apparently, it is not at the moment. [TG] 28.09.96 |
| 223 | ++ |
| 224 | ++compat.o: agrep.h defs.h config.h |
| 225 | ++asearch.o: agrep.h defs.h config.h |
| 226 | ++asearch1.o: agrep.h defs.h config.h |
| 227 | ++bitap.o: agrep.h defs.h config.h codepage.h |
| 228 | ++checkfil.o: agrep.h checkfil.h defs.h config.h |
| 229 | ++follow.o: re.h agrep.h defs.h config.h |
| 230 | ++main.o: agrep.h checkfil.h defs.h config.h |
| 231 | ++agrep.o: agrep.h checkfil.h defs.h config.h version.h codepage.h |
| 232 | ++agrephlp.o: version.h config.h |
| 233 | ++newmgrep.o: agrep.h defs.h config.h codepage.h |
| 234 | ++maskgen.o: agrep.h defs.h config.h codepage.h |
| 235 | ++next.o: agrep.h defs.h config.h |
| 236 | ++parse.o: re.h agrep.h defs.h config.h |
| 237 | ++preproce.o: agrep.h defs.h config.h |
| 238 | ++checksg.o: agrep.h checkfil.h defs.h config.h |
| 239 | ++delim.o: agrep.h defs.h config.h |
| 240 | ++asplit.o: agrep.h defs.h config.h |
| 241 | ++sgrep.o: agrep.h defs.h config.h codepage.h |
| 242 | ++# not used any longer io.o: agrep.h defs.h config.h |
| 243 | ++utilitie.o: re.h agrep.h defs.h config.h |
| 244 | ++dummyfil.o: config.h |
| 245 | ++codepage.o: codepage.h config.h agrep.h |
| 246 | +diff -u -r --new-file agrep.333/newmgrep.c agrep.335/newmgrep.c |
| 247 | +--- agrep.333/newmgrep.c Tue Apr 08 00:50:01 1997 |
| 248 | ++++ agrep.335/newmgrep.c Wed Oct 22 22:13:19 1997 |
| 249 | +@@ -1,7 +1,10 @@ |
| 250 | + /* Copyright (c) 1994 Sun Wu, Udi Manber, Burra Gopal. All Rights Reserved. */ |
| 251 | + |
| 252 | + /* |
| 253 | +-[chg] 21.08.96 now uses ISO_CHAR.H /TG |
| 254 | ++ |
| 255 | ++[fix] TG 22.10.97 3.34 in mgrep(): check bounds before memcpy-ing |
| 256 | ++[chg] TG 21.08.96 now uses ISO_CHAR.H |
| 257 | ++ |
| 258 | + */ |
| 259 | + |
| 260 | + /* multipattern matcher */ |
| 261 | +@@ -479,7 +482,15 @@ |
| 262 | + newbuf = backward_delimiter(newbuf, text+MAXLINE, D_pattern, D_length, OUTTAIL); /* see agrep.c/'d' */ |
| 263 | + if (newbuf < text+MAXLINE+D_length) newbuf = text + end + 1; |
| 264 | + end = newbuf - text - 1; |
| 265 | +- memcpy(text+start-D_length, D_pattern, D_length); |
| 266 | ++ |
| 267 | ++/* TG 22.10.97 Check bounds before memcpy-ing */ |
| 268 | ++/* printf("text %x start %i D_length %i D_pattern %i residue %i\n",text,start,D_length,D_pattern,residue); */ |
| 269 | ++ |
| 270 | ++ if (start > D_length) memcpy(text+start-D_length, D_pattern, D_length); |
| 271 | ++ memcpy(text+start+residue, D_pattern, D_length); |
| 272 | ++ |
| 273 | ++/* original code was: memcpy(text+start-D_length, D_pattern, D_length); */ |
| 274 | ++ |
| 275 | + } |
| 276 | + residue = buf_end - end + 1 ; |
| 277 | + if(INVERSE && COUNT) countline(text+MAXLINE, num_read); |
| 278 | +diff -u -r --new-file agrep.333/target agrep.335/target |
| 279 | +--- agrep.333/target Wed Dec 31 19:00:00 1969 |
| 280 | ++++ agrep.335/target Mon Dec 08 22:22:07 1997 |
| 281 | +@@ -0,0 +1,9 @@ |
| 282 | ++cepas |
| 283 | ++wombat |
| 284 | ++nail |
| 285 | ++beavis |
| 286 | ++coat |
| 287 | ++teletubbies |
| 288 | ++coat nail |
| 289 | ++happy xmas |
| 290 | ++ |
| 291 | +\ No newline at end of file |
| 292 | +diff -u -r --new-file agrep.333/version.h agrep.335/version.h |
| 293 | +--- agrep.333/version.h Tue Apr 08 00:50:01 1997 |
| 294 | ++++ agrep.335/version.h Thu Dec 11 01:55:57 1997 |
| 295 | +@@ -1,4 +1,8 @@ |
| 296 | + /* |
| 297 | ++[fix] 3.35 TG 11.12.97 in agrep(): -f now working again |
| 298 | ++ prepf() for multi-pattern was called |
| 299 | ++ before the codepage LUT was prepared |
| 300 | ++[fix] 3.34 TG 22.10.97 in mgrep(): check bounds before memcpy() |
| 301 | + [chg] 3.33 TG 07.04.97 when no target filename(s) were given: |
| 302 | + AGREP displays an error message now |
| 303 | + instead of reading from stdin. |
| 304 | +@@ -35,7 +39,7 @@ |
| 305 | + |
| 306 | + */ |
| 307 | + |
| 308 | +-#define AGREP_VERSION "3.33" |
| 309 | ++#define AGREP_VERSION "3.35" |
| 310 | + |
| 311 | + #ifdef __DOS |
| 312 | + #define AGREP_OS "DOS" |
0 commit comments