int header;
char title[2*BUFSIZ], *etitle;
-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 void setfile __P((char **fpp, char **epp, char *file));
+static void scanpr __P((register struct dir *dp, int test, char *title, char *file1, char *efile1, char *file2, char *efile2));
+static void 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 void compare __P((register struct dir *dp));
+static void calldiff __P((char *wantpr));
static ascii __P((int f));
static useless __P((register char *cp));
-int diffdir(argv) char **argv; {
+void diffdir(argv) char **argv; {
register struct dir *d1, *d2;
struct dir *dir1, *dir2;
register int i;
}
}
-static setfile(fpp, epp, file) char **fpp; char **epp; char *file; {
+static void 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; char *file1; char *efile1; char *file2; char *efile2; {
+static void 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 void only(dp, which) struct dir *dp; int which; {
char *file = which == 1 ? file1 : file2;
char *efile = which == 1 ? efile1 : efile2;
static struct dir *setupdir(cp) char *cp; {
register struct dir *dp = 0, *ep;
register struct direct *rp;
- register int nitems, n;
+ register int nitems;
DIR *dirp;
dirp = opendir(cp);
}
dp[nitems].d_entry = 0; /* delimiter */
closedir(dirp);
- qsort(dp, nitems, sizeof (struct dir), entcmp);
+ qsort(dp, nitems, sizeof (struct dir), (int (*) __P((void *p0, void *p1)))entcmp);
return (dp);
}
return (strcmp(d1->d_entry, d2->d_entry));
}
-static compare(dp) register struct dir *dp; {
+static void compare(dp) register struct dir *dp; {
register int i, j;
int f1, f2, fmt1, fmt2;
struct stat stb1, stb2;
- int flag = 0;
char buf1[BUFSIZ], buf2[BUFSIZ];
strcpy(efile1, dp->d_entry);
static char *prargs[] = { "pr", "-h", 0, "-f", 0, 0 };
-static calldiff(wantpr) char *wantpr; {
+static void calldiff(wantpr) char *wantpr; {
int pid, status, status2, pv[2];
prargs[2] = wantpr;
/*#include <ctype.h> gen.h*/
#include <gen.h>
#include <stdio.h>
-/*#include <sys/stat.h> diff.h*/
-#include "diff.h"
+#include <sys/stat.h>
#if defined(DOSCCS) && !defined(lint)
static char sccsid[] = "@(#)diffh.c 4.4 11/27/85";
#endif
char *getl __P((int f, long n));
-int clrl __P((int f, long n));
-int movstr __P((register char *s, register char *t));
+void clrl __P((int f, long n));
+void 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));
+void change __P((long a, int b, long c, int d, char *s));
+void 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));
+void progerr __P((char *s));
int error __P((char *s, char *t));
int hardsynch __P((void));
}
/*remove thru line n of file f from storage*/
-int clrl(f, n) int f; long n; {
+void 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;
}
-int movstr(s, t) register char *s; register char *t; {
+void movstr(s, t) register char *s; register char *t; {
while(*t++= *s++)
continue;
}
return(1);
}
-int change(a, b, c, d, s) long a; int b; long c; int d; char *s; {
+void 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");
}
-int range(a, b) long a; int b; {
+void range(a, b) long a; int b; {
if(b==INF)
printf("%ld,$",a);
else if(b==0)
return(f);
}
-int progerr(s) char *s; {
+void progerr(s) char *s; {
error("program error ",s);
}
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 void prepare __P((int i, FILE *fd));
+static void prune __P((void));
+static void 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 void unravel __P((int p));
+static void check __P((void));
+static void sort __P((struct line *a, int n));
+static void 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 void output __P((void));
+static void change __P((int a, int b, int c, int d));
+static void range __P((int a, int b, char *separator));
+static void 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));
+static void dump_context_vec __P((void));
-int diffreg() {
+void diffreg() {
register int i, j;
FILE *f1, *f2;
char buf1[BUFSIZ], buf2[BUFSIZ];
char buf[BUFSIZ];
register int i, f;
- signal(SIGHUP,done);
- signal(SIGINT,done);
- signal(SIGPIPE,done);
- signal(SIGTERM,done);
+ signal(SIGHUP,(void (*) __P((int sig)))done);
+ signal(SIGINT,(void (*) __P((int sig)))done);
+ signal(SIGPIPE,(void (*) __P((int sig)))done);
+ signal(SIGTERM,(void (*) __P((int sig)))done);
tempfile = mktemp("/tmp/dXXXXX");
f = creat(tempfile,0600);
if (f < 0) {
return (savestr(buf));
}
-static prepare(i, fd) int i; FILE *fd; {
+static void prepare(i, fd) int i; FILE *fd; {
register struct line *p;
register j,h;
file[i] = p;
}
-static prune() {
+static void 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; int n; struct line *b; int m; int *c; {
+static void 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) {
return(l+1);
}
-static unravel(p) int p; {
+static void 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 void check() {
register int i, j;
int jackpot;
long ctold, ctnew;
*/
}
-static sort(a, n) /*shellsort CACM #201*/ struct line *a; int n; {
+static void 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 l; int *b; {
+static void unsort(f, l, b) struct line *f; int l; int *b; {
register int *a;
register int i;
a = (int *)talloc((l+1)*sizeof(int));
return(i);
}
-static output() {
+static void 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) int a; int b; int c; int d; {
- int ch;
- int lowa,upb,lowc,upd;
+static void change(a, b, c, d) int a; int b; int c; int d; {
struct stat stbuf;
if (opt != D_IFDEF && a>b && c>d)
context_vec_ptr = context_vec_start - 1;
}
}
- if (a <= b && c <= d)
- ch = 'c';
- else
- ch = (a <= b) ? 'd' : 'a';
if(opt == D_CONTEXT) {
/*
* if this new change is within 'context' lines of
}
}
-static range(a, b, separator) int a; int b; char *separator; {
+static void 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; int a; int b; FILE *lb; char *s; int oldfile; {
+static void 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;
fseek(f, (long)0, 0);
cnt = fread(buf, 1, BUFSIZ, f);
- if (cnt >= sizeof (struct exec)) {
- struct exec hdr;
- hdr = *(struct exec *)buf;
- if (!N_BADMAG(hdr))
- return (0);
- }
+ if (cnt >= sizeof (struct exec) && !N_BADMAG(*(struct exec *)buf))
+ return (0);
cp = buf;
while (--cnt >= 0)
if (*cp++ & 0200)
}
/* dump accumulated "context" diff changes */
-static dump_context_vec() {
+static void dump_context_vec() {
register int a, b, c, d;
register char ch;
register struct context_vec *cvp = context_vec_start;
ch = (a <= b) ? 'd' : 'a';
if (ch == 'a')
+#if defined(__STDC__) || defined(lint)
+ fetch(ixold,lowa,b,input[0]," ",0);
+#else
fetch(ixold,lowa,b,input[0]," ");
+#endif
else {
+#if defined(__STDC__) || defined(lint)
+ fetch(ixold,lowa,a-1,input[0]," ",0);
+ fetch(ixold,a,b,input[0],ch == 'c' ? "! " : "- ",0);
+#else
fetch(ixold,lowa,a-1,input[0]," ");
fetch(ixold,a,b,input[0],ch == 'c' ? "! " : "- ");
+#endif
}
lowa = b + 1;
cvp++;
}
+#if defined(__STDC__) || defined(lint)
+ fetch(ixold, b+1, upb, input[0], " ", 0);
+#else
fetch(ixold, b+1, upb, input[0], " ");
+#endif
}
/* output changes to the "new" file */
ch = (a <= b) ? 'd' : 'a';
if (ch == 'd')
+#if defined(__STDC__) || defined(lint)
+ fetch(ixnew,lowc,d,input[1]," ",0);
+#else
fetch(ixnew,lowc,d,input[1]," ");
+#endif
else {
+#if defined(__STDC__) || defined(lint)
+ fetch(ixnew,lowc,c-1,input[1]," ",0);
+ fetch(ixnew,c,d,input[1],ch == 'c' ? "! " : "+ ",0);
+#else
fetch(ixnew,lowc,c-1,input[1]," ");
fetch(ixnew,c,d,input[1],ch == 'c' ? "! " : "+ ");
+#endif
}
lowc = d + 1;
cvp++;
}
+#if defined(__STDC__) || defined(lint)
+ fetch(ixnew, d+1, upd, input[1], " ", 0);
+#else
fetch(ixnew, d+1, upd, input[1], " ");
+#endif
}
context_vec_ptr = context_vec_start - 1;