version 1.8, 2003/06/25 03:42:00 |
version 1.9, 2003/06/25 03:42:16 |
|
|
void |
void |
diffreg(void) |
diffreg(void) |
{ |
{ |
int i, j; |
|
FILE *f1, *f2; |
|
char buf1[BUFSIZ], buf2[BUFSIZ]; |
char buf1[BUFSIZ], buf2[BUFSIZ]; |
|
FILE *f1, *f2; |
|
int i, j; |
|
|
if (hflag) { |
if (hflag) { |
diffargv[0] = "diffh"; |
diffargv[0] = "diffh"; |
|
|
char * |
char * |
splice(char *dir, char *file) |
splice(char *dir, char *file) |
{ |
{ |
char *tail; |
char *tail, buf[BUFSIZ]; |
char buf[BUFSIZ]; |
|
|
|
if (!strcmp(file, "-")) { |
if (!strcmp(file, "-")) { |
fprintf(stderr, "diff: can't specify - with other arg directory\n"); |
fprintf(stderr, "diff: can't specify - with other arg directory\n"); |
|
|
prune(void) |
prune(void) |
{ |
{ |
int i, j; |
int i, j; |
|
|
for (pref = 0; pref < len[0] && pref < len[1] && |
for (pref = 0; pref < len[0] && pref < len[1] && |
file[0][pref + 1].value == file[1][pref + 1].value; |
file[0][pref + 1].value == file[1][pref + 1].value; |
pref++); |
pref++); |
|
|
equiv(struct line *a, int n, struct line *b, int m, int *c) |
equiv(struct line *a, int n, struct line *b, int m, int *c) |
{ |
{ |
int i, j; |
int i, j; |
|
|
i = j = 1; |
i = j = 1; |
while (i <= n && j <= m) { |
while (i <= n && j <= m) { |
if (a[i].value < b[j].value) |
if (a[i].value < b[j].value) |
|
|
static int |
static int |
stone(int *a, int n, int *b, int *c) |
stone(int *a, int n, int *b, int *c) |
{ |
{ |
int i, k, y; |
int i, k, y, j, l; |
int j, l; |
int oldc, tc, oldl; |
int oldc, tc; |
|
int oldl; |
|
k = 0; |
k = 0; |
c[0] = newcand(0, 0, 0); |
c[0] = newcand(0, 0, 0); |
for (i = 1; i <= n; i++) { |
for (i = 1; i <= n; i++) { |
|
|
static int |
static int |
search(int *c, int k, int y) |
search(int *c, int k, int y) |
{ |
{ |
int i, j, l; |
int i, j, l, t; |
int t; |
|
if (clist[c[k]].y < y) /* quick look for typical case */ |
if (clist[c[k]].y < y) /* quick look for typical case */ |
return (k + 1); |
return (k + 1); |
i = 0; |
i = 0; |
|
|
static void |
static void |
unravel(int p) |
unravel(int p) |
{ |
{ |
int i; |
|
struct cand *q; |
struct cand *q; |
|
int i; |
|
|
for (i = 0; i <= len[0]; i++) |
for (i = 0; i <= len[0]; i++) |
J[i] = i <= pref ? i : |
J[i] = i <= pref ? i : |
i > len[0] - suff ? i + len[1] - len[0] : |
i > len[0] - suff ? i + len[1] - len[0] : |
|
|
static void |
static void |
check(void) |
check(void) |
{ |
{ |
int i, j; |
int i, j, jackpot, c, d; |
int jackpot; |
|
long ctold, ctnew; |
long ctold, ctnew; |
int c, d; |
|
|
|
if ((input[0] = fopen(file1, "r")) == NULL) { |
if ((input[0] = fopen(file1, "r")) == NULL) { |
perror(file1); |
perror(file1); |
|
|
fclose(input[0]); |
fclose(input[0]); |
fclose(input[1]); |
fclose(input[1]); |
/* |
/* |
if(jackpot) |
* if (jackpot) |
fprintf(stderr, "jackpot\n"); |
* fprintf(stderr, "jackpot\n"); |
*/ |
*/ |
} |
} |
|
|
|
/* shellsort CACM #201 */ |
static void |
static void |
sort(struct line *a, int n) |
sort(struct line *a, int n) |
{ /* shellsort CACM #201 */ |
{ |
struct line w; |
struct line *ai, *aim, w; |
int j, m = 0; /* gcc */ |
int j, m = 0, k; |
struct line *ai; |
|
struct line *aim; |
|
int k; |
|
|
|
if (n == 0) |
if (n == 0) |
return; |
return; |
|
|
static void |
static void |
unsort(struct line *f, int l, int *b) |
unsort(struct line *f, int l, int *b) |
{ |
{ |
int *a; |
int *a, i; |
int i; |
|
|
|
a = talloc((l + 1) * sizeof(int)); |
a = talloc((l + 1) * sizeof(int)); |
for (i = 1; i <= l; i++) |
for (i = 1; i <= l; i++) |
|
|
static void |
static void |
output(void) |
output(void) |
{ |
{ |
int m; |
int m, i0, i1, j0, j1; |
int i0, i1, j1; |
|
int j0; |
|
input[0] = fopen(file1, "r"); |
input[0] = fopen(file1, "r"); |
input[1] = fopen(file2, "r"); |
input[1] = fopen(file2, "r"); |
m = len[0]; |
m = len[0]; |
|
|
range(int a, int b, char *separator) |
range(int a, int b, char *separator) |
{ |
{ |
printf("%d", a > b ? b : a); |
printf("%d", a > b ? b : a); |
if (a < b) { |
if (a < b) |
printf("%s%d", separator, b); |
printf("%s%d", separator, b); |
} |
|
} |
} |
|
|
static void |
static void |
fetch(long *f, int a, int b, FILE *lb, char *s, int oldfile) |
fetch(long *f, int a, int b, FILE *lb, char *s, int oldfile) |
{ |
{ |
int i, j; |
|
int c; |
|
int col; |
|
int nc; |
|
int oneflag = (*ifdef1 != '\0') != (*ifdef2 != '\0'); |
int oneflag = (*ifdef1 != '\0') != (*ifdef2 != '\0'); |
|
int i, j, c, col, nc; |
|
|
/* |
/* |
* When doing #ifdef's, copy down to current line |
* When doing #ifdef's, copy down to current line |
|
|
return; |
return; |
if (opt == D_IFDEF) { |
if (opt == D_IFDEF) { |
if (inifdef) |
if (inifdef) |
fprintf(stdout, "#else /* %s%s */\n", oneflag && oldfile == 1 ? "!" : "", ifdef2); |
fprintf(stdout, "#else /* %s%s */\n", |
|
oneflag && oldfile == 1 ? "!" : "", ifdef2); |
else { |
else { |
if (oneflag) { |
if (oneflag) { |
/* There was only one ifdef given */ |
/* There was only one ifdef given */ |
|
|
static int |
static int |
readhash(FILE *f) |
readhash(FILE *f) |
{ |
{ |
|
unsigned int shift; |
|
int t, space; |
long sum; |
long sum; |
unsigned shift; |
|
int t; |
|
int space; |
|
|
|
sum = 1; |
sum = 1; |
space = 0; |
space = 0; |
|
|
static int |
static int |
asciifile(FILE *f) |
asciifile(FILE *f) |
{ |
{ |
char buf[BUFSIZ]; |
char buf[BUFSIZ], *cp; |
int cnt; |
int cnt; |
char *cp; |
|
|
|
fseek(f, 0, 0); |
fseek(f, 0, 0); |
cnt = fread(buf, 1, BUFSIZ, f); |
cnt = fread(buf, 1, BUFSIZ, f); |
|
|
static void |
static void |
dump_context_vec(void) |
dump_context_vec(void) |
{ |
{ |
|
struct context_vec *cvp = context_vec_start; |
|
int lowa, upb, lowc, upd, do_output; |
int a, b, c, d; |
int a, b, c, d; |
char ch; |
char ch; |
struct context_vec *cvp = context_vec_start; |
|
int lowa, upb, lowc, upd; |
|
int do_output; |
|
|
|
if (cvp > context_vec_ptr) |
if (cvp > context_vec_ptr) |
return; |
return; |
|
|
fetch(ixold, lowa, b, input[0], " ", 0); |
fetch(ixold, lowa, b, input[0], " ", 0); |
else { |
else { |
fetch(ixold, lowa, a - 1, input[0], " ", 0); |
fetch(ixold, lowa, a - 1, input[0], " ", 0); |
fetch(ixold, a, b, input[0], ch == 'c' ? "! " : "- ", 0); |
fetch(ixold, a, b, input[0], |
|
ch == 'c' ? "! " : "- ", 0); |
} |
} |
lowa = b + 1; |
lowa = b + 1; |
cvp++; |
cvp++; |
|
|
fetch(ixnew, lowc, d, input[1], " ", 0); |
fetch(ixnew, lowc, d, input[1], " ", 0); |
else { |
else { |
fetch(ixnew, lowc, c - 1, input[1], " ", 0); |
fetch(ixnew, lowc, c - 1, input[1], " ", 0); |
fetch(ixnew, c, d, input[1], ch == 'c' ? "! " : "+ ", 0); |
fetch(ixnew, c, d, input[1], |
|
ch == 'c' ? "! " : "+ ", 0); |
} |
} |
lowc = d + 1; |
lowc = d + 1; |
cvp++; |
cvp++; |