all: diff diffh
diff: ${OBJS}
- cc ${CFLAGS} -o diff ${OBJS} ${LDFLAGS}
+ ${CC} ${CFLAGS} -o diff ${OBJS} ${LDFLAGS}
diffh: diffh.o
- cc -o diffh diffh.o ${LDFLAGS}
+ ${CC} -o diffh diffh.o ${LDFLAGS}
clean:
rm -f diff diffh ${OBJS} diffh.o
* diff - driver and subroutines
*/
+/* moved here from diff.h which now just declares them extern */
+/*
+ * Output format options
+ */
+int opt;
+int tflag; /* expand tabs on output */
+
+/*
+ * Algorithm related options
+ */
+int hflag; /* -h, use halfhearted DIFFH */
+int bflag; /* ignore blanks in comparisons */
+int wflag; /* totally ignore blanks in comparisons */
+int iflag; /* ignore case in comparisons */
+
+/*
+ * Options on hierarchical diffs.
+ */
+int lflag; /* long output format with header */
+int rflag; /* recursively trace directories */
+int sflag; /* announce files which are same */
+char *start; /* do file only if name >= this */
+
+/*
+ * Variables for -I D_IFDEF option.
+ */
+int wantelses; /* -E */
+char *ifdef1; /* String for -1 */
+char *ifdef2; /* String for -2 */
+char *endifname; /* What we will print on next #endif */
+int inifdef;
+
+/*
+ * Variables for -c context option.
+ */
+int context; /* lines of context to be printed */
+
+/*
+ * State for exit status.
+ */
+int status;
+int anychange;
+char *tempfile; /* used when comparing against std input */
+
+/*
+ * Variables for diffdir.
+ */
+char **diffargv; /* option list to pass to recursive diffs */
+
+/*
+ * Input file names.
+ * With diffdir, file1 and file2 are allocated BUFSIZ space,
+ * and padded with a '/', and then efile0 and efile1 point after
+ * the '/'.
+ */
+char *file1, *file2, *efile1, *efile2;
+struct stat stb1, stb2;
+
char diff[] = DIFF;
char diffh[] = DIFFH;
char pr[] = PR;
char *p;
{
register char *q;
- char *realloc();
+ void *realloc();
if ((q = realloc(p, (unsigned)n)) == NULL)
noroom();
/*
* Output format options
*/
-int opt;
+extern int opt;
#define D_NORMAL 0 /* Normal output */
#define D_EDIT -1 /* Editor script out */
#define D_NREVERSE 4 /* Reverse ed script with numbered
lines and no trailing . */
-int tflag; /* expand tabs on output */
+extern int tflag; /* expand tabs on output */
/*
* Algorithm related options
*/
-int hflag; /* -h, use halfhearted DIFFH */
-int bflag; /* ignore blanks in comparisons */
-int wflag; /* totally ignore blanks in comparisons */
-int iflag; /* ignore case in comparisons */
+extern int hflag; /* -h, use halfhearted DIFFH */
+extern int bflag; /* ignore blanks in comparisons */
+extern int wflag; /* totally ignore blanks in comparisons */
+extern int iflag; /* ignore case in comparisons */
/*
* Options on hierarchical diffs.
*/
-int lflag; /* long output format with header */
-int rflag; /* recursively trace directories */
-int sflag; /* announce files which are same */
-char *start; /* do file only if name >= this */
+extern int lflag; /* long output format with header */
+extern int rflag; /* recursively trace directories */
+extern int sflag; /* announce files which are same */
+extern char *start; /* do file only if name >= this */
/*
* Variables for -I D_IFDEF option.
*/
-int wantelses; /* -E */
-char *ifdef1; /* String for -1 */
-char *ifdef2; /* String for -2 */
-char *endifname; /* What we will print on next #endif */
-int inifdef;
+extern int wantelses; /* -E */
+extern char *ifdef1; /* String for -1 */
+extern char *ifdef2; /* String for -2 */
+extern char *endifname; /* What we will print on next #endif */
+extern int inifdef;
/*
* Variables for -c context option.
*/
-int context; /* lines of context to be printed */
+extern int context; /* lines of context to be printed */
/*
* State for exit status.
*/
-int status;
-int anychange;
-char *tempfile; /* used when comparing against std input */
+extern int status;
+extern int anychange;
+extern char *tempfile; /* used when comparing against std input */
/*
* Variables for diffdir.
*/
-char **diffargv; /* option list to pass to recursive diffs */
+extern char **diffargv; /* option list to pass to recursive diffs */
/*
* Input file names.
* and padded with a '/', and then efile0 and efile1 point after
* the '/'.
*/
-char *file1, *file2, *efile1, *efile2;
-struct stat stb1, stb2;
+extern char *file1, *file2, *efile1, *efile2;
+extern struct stat stb1, stb2;
char *malloc(), *talloc(), *ralloc();
char *savestr(), *splice(), *splicen();
}
}
+static
setfile(fpp, epp, file)
char **fpp, **epp;
char *file;
*epp = cp;
}
+static
scanpr(dp, test, title, file1, efile1, file2, efile2)
register struct dir *dp;
int test;
}
}
+static
only(dp, which)
struct dir *dp;
int which;
printf("Only in %.*s: %s\n", efile - file - 1, file, dp->d_entry);
}
-int entcmp();
+static int entcmp();
-struct dir *
+static struct dir *
setupdir(cp)
char *cp;
{
return (dp);
}
+static
entcmp(d1, d2)
struct dir *d1, *d2;
{
return (strcmp(d1->d_entry, d2->d_entry));
}
+static
compare(dp)
register struct dir *dp;
{
close(f1); close(f2);
}
-char *prargs[] = { "pr", "-h", 0, "-f", 0, 0 };
+static char *prargs[] = { "pr", "-h", 0, "-f", 0, 0 };
+static
calldiff(wantpr)
char *wantpr;
{
#include <a.out.h>
+static
ascii(f)
int f;
{
/*
* THIS IS CRUDE.
*/
+static
useless(cp)
register char *cp;
{
long n;
{
register char *t;
- char *malloc();
+ void *malloc();
register delta, nt;
again:
delta = n - lineno[f];
done();
}
-char *
+static char *
copytemp()
{
char buf[BUFSIZ];
return (tempfile);
}
-char *
+static char *
splice(dir, file)
char *dir, *file;
{
return (savestr(buf));
}
+static
prepare(i, fd)
int i;
FILE *fd;
file[i] = p;
}
+static
prune()
{
register i,j;
}
}
+static
equiv(a,n,b,m,c)
struct line *a, *b;
int *c;
c[j] = -1;
}
+static
stone(a,n,b,c)
int *a;
int *b;
return(k);
}
+static
newcand(x,y,pred)
{
register struct cand *q;
return(clen-1);
}
+static
search(c, k, y)
int *c;
{
return(l+1);
}
+static
unravel(p)
{
register int i;
to confounding by hashing (which result in "jackpot")
2. collect random access indexes to the two files */
+static
check()
{
register int i, j;
*/
}
+static
sort(a,n) /*shellsort CACM #201*/
struct line *a;
{
}
}
+static
unsort(f, l, b)
struct line *f;
int *b;
free((char *)a);
}
+static
skipline(f)
{
register i, c;
return(i);
}
+static
output()
{
int m;
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 ch;
}
}
+static
range(a,b,separator)
char *separator;
{
}
}
+static
fetch(f,a,b,lb,s,oldfile)
long *f;
FILE *lb;
* arranging line in 7-bit bytes and then
* summing 1-s complement in 16-bit hunks
*/
+static
readhash(f)
register FILE *f;
{
#include <a.out.h>
+static
asciifile(f)
FILE *f;
{
/* dump accumulated "context" diff changes */
+static
dump_context_vec()
{
register int a, b, c, d;
--- /dev/null
+diff.c diff.h
+diffdir.c diff.h
+diffreg.c diff.h