+/*#include <ctype.h> gen.h*/
+#include <gen.h>
+#include <stdio.h>
+/*#include <strings.h> gen.h*/
+/*#include <sys/errno.h> gen.h*/
+#include <sys/file.h>
+/*#include <sys/stat.h> diff.h*/
+#include "diff.h"
+
+#if defined(DOSCCS) && !defined(lint)
static char sccsid[] = "@(#)diff.c 4.6 4/3/86";
+#endif
-#include "diff.h"
+/*#include "diff.h"*/
/*
* diff - driver and subroutines
*/
char diffh[] = DIFFH;
char pr[] = PR;
-main(argc, argv)
- int argc;
- char **argv;
-{
+int main(argc, argv) int argc; char **argv; {
register char *argp;
ifdef1 = "FILE1"; ifdef2 = "FILE2";
done();
}
-char *
-savestr(cp)
- register char *cp;
-{
+char *savestr(cp) register char *cp; {
register char *dp = malloc(strlen(cp)+1);
if (dp == 0) {
return (dp);
}
-min(a,b)
- int a,b;
-{
+int min(a, b) int a; int b; {
return (a < b ? a : b);
}
-max(a,b)
- int a,b;
-{
+int max(a, b) int a; int b; {
return (a > b ? a : b);
}
-done()
-{
+int done() {
if (tempfile)
unlink(tempfile);
exit(status);
}
-char *
-talloc(n)
-{
+char *talloc(n) int n; {
register char *p;
if ((p = malloc((unsigned)n)) != NULL)
noroom();
}
-char *
-ralloc(p,n)
-char *p;
-{
+char *ralloc(p, n) char *p; int n; {
register char *q;
void *realloc();
return(q);
}
-noroom()
-{
+int noroom() {
fprintf(stderr, "diff: files too big, try -h\n");
done();
}
+#ifndef _DIFF_H_
+#define _DIFF_H_
+
+#include <sys/stat.h>
+
/* diff.h 4.7 85/08/16 */
/*
* diff - common declarations
*/
-#include <stdio.h>
-#include <ctype.h>
-#include <sys/param.h>
-#include <sys/stat.h>
-#include <sys/dir.h>
-#include <signal.h>
+/*#include <stdio.h>*/
+/*#include <ctype.h>*/
+/*#include <sys/param.h>*/
+/*#include <sys/stat.h>*/
+/*#include <sys/dir.h>*/
+/*#include <signal.h>*/
/*
* Output format options
extern char *file1, *file2, *efile1, *efile2;
extern struct stat stb1, stb2;
-char *malloc(), *talloc(), *ralloc();
-char *savestr(), *splice(), *splicen();
-char *mktemp(), *copytemp(), *rindex();
-int done();
+/*char *malloc(), *talloc(), *ralloc();*/
+/*char *savestr(), *splice(), *splicen();*/
+/*char *mktemp(), *copytemp(), *rindex();*/
+/*int done();*/
extern char diffh[], diff[], pr[];
+
+#ifndef __P
+#ifdef __STDC__
+#define __P(args) args
+#else
+#define __P(args) ()
+#endif
+#endif
+
+/* diff.c */
+int main __P((int argc, char **argv));
+char *savestr __P((register char *cp));
+int min __P((int a, int b));
+int max __P((int a, int b));
+int done __P((void));
+char *talloc __P((int n));
+char *ralloc __P((char *p, int n));
+int noroom __P((void));
+
+/* diffdir.c */
+int diffdir __P((char **argv));
+
+/* diffreg.c */
+int diffreg __P((void));
+
+#endif
+/*#include <a.out.h> gen.h*/
+#include <gen.h>
+#include <stdio.h>
+/*#include <strings.h> gen.h*/
+/*#include <sys/dir.h> gen.h*/
+/*#include <sys/errno.h> gen.h*/
+/*#include <sys/exec.h> a.out.h*/
+#include <sys/file.h>
+/*#include <sys/proc.h> gen.h*/
+/*#include <sys/stat.h> diff.h*/
+/*#include <sys/types.h> diff.h*/
+#include <sys/wait.h>
+#include "diff.h"
+
+#if defined(DOSCCS) && !defined(lint)
static char *sccsid = "@(#)diffdir.c 4.9 (Berkeley) 8/28/84";
+#endif
-#include "diff.h"
+/*#include "diff.h"*/
/*
* diff - directory comparison
*/
char *d_entry;
};
-struct dir *setupdir();
+/*struct dir *setupdir();*/
int header;
char title[2*BUFSIZ], *etitle;
-diffdir(argv)
- char **argv;
-{
+static setfile __P((char **fpp, char **epp, char *file));
+static scanpr __P((register struct dir *dp, int test, char *title, char *file1, char *efile1, char *file2, char *efile2));
+static only __P((struct dir *dp, int which));
+static struct dir *setupdir __P((char *cp));
+static entcmp __P((struct dir *d1, struct dir *d2));
+static compare __P((register struct dir *dp));
+static calldiff __P((char *wantpr));
+static ascii __P((int f));
+static useless __P((register char *cp));
+
+int diffdir(argv) char **argv; {
register struct dir *d1, *d2;
struct dir *dir1, *dir2;
register int i;
}
}
-static
-setfile(fpp, epp, file)
- char **fpp, **epp;
- char *file;
-{
+static setfile(fpp, epp, file) char **fpp; char **epp; char *file; {
register char *cp;
*fpp = malloc(BUFSIZ);
*epp = cp;
}
-static
-scanpr(dp, test, title, file1, efile1, file2, efile2)
- register struct dir *dp;
- int test;
- char *title, *file1, *efile1, *file2, *efile2;
-{
+static scanpr(dp, test, title, file1, efile1, file2, efile2) register struct dir *dp; int test; char *title; char *file1; char *efile1; char *file2; char *efile2; {
int titled = 0;
for (; dp->d_entry; dp++) {
}
}
-static
-only(dp, which)
- struct dir *dp;
- int which;
-{
+static 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);
}
-static int entcmp();
+/*static int entcmp();*/
-static struct dir *
-setupdir(cp)
- char *cp;
-{
+static struct dir *setupdir(cp) char *cp; {
register struct dir *dp = 0, *ep;
register struct direct *rp;
register int nitems, n;
return (dp);
}
-static
-entcmp(d1, d2)
- struct dir *d1, *d2;
-{
+static entcmp(d1, d2) struct dir *d1; struct dir *d2; {
return (strcmp(d1->d_entry, d2->d_entry));
}
-static
-compare(dp)
- register struct dir *dp;
-{
+static compare(dp) register struct dir *dp; {
register int i, j;
int f1, f2, fmt1, fmt2;
struct stat stb1, stb2;
static char *prargs[] = { "pr", "-h", 0, "-f", 0, 0 };
-static
-calldiff(wantpr)
- char *wantpr;
-{
+static calldiff(wantpr) char *wantpr; {
int pid, status, status2, pv[2];
prargs[2] = wantpr;
*/
}
-#include <a.out.h>
+/*#include <a.out.h>*/
-static
-ascii(f)
- int f;
-{
+static ascii(f) int f; {
char buf[BUFSIZ];
register int cnt;
register char *cp;
/*
* THIS IS CRUDE.
*/
-static
-useless(cp)
-register char *cp;
-{
+static useless(cp) register char *cp; {
if (cp[0] == '.') {
if (cp[1] == '\0')
+/*#include <ctype.h> gen.h*/
+#include <gen.h>
+#include <stdio.h>
+/*#include <sys/stat.h> diff.h*/
+#include "diff.h"
+
+#if defined(DOSCCS) && !defined(lint)
static char sccsid[] = "@(#)diffh.c 4.4 11/27/85";
+#endif
-#include <stdio.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+/*#include <stdio.h>*/
+/*#include <ctype.h>*/
+/*#include <sys/types.h>*/
+/*#include <sys/stat.h>*/
#define C 3
#define RANGE 30
FILE *file[2];
/* return pointer to line n of file f*/
-char *getl(f,n)
-long n;
-{
+#ifndef __P
+#ifdef __STDC__
+#define __P(args) args
+#else
+#define __P(args) ()
+#endif
+#endif
+
+char *getl __P((int f, long n));
+int clrl __P((int f, long n));
+int movstr __P((register char *s, register char *t));
+int main __P((int argc, char **argv));
+int easysynch __P((void));
+int output __P((int a, int b));
+int change __P((long a, int b, long c, int d, char *s));
+int range __P((long a, int b));
+int cmp __P((char *s, char *t));
+FILE *dopen __P((char *f1, char *f2));
+int progerr __P((char *s));
+int error __P((char *s, char *t));
+int hardsynch __P((void));
+
+char *getl(f, n) int f; long n; {
register char *t;
void *malloc();
register delta, nt;
}
/*remove thru line n of file f from storage*/
-clrl(f,n)
-long n;
-{
+int clrl(f, n) int f; long n; {
register i,j;
j = n-lineno[f]+1;
for(i=0;i+j<ntext[f];i++)
ntext[f] -= j;
}
-movstr(s,t)
-register char *s, *t;
-{
+int movstr(s, t) register char *s; register char *t; {
while(*t++= *s++)
continue;
}
-main(argc,argv)
-char **argv;
-{
+int main(argc, argv) int argc; char **argv; {
char *s0,*s1;
FILE *dopen();
register int status = 0;
}
/* synch on C successive matches*/
-easysynch()
-{
+int easysynch() {
int i,j;
register k,m;
char *s0,*s1;
return(0);
}
-output(a,b)
-{
+int output(a, b) int a; int b; {
register i;
char *s;
if(a<0)
return(1);
}
-change(a,b,c,d,s)
-long a,c;
-char *s;
-{
+int change(a, b, c, d, s) long a; int b; long c; int d; char *s; {
range(a,b);
printf("%s",s);
range(c,d);
printf("\n");
}
-range(a,b)
-long a;
-{
+int range(a, b) long a; int b; {
if(b==INF)
printf("%ld,$",a);
else if(b==0)
printf("%ld,%ld",a,a+b);
}
-cmp(s,t)
-char *s,*t;
-{
+int cmp(s, t) char *s; char *t; {
if(debug)
printf("%s:%s\n",s,t);
for(;;){
return(*s-*t);
}
-FILE *dopen(f1,f2)
-char *f1,*f2;
-{
+FILE *dopen(f1, f2) char *f1; char *f2; {
FILE *f;
char b[100],*bptr,*eptr;
struct stat statbuf;
return(f);
}
-
-progerr(s)
-char *s;
-{
+int progerr(s) char *s; {
error("program error ",s);
}
-error(s,t)
-char *s,*t;
-{
+int error(s, t) char *s; char *t; {
fprintf(stderr,"diffh: %s%s\n",s,t);
exit(2);
}
/*stub for resychronization beyond limits of text buf*/
-hardsynch()
-{
+int hardsynch() {
change(n0,INF,n1,INF,"c");
printf("---change record omitted\n");
error("can't resynchronize","");
+/*#include <a.out.h> gen.h*/
+/*#include <ctype.h> gen.h*/
+#include <gen.h>
+#include <stdio.h>
+/*#include <strings.h> gen.h*/
+/*#include <sys/errno.h> gen.h*/
+/*#include <sys/exec.h> a.out.h*/
+#include <sys/file.h>
+/*#include <sys/signal.h> gen.h*/
+/*#include <sys/stat.h> diff.h*/
+/*#include <time.h> gen.h*/
+#include "diff.h"
+
+#if defined(DOSCCS) && !defined(lint)
static char sccsid[] = "@(#)diffreg.c 4.16 3/29/86";
+#endif
-#include "diff.h"
+/*#include "diff.h"*/
/*
* diff - compare two files.
*/
#define prints(s) fputs(s,stdout)
FILE *input[2];
-FILE *fopen();
+/*FILE *fopen();*/
struct cand {
int x;
0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff
};
-diffreg()
-{
+static char *copytemp __P((void));
+static char *splice __P((char *dir, char *file));
+static prepare __P((int i, FILE *fd));
+static prune __P((void));
+static equiv __P((struct line *a, int n, struct line *b, int m, int *c));
+static stone __P((int *a, int n, int *b, register int *c));
+static newcand __P((int x, int y, int pred));
+static search __P((int *c, int k, int y));
+static unravel __P((int p));
+static check __P((void));
+static sort __P((struct line *a, int n));
+static unsort __P((struct line *f, int l, int *b));
+static skipline __P((int f));
+static output __P((void));
+static change __P((int a, int b, int c, int d));
+static range __P((int a, int b, char *separator));
+static fetch __P((long *f, int a, int b, FILE *lb, char *s, int oldfile));
+static readhash __P((register FILE *f));
+static asciifile __P((FILE *f));
+static dump_context_vec __P((void));
+
+int diffreg() {
register int i, j;
FILE *f1, *f2;
char buf1[BUFSIZ], buf2[BUFSIZ];
done();
}
-static char *
-copytemp()
-{
+static char *copytemp() {
char buf[BUFSIZ];
register int i, f;
return (tempfile);
}
-static char *
-splice(dir, file)
- char *dir, *file;
-{
+static char *splice(dir, file) char *dir; char *file; {
char *tail;
char buf[BUFSIZ];
return (savestr(buf));
}
-static
-prepare(i, fd)
- int i;
- FILE *fd;
-{
+static prepare(i, fd) int i; FILE *fd; {
register struct line *p;
register j,h;
file[i] = p;
}
-static
-prune()
-{
+static prune() {
register i,j;
for(pref=0;pref<len[0]&&pref<len[1]&&
file[0][pref+1].value==file[1][pref+1].value;
}
}
-static
-equiv(a,n,b,m,c)
-struct line *a, *b;
-int *c;
-{
+static equiv(a, n, b, m, c) struct line *a; int n; struct line *b; int m; int *c; {
register int i, j;
i = j = 1;
while(i<=n && j<=m) {
c[j] = -1;
}
-static
-stone(a,n,b,c)
-int *a;
-int *b;
-register int *c;
-{
+static stone(a, n, b, c) int *a; int n; int *b; register int *c; {
register int i, k,y;
int j, l;
int oldc, tc;
return(k);
}
-static
-newcand(x,y,pred)
-{
+static newcand(x, y, pred) int x; int y; int pred; {
register struct cand *q;
clist = (struct cand *)ralloc((char *)clist,++clen*sizeof(cand));
q = clist + clen -1;
return(clen-1);
}
-static
-search(c, k, y)
-int *c;
-{
+static search(c, k, y) int *c; int k; int y; {
register int i, j, l;
int t;
if(clist[c[k]].y<y) /*quick look for typical case*/
return(l+1);
}
-static
-unravel(p)
-{
+static unravel(p) int p; {
register int i;
register struct cand *q;
for(i=0; i<=len[0]; i++)
to confounding by hashing (which result in "jackpot")
2. collect random access indexes to the two files */
-static
-check()
-{
+static check() {
register int i, j;
int jackpot;
long ctold, ctnew;
*/
}
-static
-sort(a,n) /*shellsort CACM #201*/
-struct line *a;
-{
+static sort(a, n) /*shellsort CACM #201*/ struct line *a; int n; {
struct line w;
register int j,m;
struct line *ai;
}
}
-static
-unsort(f, l, b)
-struct line *f;
-int *b;
-{
+static unsort(f, l, b) struct line *f; int l; int *b; {
register int *a;
register int i;
a = (int *)talloc((l+1)*sizeof(int));
free((char *)a);
}
-static
-skipline(f)
-{
+static skipline(f) int f; {
register i, c;
for(i=1;(c=getc(input[f]))!='\n';i++)
return(i);
}
-static
-output()
-{
+static output() {
int m;
register int i0, i1, j1;
int j0;
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.
*/
-static
-change(a,b,c,d)
-{
+static change(a, b, c, d) int a; int b; int c; int d; {
int ch;
int lowa,upb,lowc,upd;
struct stat stbuf;
}
}
-static
-range(a,b,separator)
-char *separator;
-{
+static range(a, b, separator) int a; int b; char *separator; {
printf("%d", a>b?b:a);
if(a<b) {
printf("%s%d", separator, b);
}
}
-static
-fetch(f,a,b,lb,s,oldfile)
-long *f;
-FILE *lb;
-char *s;
-{
+static fetch(f, a, b, lb, s, oldfile) long *f; int a; int b; FILE *lb; char *s; int oldfile; {
register int i, j;
register int c;
register int col;
* arranging line in 7-bit bytes and then
* summing 1-s complement in 16-bit hunks
*/
-static
-readhash(f)
-register FILE *f;
-{
+static readhash(f) register FILE *f; {
register long sum;
register unsigned shift;
register t;
return((short)low(sum) + (short)high(sum));
}
-#include <a.out.h>
+/*#include <a.out.h>*/
-static
-asciifile(f)
- FILE *f;
-{
+static asciifile(f) FILE *f; {
char buf[BUFSIZ];
register int cnt;
register char *cp;
return (1);
}
-
/* dump accumulated "context" diff changes */
-static
-dump_context_vec()
-{
+static dump_context_vec() {
register int a, b, c, d;
register char ch;
register struct context_vec *cvp = context_vec_start;