?? 333to335.dif
字號:
diff -u -r --new-file agrep.333/agrep.c agrep.335/agrep.c
--- agrep.333/agrep.c Tue Apr 08 00:50:01 1997
+++ agrep.335/agrep.c Thu Dec 11 02:22:17 1997
@@ -1,9 +1,13 @@
/*
AGREP APPROXIMATE PATTERN - GREP.
- Copyright (c) 1994 Sun Wu, Udi Manber, Burra Gopal.
+ Copyright (c) 1994-1997 Sun Wu, Udi Manber, Burra Gopal, Tom Gries (for OS/2)
All Rights Reserved.
+[fix] 3.35 TG 11.12.97 agrep.c: -f function did not work because of a simple
+ problem in the commandline parser: the patternfile preprocessing
+ prepf() was done before definition of the codepage. Oops.
+[fix] 3.34 newmgrep.c: input buffer was used before its start address
[chg] 3.33 TG 02.03.97 when no target filename(s) were given:
AGREP displays an error message now
instead of reading from stdin.
@@ -2418,16 +2422,23 @@
PRINT(printf("file=%s\n", argv[0]);
)
strcpy(PAT_FILE_NAME, argv[0]);
- if (prepf(multifd, NULL, 0) <= -1) {
- close(multifd);
- PAT_FILE = OFF;
- fprintf(stderr, "%s: error in processing pattern file: %s\n", Progname, argv[0]);
- if (!EXITONERROR) {
- errno = AGREP_ERROR;
- return -1;
- }
- else exit(2);
- }
+
+/* TG 11.12.97 [fix] 3.35
+ * Postpone the pattern file preprocessing until the codepage has been set up outside the loop !
+ * Code is simply moved below (after codepage loading).
+ *
+ * if (prepf(multifd, NULL, 0) <= -1) {
+ * close(multifd);
+ * PAT_FILE = OFF;
+ * fprintf(stderr, "%s: error in processing pattern file: %s\n", Progname, argv[0]);
+ * if (!EXITONERROR) {
+ * errno = AGREP_ERROR;
+ * return -1;
+ * }
+ * else exit(2);
+ * }
+ */
+
quitwhile = ON;
break;
@@ -2805,6 +2816,24 @@
}
}
+
+
+ /* pattern file handling TG 11.12.97 [fix] 3.35
+ Simply moved from above, commandline parsing of -f option. */
+
+ if (PAT_FILE) {
+ if (prepf(multifd, NULL, 0) <= -1) {
+ close(multifd);
+ PAT_FILE = OFF;
+ fprintf(stderr, "%s: error in processing pattern file: %s\n", Progname, argv[0]);
+ if (!EXITONERROR) {
+ errno = AGREP_ERROR;
+ return -1;
+ }
+ else exit(2);
+ }
+ }
+
if (NOOUTTAIL == ON) OUTTAIL = OFF;
diff -u -r --new-file agrep.333/agrepgdb.mk agrep.335/agrepgdb.mk
--- agrep.333/agrepgdb.mk Wed Dec 31 19:00:00 1969
+++ agrep.335/agrepgdb.mk Wed Oct 22 01:49:55 1997
@@ -0,0 +1,164 @@
+#
+# agrepos2.mk
+# Makefile for the OS/2-only version of AGREP
+#
+# creates AGREP2.EXE for OS/2
+# does not need any other EXE or DLL
+#
+# Operatingsystem | OS/2 | DOS | Win 3.x |
+# |------------------------|--------------|-----------------------|
+# | native | DOS-Box | native | DOS-Box | GUI |
+# | AGREP2.EXE | - | - | - | - |
+#
+# If you are running DOS or Windows,
+# and/or if you want to run AGREP in a DOS-Window of OS/2,
+# compile and link with
+#
+# agrepdos.mk
+#
+# to create an executable
+#
+# AGREP.EXE
+#
+# which DOES need RSX.EXE (see table) when running under a
+# DPMI server (himem.sys+emm386, 386max, or qemm386)
+#
+# | | | | | |
+# | AGREP.EXE | AGREP.EXE | AGREP.EXE | AGREP.EXE | not impl.| |
+# prerequisites: | | + RSX.EXE | | + RSX.EXE | |
+# | | (note 1) | |
+#
+# NOTE:
+#
+# The AGREP.EXE tries to locate RSX.EXE via the environment variable RSX.
+# When you have put the RSX.EXE into the subdirectory c:\rsx\bin\rsx.exe then use
+#
+# SET RSX=C:\RSX\BIN\RSX.EXE
+#
+# in your AUTOEXEC.BAT.
+#
+#
+# Adapted for the emx compiler by Tom Gries <gries@ibm.net>
+# 02.03.97
+#
+# on the basis of an original:
+# Copyright (c) 1994 Sun Wu, Udi Manber, Burra Gopal. All Rights Reserved.
+#
+
+# The switches -Zomf and -Zsys are sufficient to create an
+# OS/2-only stand-alone executable, which does not need EMX.DLL
+#
+# This is the PURE-OS/2 solution.
+#
+#CC = gcc -Zomf -Zsys -ansi -O3
+
+CC = gcc -ansi
+
+#
+#CC = gcc -ansi -O3
+#
+
+# ---------------------------------------------------------------------
+# Define HAVE_DIRENT_H to be 1 when you don't have <sys/dir.h>
+# else define it to be 0 (in this case, one of the other 3 flags
+# may need to be defined to be 1).
+# ---------------------------------------------------------------------
+
+HAVE_DIRENT_H = 1
+HAVE_SYS_DIR_H = 0
+HAVE_SYS_NDIR_H = 0
+HAVE_NDIR_H = 0
+
+# ---------------------------------------------------------------------
+# Define UTIME to be 1 if you have the utime() routine on your system.
+# Else define it to be 0.
+# ---------------------------------------------------------------------
+
+UTIME = 1
+
+# ---------------------------------------------------------------------
+# Define codepage_SET to be 1 if you want to use the international
+# 8bit character set. Else define it to be 0.
+# ---------------------------------------------------------------------
+# This switch has not been introduced by me ! [TG] 05.10.96
+
+ISO_CHAR_SET = 1
+
+###### OPTIMIZEFLAGS = -O3
+
+DEFINEFLAGS = -DHAVE_DIRENT_H=$(HAVE_DIRENT_H) \
+ -DHAVE_SYS_DIR_H=$(HAVE_SYS_DIR_H) \
+ -DHAVE_SYS_NDIR_H=$(HAVE_SYS_NDIR_H) \
+ -DHAVE_NDIR_H=$(HAVE_NDIR_H) \
+ -DUTIME=$(UTIME) \
+ -DISO_CHAR_SET=$(ISO_CHAR_SET) \
+ -DS_IFLNK=-1 \
+ -Dlstat=stat
+SUBDIRCFLAGS = -g -c -fbounds-checking $(DEFINEFLAGS) $(OPTIMIZEFLAGS)
+MYDEFINEFLAGS = -DMEASURE_TIMES=0 \
+ -DAGREP_POINTER=1 \
+ -DDOTCOMPRESSED=0 \
+ -D__OS2=1
+CFLAGS = $(MYDEFINEFLAGS) $(SUBDIRCFLAGS)
+OTHERLIBS =
+
+PROG = agrep2
+
+HDRS = agrep.h checkfil.h re.h defs.h config.h codepage.h version.h
+
+OBJS = follow.o \
+ asearch.o \
+ asearch1.o \
+ agrep.o \
+ bitap.o \
+ checkfil.o \
+ compat.o \
+ dummyfil.o \
+ main.o \
+ maskgen.o \
+ parse.o \
+ checksg.o \
+ preproce.o \
+ delim.o \
+ asplit.o \
+ recursiv.o \
+ sgrep.o \
+ newmgrep.o \
+ utilitie.o \
+ codepage.o \
+ agrephlp.o
+
+# not use any longer io.o
+
+$(PROG).EXE: $(OBJS)
+ $(CC) -fbounds-checking -o $(PROG).EXE $(OBJS)
+
+clean:
+ -del *.o
+ -del $(PROG).EXE
+
+# The header file config.h should be visible in the whole source code
+# Apparently, it is not at the moment. [TG] 28.09.96
+
+compat.o: agrep.h defs.h config.h
+asearch.o: agrep.h defs.h config.h
+asearch1.o: agrep.h defs.h config.h
+bitap.o: agrep.h defs.h config.h codepage.h
+checkfil.o: agrep.h checkfil.h defs.h config.h
+follow.o: re.h agrep.h defs.h config.h
+main.o: agrep.h checkfil.h defs.h config.h
+agrep.o: agrep.h checkfil.h defs.h config.h version.h codepage.h
+agrephlp.o: version.h config.h
+newmgrep.o: agrep.h defs.h config.h codepage.h
+maskgen.o: agrep.h defs.h config.h codepage.h
+next.o: agrep.h defs.h config.h
+parse.o: re.h agrep.h defs.h config.h
+preproce.o: agrep.h defs.h config.h
+checksg.o: agrep.h checkfil.h defs.h config.h
+delim.o: agrep.h defs.h config.h
+asplit.o: agrep.h defs.h config.h
+sgrep.o: agrep.h defs.h config.h codepage.h
+# not used any longer io.o: agrep.h defs.h config.h
+utilitie.o: re.h agrep.h defs.h config.h
+dummyfil.o: config.h
+codepage.o: codepage.h config.h agrep.h
diff -u -r --new-file agrep.333/newmgrep.c agrep.335/newmgrep.c
--- agrep.333/newmgrep.c Tue Apr 08 00:50:01 1997
+++ agrep.335/newmgrep.c Wed Oct 22 22:13:19 1997
@@ -1,7 +1,10 @@
/* Copyright (c) 1994 Sun Wu, Udi Manber, Burra Gopal. All Rights Reserved. */
/*
-[chg] 21.08.96 now uses ISO_CHAR.H /TG
+
+[fix] TG 22.10.97 3.34 in mgrep(): check bounds before memcpy-ing
+[chg] TG 21.08.96 now uses ISO_CHAR.H
+
*/
/* multipattern matcher */
@@ -479,7 +482,15 @@
newbuf = backward_delimiter(newbuf, text+MAXLINE, D_pattern, D_length, OUTTAIL); /* see agrep.c/'d' */
if (newbuf < text+MAXLINE+D_length) newbuf = text + end + 1;
end = newbuf - text - 1;
- memcpy(text+start-D_length, D_pattern, D_length);
+
+/* TG 22.10.97 Check bounds before memcpy-ing */
+/* printf("text %x start %i D_length %i D_pattern %i residue %i\n",text,start,D_length,D_pattern,residue); */
+
+ if (start > D_length) memcpy(text+start-D_length, D_pattern, D_length);
+ memcpy(text+start+residue, D_pattern, D_length);
+
+/* original code was: memcpy(text+start-D_length, D_pattern, D_length); */
+
}
residue = buf_end - end + 1 ;
if(INVERSE && COUNT) countline(text+MAXLINE, num_read);
diff -u -r --new-file agrep.333/target agrep.335/target
--- agrep.333/target Wed Dec 31 19:00:00 1969
+++ agrep.335/target Mon Dec 08 22:22:07 1997
@@ -0,0 +1,9 @@
+cepas
+wombat
+nail
+beavis
+coat
+teletubbies
+coat nail
+happy xmas
+
\ No newline at end of file
diff -u -r --new-file agrep.333/version.h agrep.335/version.h
--- agrep.333/version.h Tue Apr 08 00:50:01 1997
+++ agrep.335/version.h Thu Dec 11 01:55:57 1997
@@ -1,4 +1,8 @@
/*
+[fix] 3.35 TG 11.12.97 in agrep(): -f now working again
+ prepf() for multi-pattern was called
+ before the codepage LUT was prepared
+[fix] 3.34 TG 22.10.97 in mgrep(): check bounds before memcpy()
[chg] 3.33 TG 07.04.97 when no target filename(s) were given:
AGREP displays an error message now
instead of reading from stdin.
@@ -35,7 +39,7 @@
*/
-#define AGREP_VERSION "3.33"
+#define AGREP_VERSION "3.35"
#ifdef __DOS
#define AGREP_OS "DOS"
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -