mirror of
https://git.freebsd.org/ports.git
synced 2025-07-17 01:09:24 -04:00
textproc/2bsd-diff: fix breakage on current
On FreeBSD 13 - current, the build failed with: cc: error: unknown argument: '-i' PR: 234362 Submitted by: risner@stdio.com (maintainer)
This commit is contained in:
parent
b04bb8cf9c
commit
0b62d14c50
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=489572
8 changed files with 662 additions and 28 deletions
|
@ -3,10 +3,10 @@
|
|||
|
||||
PORTNAME= diff
|
||||
PORTVERSION= 2.11
|
||||
PORTREVISION= 0
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= textproc
|
||||
MASTER_SITES= http://www.tribug.org/pub/tuhs/PDP-11/Distributions/ucb/2.11BSD/ \
|
||||
http://www.stdio.com/2.11BSD/
|
||||
http://www.d20hobbies.com/2.11BSD/
|
||||
PKGNAMEPREFIX= 2bsd-
|
||||
DISTNAME= file8
|
||||
|
||||
|
|
|
@ -1,20 +1,26 @@
|
|||
--- ./Makefile.orig 1996-10-22 04:29:46.000000000 +0000
|
||||
+++ ./Makefile 2014-02-17 13:43:18.000000000 +0000
|
||||
@@ -1,9 +1,9 @@
|
||||
--- Makefile.orig 1996-10-22 04:29:46 UTC
|
||||
+++ Makefile
|
||||
@@ -1,10 +1,14 @@
|
||||
# @(#)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}"'
|
||||
-SEPFLAG=-i
|
||||
+DIFF= ${PREFIX}/bin/2diff
|
||||
+DIFFH= ${PREFIX}/libexec/2diffh
|
||||
+PR= /usr/bin/pr
|
||||
+CFLAGS+=-DDIFF='"${DIFF}"' -DDIFFH='"${DIFFH}"' -DPR='"${PR}"'
|
||||
SEPFLAG=-i
|
||||
+# SEPFLAG should be:
|
||||
+# not on a PDP-11: SEPFLAG =
|
||||
+# PDP-11 with separate I&D: SEPFLAG = -i
|
||||
+# PDP-11 without separate I&D: SEPFLAG = -n
|
||||
+SEPFLAG=
|
||||
DESTDIR=
|
||||
|
||||
@@ -14,14 +14,15 @@
|
||||
SRCS= diff.c diffdir.c diffreg.c
|
||||
@@ -14,14 +18,15 @@ OBJS= diff.o diffdir.o diffreg.o
|
||||
all: diff diffh
|
||||
|
||||
diff: ${OBJS}
|
||||
|
|
|
@ -1,6 +1,31 @@
|
|||
--- diff.c.orig Wed Nov 13 05:31:26 1991
|
||||
+++ diff.c Wed Mar 19 01:31:23 2003
|
||||
@@ -176,9 +176,10 @@
|
||||
--- diff.c.orig 1991-11-12 20:31:26 UTC
|
||||
+++ diff.c
|
||||
@@ -11,7 +11,7 @@ char diff[] = DIFF;
|
||||
char diffh[] = DIFFH;
|
||||
char pr[] = PR;
|
||||
|
||||
-main(argc, argv)
|
||||
+int main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
@@ -162,23 +162,24 @@ savestr(cp)
|
||||
return (dp);
|
||||
}
|
||||
|
||||
-min(a,b)
|
||||
+int min(a,b)
|
||||
int a,b;
|
||||
{
|
||||
|
||||
return (a < b ? a : b);
|
||||
}
|
||||
|
||||
-max(a,b)
|
||||
+int max(a,b)
|
||||
int a,b;
|
||||
{
|
||||
|
||||
return (a > b ? a : b);
|
||||
}
|
||||
|
||||
|
@ -12,7 +37,15 @@
|
|||
unlink(tempfile);
|
||||
exit(status);
|
||||
}
|
||||
@@ -198,7 +199,6 @@
|
||||
@@ -191,6 +192,7 @@ talloc(n)
|
||||
if ((p = malloc((unsigned)n)) != NULL)
|
||||
return(p);
|
||||
noroom();
|
||||
+ return NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
@@ -198,14 +200,13 @@ ralloc(p,n)
|
||||
char *p;
|
||||
{
|
||||
register char *q;
|
||||
|
@ -20,3 +53,11 @@
|
|||
|
||||
if ((q = realloc(p, (unsigned)n)) == NULL)
|
||||
noroom();
|
||||
return(q);
|
||||
}
|
||||
|
||||
-noroom()
|
||||
+void noroom()
|
||||
{
|
||||
fprintf(stderr, "diff: files too big, try -h\n");
|
||||
done();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- diff.h.orig Thu Aug 29 06:44:35 1985
|
||||
+++ diff.h Wed Mar 19 01:35:49 2003
|
||||
@@ -5,10 +5,11 @@
|
||||
--- diff.h.orig 1985-08-28 21:44:35 UTC
|
||||
+++ diff.h
|
||||
@@ -5,11 +5,17 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -11,9 +11,15 @@
|
|||
-#include <sys/dir.h>
|
||||
+#include <dirent.h>
|
||||
#include <signal.h>
|
||||
+#include <string.h>
|
||||
+#include <unistd.h>
|
||||
+#include <fcntl.h>
|
||||
+#include <sys/wait.h>
|
||||
+#include <arpa/inet.h>
|
||||
|
||||
/*
|
||||
@@ -61,7 +62,7 @@
|
||||
* Output format options
|
||||
@@ -61,7 +67,7 @@ int context; /* lines of context to be printed */
|
||||
*/
|
||||
int status;
|
||||
int anychange;
|
||||
|
@ -22,7 +28,7 @@
|
|||
|
||||
/*
|
||||
* Variables for diffdir.
|
||||
@@ -77,9 +78,9 @@
|
||||
@@ -77,9 +83,20 @@ char **diffargv; /* option list to pass to recursive
|
||||
char *file1, *file2, *efile1, *efile2;
|
||||
struct stat stb1, stb2;
|
||||
|
||||
|
@ -35,3 +41,14 @@
|
|||
+sig_t done();
|
||||
|
||||
extern char diffh[], diff[], pr[];
|
||||
+
|
||||
+/* declarations */
|
||||
+void diffdir(char **argv);
|
||||
+void diffreg();
|
||||
+void noroom();
|
||||
+void setfile(char **fpp, char **epp, char *file);
|
||||
+int useless(register char *cp);
|
||||
+int min(int, int);
|
||||
+int max(int, int);
|
||||
+void prune();
|
||||
+int skipline(int);
|
||||
|
|
|
@ -1,6 +1,61 @@
|
|||
--- diffdir.c.orig Wed Nov 13 05:31:29 1991
|
||||
+++ diffdir.c Wed Mar 19 01:36:38 2003
|
||||
@@ -172,7 +172,7 @@
|
||||
--- diffdir.c.orig 1991-11-12 20:31:29 UTC
|
||||
+++ diffdir.c
|
||||
@@ -24,7 +24,15 @@ struct dir *setupdir();
|
||||
int header;
|
||||
char title[2*BUFSIZ], *etitle;
|
||||
|
||||
-diffdir(argv)
|
||||
+/* declarations */
|
||||
+void only(struct dir *, int);
|
||||
+void compare(register struct dir *);
|
||||
+void scanpr(register struct dir *, int, char *, char *, char *, char *, char *);
|
||||
+void calldiff(char *);
|
||||
+int ascii(int);
|
||||
+int entcmp(const void *, const void *);
|
||||
+
|
||||
+void diffdir(argv)
|
||||
char **argv;
|
||||
{
|
||||
register struct dir *d1, *d2;
|
||||
@@ -112,7 +120,7 @@ diffdir(argv)
|
||||
}
|
||||
}
|
||||
|
||||
-setfile(fpp, epp, file)
|
||||
+void setfile(fpp, epp, file)
|
||||
char **fpp, **epp;
|
||||
char *file;
|
||||
{
|
||||
@@ -130,7 +138,7 @@ setfile(fpp, epp, file)
|
||||
*epp = cp;
|
||||
}
|
||||
|
||||
-scanpr(dp, test, title, file1, efile1, file2, efile2)
|
||||
+void scanpr(dp, test, title, file1, efile1, file2, efile2)
|
||||
register struct dir *dp;
|
||||
int test;
|
||||
char *title, *file1, *efile1, *file2, *efile2;
|
||||
@@ -155,24 +163,23 @@ scanpr(dp, test, title, file1, efile1, file2, efile2)
|
||||
}
|
||||
}
|
||||
|
||||
-only(dp, which)
|
||||
+void only(dp, which)
|
||||
struct dir *dp;
|
||||
int which;
|
||||
{
|
||||
char *file = which == 1 ? file1 : file2;
|
||||
char *efile = which == 1 ? efile1 : efile2;
|
||||
|
||||
- printf("Only in %.*s: %s\n", efile - file - 1, file, dp->d_entry);
|
||||
+ printf("Only in %.*s: %s\n", (int)(efile - file - 1),
|
||||
+ file, dp->d_entry);
|
||||
}
|
||||
|
||||
-int entcmp();
|
||||
-
|
||||
struct dir *
|
||||
setupdir(cp)
|
||||
char *cp;
|
||||
{
|
||||
register struct dir *dp = 0, *ep;
|
||||
|
@ -9,3 +64,57 @@
|
|||
register int nitems, n;
|
||||
DIR *dirp;
|
||||
|
||||
@@ -196,7 +203,7 @@ setupdir(cp)
|
||||
fprintf(stderr, "diff: ran out of memory\n");
|
||||
done();
|
||||
}
|
||||
- while (rp = readdir(dirp)) {
|
||||
+ while ((rp = readdir(dirp))) {
|
||||
ep = &dp[nitems++];
|
||||
ep->d_reclen = rp->d_reclen;
|
||||
ep->d_namlen = rp->d_namlen;
|
||||
@@ -225,13 +232,13 @@ setupdir(cp)
|
||||
return (dp);
|
||||
}
|
||||
|
||||
-entcmp(d1, d2)
|
||||
- struct dir *d1, *d2;
|
||||
+int entcmp(d1, d2)
|
||||
+ const void *d1, *d2;
|
||||
{
|
||||
- return (strcmp(d1->d_entry, d2->d_entry));
|
||||
+ return strcmp(((struct dir *)d1)->d_entry, ((struct dir *)d2)->d_entry);
|
||||
}
|
||||
|
||||
-compare(dp)
|
||||
+void compare(dp)
|
||||
register struct dir *dp;
|
||||
{
|
||||
register int i, j;
|
||||
@@ -323,7 +330,7 @@ closem:
|
||||
|
||||
char *prargs[] = { "pr", "-h", 0, "-f", 0, 0 };
|
||||
|
||||
-calldiff(wantpr)
|
||||
+void calldiff(wantpr)
|
||||
char *wantpr;
|
||||
{
|
||||
int pid, status, status2, pv[2];
|
||||
@@ -382,7 +389,7 @@ calldiff(wantpr)
|
||||
|
||||
#include <a.out.h>
|
||||
|
||||
-ascii(f)
|
||||
+int ascii(f)
|
||||
int f;
|
||||
{
|
||||
char buf[BUFSIZ];
|
||||
@@ -407,7 +414,7 @@ ascii(f)
|
||||
/*
|
||||
* THIS IS CRUDE.
|
||||
*/
|
||||
-useless(cp)
|
||||
+int useless(cp)
|
||||
register char *cp;
|
||||
{
|
||||
|
||||
|
|
184
textproc/2bsd-diff/files/patch-diffh.c
Normal file
184
textproc/2bsd-diff/files/patch-diffh.c
Normal file
|
@ -0,0 +1,184 @@
|
|||
--- diffh.c.orig 1991-11-12 20:31:33 UTC
|
||||
+++ diffh.c
|
||||
@@ -6,6 +6,7 @@ static char sccsid[] = "@(#)diffh.c 4.4 11/27/85";
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
+#include <stdlib.h>
|
||||
|
||||
#define C 3
|
||||
#define RANGE 30
|
||||
@@ -20,13 +21,24 @@ int bflag;
|
||||
int debug = 0;
|
||||
FILE *file[2];
|
||||
|
||||
+/* declarations */
|
||||
+void error(char *, char *);
|
||||
+char cmp(char *, char *);
|
||||
+void range(long, int);
|
||||
+void change(long, int, long, int, char *);
|
||||
+int output(int, int);
|
||||
+void progerr(char *);
|
||||
+int hardsynch();
|
||||
+int easysynch();
|
||||
+void movstr(char *, char *t);
|
||||
+void clrl(int, long);
|
||||
+
|
||||
/* return pointer to line n of file f*/
|
||||
char *getl(f,n)
|
||||
long n;
|
||||
{
|
||||
register char *t;
|
||||
- char *malloc();
|
||||
- register delta, nt;
|
||||
+ register int delta, nt;
|
||||
again:
|
||||
delta = n - lineno[f];
|
||||
nt = ntext[f];
|
||||
@@ -43,11 +55,12 @@ again:
|
||||
t = text[f][nt];
|
||||
if(t==0) {
|
||||
t = text[f][nt] = malloc(LEN+1);
|
||||
- if(t==NULL)
|
||||
+ if(t==NULL) {
|
||||
if(hardsynch())
|
||||
goto again;
|
||||
else
|
||||
progerr("5");
|
||||
+ }
|
||||
}
|
||||
t = fgets(t,LEN,file[f]);
|
||||
if(t!=NULL)
|
||||
@@ -56,10 +69,10 @@ again:
|
||||
}
|
||||
|
||||
/*remove thru line n of file f from storage*/
|
||||
-clrl(f,n)
|
||||
+void clrl(f,n)
|
||||
long n;
|
||||
{
|
||||
- register i,j;
|
||||
+ register int i,j;
|
||||
j = n-lineno[f]+1;
|
||||
for(i=0;i+j<ntext[f];i++)
|
||||
movstr(text[f][i+j],text[f][i]);
|
||||
@@ -67,14 +80,14 @@ long n;
|
||||
ntext[f] -= j;
|
||||
}
|
||||
|
||||
-movstr(s,t)
|
||||
+void movstr(s,t)
|
||||
register char *s, *t;
|
||||
{
|
||||
- while(*t++= *s++)
|
||||
+ while((*t++= *s++))
|
||||
continue;
|
||||
}
|
||||
|
||||
-main(argc,argv)
|
||||
+int main(argc,argv)
|
||||
char **argv;
|
||||
{
|
||||
char *s0,*s1;
|
||||
@@ -116,10 +129,10 @@ char **argv;
|
||||
}
|
||||
|
||||
/* synch on C successive matches*/
|
||||
-easysynch()
|
||||
+int easysynch()
|
||||
{
|
||||
int i,j;
|
||||
- register k,m;
|
||||
+ register int k,m;
|
||||
char *s0,*s1;
|
||||
for(i=j=1;i<RANGE&&j<RANGE;i++,j++) {
|
||||
s0 = getl(0,n0+i);
|
||||
@@ -148,9 +161,9 @@ cont2: ;
|
||||
return(0);
|
||||
}
|
||||
|
||||
-output(a,b)
|
||||
+int output(a,b)
|
||||
{
|
||||
- register i;
|
||||
+ register int i;
|
||||
char *s;
|
||||
if(a<0)
|
||||
change(n0-1,0,n1,b,"a");
|
||||
@@ -179,7 +192,7 @@ output(a,b)
|
||||
return(1);
|
||||
}
|
||||
|
||||
-change(a,b,c,d,s)
|
||||
+void change(a,b,c,d,s)
|
||||
long a,c;
|
||||
char *s;
|
||||
{
|
||||
@@ -189,7 +202,7 @@ char *s;
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
-range(a,b)
|
||||
+void range(a,b)
|
||||
long a;
|
||||
{
|
||||
if(b==INF)
|
||||
@@ -200,7 +213,7 @@ long a;
|
||||
printf("%ld,%ld",a,a+b);
|
||||
}
|
||||
|
||||
-cmp(s,t)
|
||||
+char cmp(s,t)
|
||||
char *s,*t;
|
||||
{
|
||||
if(debug)
|
||||
@@ -224,20 +237,21 @@ char *f1,*f2;
|
||||
FILE *f;
|
||||
char b[100],*bptr,*eptr;
|
||||
struct stat statbuf;
|
||||
- if(cmp(f1,"-")==0)
|
||||
+ if(cmp(f1,"-")==0) {
|
||||
if(cmp(f2,"-")==0)
|
||||
error("can't do - -","");
|
||||
else
|
||||
return(stdin);
|
||||
+ }
|
||||
if(stat(f1,&statbuf)==-1)
|
||||
error("can't access ",f1);
|
||||
if((statbuf.st_mode&S_IFMT)==S_IFDIR) {
|
||||
- for(bptr=b;*bptr= *f1++;bptr++) ;
|
||||
+ for(bptr=b;(*bptr= *f1++);bptr++) ;
|
||||
*bptr++ = '/';
|
||||
for(eptr=f2;*eptr;eptr++)
|
||||
if(*eptr=='/'&&eptr[1]!=0&&eptr[1]!='/')
|
||||
f2 = eptr+1;
|
||||
- while(*bptr++= *f2++) ;
|
||||
+ while((*bptr++= *f2++)) ;
|
||||
f1 = b;
|
||||
}
|
||||
f = fopen(f1,"r");
|
||||
@@ -247,13 +261,13 @@ char *f1,*f2;
|
||||
}
|
||||
|
||||
|
||||
-progerr(s)
|
||||
+void progerr(s)
|
||||
char *s;
|
||||
{
|
||||
error("program error ",s);
|
||||
}
|
||||
|
||||
-error(s,t)
|
||||
+void error(s,t)
|
||||
char *s,*t;
|
||||
{
|
||||
fprintf(stderr,"diffh: %s%s\n",s,t);
|
||||
@@ -261,7 +275,7 @@ char *s,*t;
|
||||
}
|
||||
|
||||
/*stub for resychronization beyond limits of text buf*/
|
||||
-hardsynch()
|
||||
+int hardsynch()
|
||||
{
|
||||
change(n0,INF,n1,INF,"c");
|
||||
printf("---change record omitted\n");
|
|
@ -1,6 +1,41 @@
|
|||
--- diffreg.c.orig Tue Jan 11 14:39:33 1994
|
||||
+++ diffreg.c Wed Mar 19 01:38:48 2003
|
||||
@@ -270,12 +270,12 @@
|
||||
--- diffreg.c.orig 1994-01-11 05:39:33 UTC
|
||||
+++ diffreg.c
|
||||
@@ -84,6 +84,25 @@ struct line {
|
||||
int serial;
|
||||
int value;
|
||||
} *file[2], line;
|
||||
+
|
||||
+/* declarations */
|
||||
+void equiv(struct line *, int, struct line *, int, int *);
|
||||
+int asciifile(FILE *);
|
||||
+void prepare(int, FILE *);
|
||||
+void sort(struct line *, int);
|
||||
+void unsort(struct line *, int, int *);
|
||||
+void unravel(int);
|
||||
+void check();
|
||||
+void output();
|
||||
+int stone(int *, int, int *, register int *);
|
||||
+int readhash(FILE *);
|
||||
+int newcand(int, int, int);
|
||||
+int search(int *, int, int);
|
||||
+void change(int, int, int, int);
|
||||
+void dump_context_vec();
|
||||
+void range(int, int, char *);
|
||||
+void fetch(long *, int, int, FILE *, char *, int);
|
||||
+
|
||||
int len[2];
|
||||
struct line *sfile[2]; /* shortened by pruning common prefix and suffix */
|
||||
int slen[2];
|
||||
@@ -140,7 +159,7 @@ char cup2low[256] = {
|
||||
0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff
|
||||
};
|
||||
|
||||
-diffreg()
|
||||
+void diffreg()
|
||||
{
|
||||
register int i, j;
|
||||
FILE *f1, *f2;
|
||||
@@ -270,12 +289,12 @@ copytemp()
|
||||
char buf[BUFSIZ];
|
||||
register int i, f;
|
||||
|
||||
|
@ -19,3 +54,247 @@
|
|||
if (f < 0) {
|
||||
fprintf(stderr, "diff: ");
|
||||
perror(tempfile);
|
||||
@@ -311,16 +330,16 @@ splice(dir, file)
|
||||
return (savestr(buf));
|
||||
}
|
||||
|
||||
-prepare(i, fd)
|
||||
+void prepare(i, fd)
|
||||
int i;
|
||||
FILE *fd;
|
||||
{
|
||||
register struct line *p;
|
||||
- register j,h;
|
||||
+ register int j,h;
|
||||
|
||||
fseek(fd, (long)0, 0);
|
||||
p = (struct line *)talloc(3*sizeof(line));
|
||||
- for(j=0; h=readhash(fd);) {
|
||||
+ for(j=0; (h=readhash(fd));) {
|
||||
p = (struct line *)ralloc((char *)p,(++j+3)*sizeof(line));
|
||||
p[j].value = h;
|
||||
}
|
||||
@@ -328,9 +347,9 @@ prepare(i, fd)
|
||||
file[i] = p;
|
||||
}
|
||||
|
||||
-prune()
|
||||
+void prune()
|
||||
{
|
||||
- register i,j;
|
||||
+ register int i,j;
|
||||
for(pref=0;pref<len[0]&&pref<len[1]&&
|
||||
file[0][pref+1].value==file[1][pref+1].value;
|
||||
pref++ ) ;
|
||||
@@ -345,7 +364,7 @@ prune()
|
||||
}
|
||||
}
|
||||
|
||||
-equiv(a,n,b,m,c)
|
||||
+void equiv(a,n,b,m,c)
|
||||
struct line *a, *b;
|
||||
int *c;
|
||||
{
|
||||
@@ -373,7 +392,7 @@ int *c;
|
||||
c[j] = -1;
|
||||
}
|
||||
|
||||
-stone(a,n,b,c)
|
||||
+int stone(a,n,b,c)
|
||||
int *a;
|
||||
int *b;
|
||||
register int *c;
|
||||
@@ -414,7 +433,7 @@ register int *c;
|
||||
return(k);
|
||||
}
|
||||
|
||||
-newcand(x,y,pred)
|
||||
+int newcand(x,y,pred)
|
||||
{
|
||||
register struct cand *q;
|
||||
clist = (struct cand *)ralloc((char *)clist,++clen*sizeof(cand));
|
||||
@@ -425,7 +444,7 @@ newcand(x,y,pred)
|
||||
return(clen-1);
|
||||
}
|
||||
|
||||
-search(c, k, y)
|
||||
+int search(c, k, y)
|
||||
int *c;
|
||||
{
|
||||
register int i, j, l;
|
||||
@@ -449,7 +468,7 @@ int *c;
|
||||
return(l+1);
|
||||
}
|
||||
|
||||
-unravel(p)
|
||||
+void unravel(p)
|
||||
{
|
||||
register int i;
|
||||
register struct cand *q;
|
||||
@@ -466,7 +485,7 @@ unravel(p)
|
||||
to confounding by hashing (which result in "jackpot")
|
||||
2. collect random access indexes to the two files */
|
||||
|
||||
-check()
|
||||
+void check()
|
||||
{
|
||||
register int i, j;
|
||||
int jackpot;
|
||||
@@ -565,7 +584,7 @@ check()
|
||||
*/
|
||||
}
|
||||
|
||||
-sort(a,n) /*shellsort CACM #201*/
|
||||
+void sort(a,n) /*shellsort CACM #201*/
|
||||
struct line *a;
|
||||
{
|
||||
struct line w;
|
||||
@@ -586,8 +605,8 @@ struct line *a;
|
||||
if(aim < ai)
|
||||
break; /*wraparound*/
|
||||
if(aim->value > ai[0].value ||
|
||||
- aim->value == ai[0].value &&
|
||||
- aim->serial > ai[0].serial)
|
||||
+ (aim->value == ai[0].value &&
|
||||
+ aim->serial > ai[0].serial))
|
||||
break;
|
||||
w.value = ai[0].value;
|
||||
ai[0].value = aim->value;
|
||||
@@ -600,7 +619,7 @@ struct line *a;
|
||||
}
|
||||
}
|
||||
|
||||
-unsort(f, l, b)
|
||||
+void unsort(f, l, b)
|
||||
struct line *f;
|
||||
int *b;
|
||||
{
|
||||
@@ -614,9 +633,9 @@ int *b;
|
||||
free((char *)a);
|
||||
}
|
||||
|
||||
-skipline(f)
|
||||
+int skipline(f)
|
||||
{
|
||||
- register i, c;
|
||||
+ register int i, c;
|
||||
|
||||
for(i=1;(c=getc(input[f]))!='\n';i++)
|
||||
if (c < 0)
|
||||
@@ -624,7 +643,7 @@ skipline(f)
|
||||
return(i);
|
||||
}
|
||||
|
||||
-output()
|
||||
+void output()
|
||||
{
|
||||
int m;
|
||||
register int i0, i1, j1;
|
||||
@@ -691,7 +710,7 @@ struct context_vec *context_vec_start,
|
||||
and this means that there were lines appended (beginning at b).
|
||||
If c is greater than d then there are lines missing from the to file.
|
||||
*/
|
||||
-change(a,b,c,d)
|
||||
+void change(a,b,c,d)
|
||||
{
|
||||
int ch;
|
||||
int lowa,upb,lowc,upd;
|
||||
@@ -781,7 +800,7 @@ change(a,b,c,d)
|
||||
}
|
||||
}
|
||||
|
||||
-range(a,b,separator)
|
||||
+void range(a,b,separator)
|
||||
char *separator;
|
||||
{
|
||||
printf("%d", a>b?b:a);
|
||||
@@ -790,7 +809,7 @@ char *separator;
|
||||
}
|
||||
}
|
||||
|
||||
-fetch(f,a,b,lb,s,oldfile)
|
||||
+void fetch(f,a,b,lb,s,oldfile)
|
||||
long *f;
|
||||
FILE *lb;
|
||||
char *s;
|
||||
@@ -869,13 +888,13 @@ char *s;
|
||||
* arranging line in 7-bit bytes and then
|
||||
* summing 1-s complement in 16-bit hunks
|
||||
*/
|
||||
-readhash(f)
|
||||
+int readhash(f)
|
||||
register FILE *f;
|
||||
{
|
||||
register long sum;
|
||||
register unsigned shift;
|
||||
- register t;
|
||||
- register space;
|
||||
+ register int t;
|
||||
+ register int space;
|
||||
|
||||
sum = 1;
|
||||
space = 0;
|
||||
@@ -931,12 +950,12 @@ register FILE *f;
|
||||
}
|
||||
}
|
||||
sum = low(sum) + high(sum);
|
||||
- return((short)low(sum) + (short)high(sum));
|
||||
+ return((int)low(sum) + (int)high(sum));
|
||||
}
|
||||
|
||||
#include <a.out.h>
|
||||
|
||||
-asciifile(f)
|
||||
+int asciifile(f)
|
||||
FILE *f;
|
||||
{
|
||||
char buf[BUFSIZ];
|
||||
@@ -960,7 +979,7 @@ asciifile(f)
|
||||
|
||||
|
||||
/* dump accumulated "context" diff changes */
|
||||
-dump_context_vec()
|
||||
+void dump_context_vec()
|
||||
{
|
||||
register int a, b, c, d;
|
||||
register char ch;
|
||||
@@ -1003,15 +1022,15 @@ dump_context_vec()
|
||||
ch = (a <= b) ? 'd' : 'a';
|
||||
|
||||
if (ch == 'a')
|
||||
- fetch(ixold,lowa,b,input[0]," ");
|
||||
+ fetch(ixold,lowa,b,input[0]," ", 0);
|
||||
else {
|
||||
- fetch(ixold,lowa,a-1,input[0]," ");
|
||||
- fetch(ixold,a,b,input[0],ch == 'c' ? "! " : "- ");
|
||||
+ fetch(ixold,lowa,a-1,input[0]," ", 0);
|
||||
+ fetch(ixold,a,b,input[0],ch == 'c' ? "! " : "- ", 0);
|
||||
}
|
||||
lowa = b + 1;
|
||||
cvp++;
|
||||
}
|
||||
- fetch(ixold, b+1, upb, input[0], " ");
|
||||
+ fetch(ixold, b+1, upb, input[0], " ", 0);
|
||||
}
|
||||
|
||||
/* output changes to the "new" file */
|
||||
@@ -1037,15 +1056,15 @@ dump_context_vec()
|
||||
ch = (a <= b) ? 'd' : 'a';
|
||||
|
||||
if (ch == 'd')
|
||||
- fetch(ixnew,lowc,d,input[1]," ");
|
||||
+ fetch(ixnew,lowc,d,input[1]," ", 0);
|
||||
else {
|
||||
- fetch(ixnew,lowc,c-1,input[1]," ");
|
||||
- fetch(ixnew,c,d,input[1],ch == 'c' ? "! " : "+ ");
|
||||
+ fetch(ixnew,lowc,c-1,input[1]," ", 0);
|
||||
+ fetch(ixnew,c,d,input[1],ch == 'c' ? "! " : "+ ", 0);
|
||||
}
|
||||
lowc = d + 1;
|
||||
cvp++;
|
||||
}
|
||||
- fetch(ixnew, d+1, upd, input[1], " ");
|
||||
+ fetch(ixnew, d+1, upd, input[1], " ", 0);
|
||||
}
|
||||
|
||||
context_vec_ptr = context_vec_start - 1;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
This is the original diff program from 2.11BSD. It works better
|
||||
with very large files on systems with datasize limits.
|
||||
2.11BSD's original diff works significantly better with very large
|
||||
files with default 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.
|
||||
GNU diff fails with out of memmory when operating on files at or
|
||||
above the default limit to datasize.
|
||||
|
|
Loading…
Add table
Reference in a new issue