forked from Lainports/freebsd-ports
Add 2bsd-diff 2.11, 2.11BSD diff utility. It can process large
files with less memory. GNU Diff often can not work with files larger than 33% of datasize (from limit) due to memory exhaustion. PR: ports/50097 Submitted by: risner@stdio.com
This commit is contained in:
parent
6e17e05281
commit
52bd9c4f01
11 changed files with 314 additions and 0 deletions
30
textproc/2bsd-diff/Makefile
Normal file
30
textproc/2bsd-diff/Makefile
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# New ports collection makefile for: 2bsd-diff
|
||||
# Date created: Mon Mar 17 20:54:03 EST 2003
|
||||
# Whom: risner@stdio.com
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
PORTNAME= diff
|
||||
PORTVERSION= 2.11
|
||||
PORTREVISION= 0
|
||||
CATEGORIES= textproc
|
||||
MASTER_SITES= http://www.tribug.org/pub/tuhs/PDP-11/Distributions/ucb/2.11BSD/
|
||||
PKGNAMEPREFIX= 2bsd-
|
||||
DISTNAME= file8
|
||||
|
||||
MAINTAINER= risner@stdio.com
|
||||
COMMENT= 2.11BSD diff utility
|
||||
|
||||
EXTRACT_AFTER_ARGS= | ${TAR} -xf - bin/diff man/man1/diff.1
|
||||
WRKSRC= ${WRKDIR}/bin/diff
|
||||
|
||||
USE_REINPLACE= YES
|
||||
|
||||
MAN1= 2diff.1
|
||||
|
||||
post-patch:
|
||||
@${REINPLACE_CMD} -e 's,%%PREFIX%%,${PREFIX},g' \
|
||||
${WRKSRC}/../../man/man1/diff.1
|
||||
|
||||
.include <bsd.port.mk>
|
||||
1
textproc/2bsd-diff/distinfo
Normal file
1
textproc/2bsd-diff/distinfo
Normal file
|
|
@ -0,0 +1 @@
|
|||
MD5 (file8.tar.gz) = 77397e6d554361c127592b1fea2d776f
|
||||
36
textproc/2bsd-diff/files/patch-Makefile
Normal file
36
textproc/2bsd-diff/files/patch-Makefile
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
--- Makefile.orig Tue Oct 22 13:29:46 1996
|
||||
+++ Makefile Wed Mar 19 01:29:12 2003
|
||||
@@ -1,9 +1,9 @@
|
||||
# @(#)Makefile 4.1.1 1996/10/21
|
||||
#
|
||||
-DIFF= /bin/diff
|
||||
-DIFFH= /usr/libexec/diffh
|
||||
-PR= /bin/pr
|
||||
-CFLAGS= -O -DDIFF='"${DIFF}"' -DDIFFH='"${DIFFH}"' -DPR='"${PR}"'
|
||||
+DIFF= ${PREFIX}/bin/2diff
|
||||
+DIFFH= ${PREFIX}/libexec/2diffh
|
||||
+PR= /usr/bin/pr
|
||||
+CFLAGS+=-DDIFF='"${DIFF}"' -DDIFFH='"${DIFFH}"' -DPR='"${PR}"'
|
||||
SEPFLAG=-i
|
||||
DESTDIR=
|
||||
|
||||
@@ -14,14 +14,15 @@
|
||||
all: diff diffh
|
||||
|
||||
diff: ${OBJS}
|
||||
- cc ${CFLAGS} -o diff ${OBJS} ${SEPFLAG} ${LDFLAGS}
|
||||
+ ${CC} ${CFLAGS} -o diff ${OBJS} ${SEPFLAG} ${LDFLAGS}
|
||||
|
||||
diffh: diffh.o
|
||||
- cc -o diffh diffh.o ${SEPFLAG} ${LDFLAGS}
|
||||
+ ${CC} ${CFLAGS} -o diffh diffh.o ${SEPFLAG} ${LDFLAGS}
|
||||
|
||||
clean:
|
||||
rm -f diff diffh ${OBJS} diffh.o
|
||||
|
||||
install: all
|
||||
- install -s diff ${DESTDIR}/bin/diff
|
||||
- install -s diffh ${DESTDIR}/usr/libexec/diffh
|
||||
+ ${BSD_INSTALL_PROGRAM} diff ${DIFF}
|
||||
+ ${BSD_INSTALL_PROGRAM} diffh ${DIFFH}
|
||||
+ ${BSD_INSTALL_MAN} ../../man/man1/diff.1 ${MANPREFIX}/man/man1/2diff.1
|
||||
146
textproc/2bsd-diff/files/patch-diff.1
Normal file
146
textproc/2bsd-diff/files/patch-diff.1
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
--- ../../man/man1/diff.1.orig Tue Oct 22 14:00:30 1996
|
||||
+++ ../../man/man1/diff.1 Wed Mar 19 02:06:08 2003
|
||||
@@ -4,12 +4,12 @@
|
||||
.\"
|
||||
.\" @(#)diff.1 6.4.1 (2.11BSD) 1996/10/21
|
||||
.\"
|
||||
-.TH DIFF 1 "October 21, 1996"
|
||||
+.TH 2DIFF 1 "October 21, 1996"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
-diff \- differential file and directory comparator
|
||||
+2diff \- 2.11BSD differential file and directory comparator
|
||||
.SH SYNOPSIS
|
||||
-.B diff
|
||||
+.B 2diff
|
||||
[
|
||||
.B \-l
|
||||
] [
|
||||
@@ -22,14 +22,14 @@
|
||||
.B \-biwt
|
||||
] dir1 dir2
|
||||
.br
|
||||
-.B diff
|
||||
+.B 2diff
|
||||
[
|
||||
\fB\-cefhn
|
||||
] [
|
||||
\fB\-biwt\fR
|
||||
] file1 file2
|
||||
.br
|
||||
-.B diff
|
||||
+.B 2diff
|
||||
[
|
||||
.BI \-D string
|
||||
] [
|
||||
@@ -38,10 +38,10 @@
|
||||
file1 file2
|
||||
.SH DESCRIPTION
|
||||
If both arguments are directories,
|
||||
-.I diff
|
||||
+.I 2diff
|
||||
sorts the contents of the directories by name, and then runs the
|
||||
regular file
|
||||
-.I diff
|
||||
+.I 2diff
|
||||
algorithm (described below)
|
||||
on text files which are different.
|
||||
Binary files which differ,
|
||||
@@ -51,7 +51,7 @@
|
||||
.TP
|
||||
.B \-l
|
||||
long output format; each text file
|
||||
-.I diff
|
||||
+.I 2diff
|
||||
is piped through
|
||||
.IR pr (1)
|
||||
to paginate it,
|
||||
@@ -60,26 +60,26 @@
|
||||
.TP
|
||||
.B \-r
|
||||
causes application of
|
||||
-.I diff
|
||||
+.I 2diff
|
||||
recursively to common subdirectories encountered.
|
||||
.TP
|
||||
.B \-s
|
||||
causes
|
||||
-.I diff
|
||||
+.I 2diff
|
||||
to report files which are the same, which are otherwise not mentioned.
|
||||
.TP
|
||||
.B \-Sname
|
||||
starts a directory
|
||||
-.I diff
|
||||
+.I 2diff
|
||||
in the middle beginning with file
|
||||
.I name.
|
||||
.PP
|
||||
When run on regular files, and when comparing text files which differ
|
||||
during directory comparison,
|
||||
-.I diff
|
||||
+.I 2diff
|
||||
tells what lines must be changed in the files to bring them into agreement.
|
||||
Except in rare circumstances,
|
||||
-.I diff
|
||||
+.I 2diff
|
||||
finds a smallest sufficient set of file differences.
|
||||
If neither
|
||||
.I file1
|
||||
@@ -163,7 +163,7 @@
|
||||
version-to-version
|
||||
.I ed
|
||||
scripts ($2,$3,...) made by
|
||||
-.I diff
|
||||
+.I 2diff
|
||||
need be on hand.
|
||||
A `latest version' appears on
|
||||
the standard output.
|
||||
@@ -212,7 +212,7 @@
|
||||
file to the other are marked in both files with with `! '.
|
||||
|
||||
Changes which lie within <context> lines of each other are grouped
|
||||
-together on output. (This is a change from the previous ``diff -c''
|
||||
+together on output. (This is a change from the previous ``2diff -c''
|
||||
but the resulting output is usually much easier to interpret.)
|
||||
.TP 9
|
||||
.B \-h
|
||||
@@ -223,7 +223,7 @@
|
||||
.TP
|
||||
.B \-Dstring
|
||||
causes
|
||||
-.I diff
|
||||
+.I 2diff
|
||||
to create a merged version of
|
||||
.I file1
|
||||
and
|
||||
@@ -260,12 +260,12 @@
|
||||
.SH FILES
|
||||
/tmp/d?????
|
||||
.br
|
||||
-/usr/libexec/diffh for
|
||||
+%%PREFIX%%/libexec/2diffh for
|
||||
.B \-h
|
||||
.br
|
||||
-/bin/diff for directory diffs
|
||||
+%%PREFIX%%/bin/2diff for directory diffs
|
||||
.br
|
||||
-/bin/pr
|
||||
+/usr/bin/pr
|
||||
.SH "SEE ALSO"
|
||||
cmp(1), cc(1), comm(1), ed(1), diff3(1)
|
||||
.SH DIAGNOSTICS
|
||||
@@ -279,11 +279,11 @@
|
||||
When comparing directories with the
|
||||
\fB\-b, -w\fP or \fB-i\fP
|
||||
options specified,
|
||||
-.I diff
|
||||
+.I 2diff
|
||||
first compares the files ala
|
||||
.I cmp,
|
||||
and then decides to run the
|
||||
-.I diff
|
||||
+.I 2diff
|
||||
algorithm if they are not equal.
|
||||
This may cause a small amount of spurious output if the files
|
||||
then turn out to be identical because the only differences are
|
||||
22
textproc/2bsd-diff/files/patch-diff.c
Normal file
22
textproc/2bsd-diff/files/patch-diff.c
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
--- diff.c.orig Wed Nov 13 05:31:26 1991
|
||||
+++ diff.c Wed Mar 19 01:31:23 2003
|
||||
@@ -176,9 +176,10 @@
|
||||
return (a > b ? a : b);
|
||||
}
|
||||
|
||||
+sig_t
|
||||
done()
|
||||
{
|
||||
- if (tempfile)
|
||||
+ if (tempfile[0])
|
||||
unlink(tempfile);
|
||||
exit(status);
|
||||
}
|
||||
@@ -198,7 +199,6 @@
|
||||
char *p;
|
||||
{
|
||||
register char *q;
|
||||
- char *realloc();
|
||||
|
||||
if ((q = realloc(p, (unsigned)n)) == NULL)
|
||||
noroom();
|
||||
37
textproc/2bsd-diff/files/patch-diff.h
Normal file
37
textproc/2bsd-diff/files/patch-diff.h
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
--- diff.h.orig Thu Aug 29 06:44:35 1985
|
||||
+++ diff.h Wed Mar 19 01:35:49 2003
|
||||
@@ -5,10 +5,11 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/stat.h>
|
||||
-#include <sys/dir.h>
|
||||
+#include <dirent.h>
|
||||
#include <signal.h>
|
||||
|
||||
/*
|
||||
@@ -61,7 +62,7 @@
|
||||
*/
|
||||
int status;
|
||||
int anychange;
|
||||
-char *tempfile; /* used when comparing against std input */
|
||||
+char tempfile[MAXPATHLEN]; /* used when comparing against std input */
|
||||
|
||||
/*
|
||||
* Variables for diffdir.
|
||||
@@ -77,9 +78,9 @@
|
||||
char *file1, *file2, *efile1, *efile2;
|
||||
struct stat stb1, stb2;
|
||||
|
||||
-char *malloc(), *talloc(), *ralloc();
|
||||
+char *talloc(), *ralloc();
|
||||
char *savestr(), *splice(), *splicen();
|
||||
-char *mktemp(), *copytemp(), *rindex();
|
||||
-int done();
|
||||
+char *copytemp();
|
||||
+sig_t done();
|
||||
|
||||
extern char diffh[], diff[], pr[];
|
||||
11
textproc/2bsd-diff/files/patch-diffdir.c
Normal file
11
textproc/2bsd-diff/files/patch-diffdir.c
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
--- diffdir.c.orig Wed Nov 13 05:31:29 1991
|
||||
+++ diffdir.c Wed Mar 19 01:36:38 2003
|
||||
@@ -172,7 +172,7 @@
|
||||
char *cp;
|
||||
{
|
||||
register struct dir *dp = 0, *ep;
|
||||
- register struct direct *rp;
|
||||
+ register struct dirent *rp;
|
||||
register int nitems, n;
|
||||
DIR *dirp;
|
||||
|
||||
21
textproc/2bsd-diff/files/patch-diffreg.c
Normal file
21
textproc/2bsd-diff/files/patch-diffreg.c
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
--- diffreg.c.orig Tue Jan 11 14:39:33 1994
|
||||
+++ diffreg.c Wed Mar 19 01:38:48 2003
|
||||
@@ -270,12 +270,12 @@
|
||||
char buf[BUFSIZ];
|
||||
register int i, f;
|
||||
|
||||
- signal(SIGHUP,done);
|
||||
- signal(SIGINT,done);
|
||||
- signal(SIGPIPE,done);
|
||||
- signal(SIGTERM,done);
|
||||
- tempfile = mktemp("/tmp/dXXXXX");
|
||||
- f = creat(tempfile,0600);
|
||||
+ signal(SIGHUP, (sig_t) done);
|
||||
+ signal(SIGINT, (sig_t) done);
|
||||
+ signal(SIGPIPE, (sig_t) done);
|
||||
+ signal(SIGTERM, (sig_t) done);
|
||||
+ strcpy(tempfile, "/tmp/dXXXXX");
|
||||
+ f = mkstemp(tempfile);
|
||||
if (f < 0) {
|
||||
fprintf(stderr, "diff: ");
|
||||
perror(tempfile);
|
||||
7
textproc/2bsd-diff/pkg-descr
Normal file
7
textproc/2bsd-diff/pkg-descr
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
This is the original diff program from 2.11BSD. It works better
|
||||
with very large files on systems with datasize limits.
|
||||
|
||||
Default FreeBSD limits datasize to 524288 kbytes. This means that
|
||||
GNU diff processes that require more than this much ram will fail.
|
||||
The 2.11BSD diff did not load the files in core and could operate
|
||||
on considerably less ram.
|
||||
2
textproc/2bsd-diff/pkg-plist
Normal file
2
textproc/2bsd-diff/pkg-plist
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
bin/2diff
|
||||
libexec/2diffh
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
# $FreeBSD$
|
||||
#
|
||||
|
||||
SUBDIR += 2bsd-diff
|
||||
SUBDIR += aft
|
||||
SUBDIR += agrep
|
||||
SUBDIR += align
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue