version 1.4, 2003/06/25 03:25:29 |
version 1.5, 2003/06/25 03:37:32 |
|
|
execv(diffh, diffargv); |
execv(diffh, diffargv); |
fprintf(stderr, "diff: "); |
fprintf(stderr, "diff: "); |
perror(diffh); |
perror(diffh); |
done(); |
done(0); |
} |
} |
chrtran = (iflag ? cup2low : clow2low); |
chrtran = (iflag ? cup2low : clow2low); |
if ((stb1.st_mode & S_IFMT) == S_IFDIR) { |
if ((stb1.st_mode & S_IFMT) == S_IFDIR) { |
|
|
if (stat(file1, &stb1) < 0) { |
if (stat(file1, &stb1) < 0) { |
fprintf(stderr, "diff: "); |
fprintf(stderr, "diff: "); |
perror(file1); |
perror(file1); |
done(); |
done(0); |
} |
} |
} else if ((stb2.st_mode & S_IFMT) == S_IFDIR) { |
} else if ((stb2.st_mode & S_IFMT) == S_IFDIR) { |
file2 = splice(file2, file1); |
file2 = splice(file2, file1); |
if (stat(file2, &stb2) < 0) { |
if (stat(file2, &stb2) < 0) { |
fprintf(stderr, "diff: "); |
fprintf(stderr, "diff: "); |
perror(file2); |
perror(file2); |
done(); |
done(0); |
} |
} |
} else if ((stb1.st_mode & S_IFMT) != S_IFREG || !strcmp(file1, "-")) { |
} else if ((stb1.st_mode & S_IFMT) != S_IFREG || !strcmp(file1, "-")) { |
if (!strcmp(file2, "-")) { |
if (!strcmp(file2, "-")) { |
fprintf(stderr, "diff: can't specify - -\n"); |
fprintf(stderr, "diff: can't specify - -\n"); |
done(); |
done(0); |
} |
} |
file1 = copytemp(); |
file1 = copytemp(); |
if (stat(file1, &stb1) < 0) { |
if (stat(file1, &stb1) < 0) { |
fprintf(stderr, "diff: "); |
fprintf(stderr, "diff: "); |
perror(file1); |
perror(file1); |
done(); |
done(0); |
} |
} |
} else if ((stb2.st_mode & S_IFMT) != S_IFREG || !strcmp(file2, "-")) { |
} else if ((stb2.st_mode & S_IFMT) != S_IFREG || !strcmp(file2, "-")) { |
file2 = copytemp(); |
file2 = copytemp(); |
if (stat(file2, &stb2) < 0) { |
if (stat(file2, &stb2) < 0) { |
fprintf(stderr, "diff: "); |
fprintf(stderr, "diff: "); |
perror(file2); |
perror(file2); |
done(); |
done(0); |
} |
} |
} |
} |
if ((f1 = fopen(file1, "r")) == NULL) { |
if ((f1 = fopen(file1, "r")) == NULL) { |
fprintf(stderr, "diff: "); |
fprintf(stderr, "diff: "); |
perror(file1); |
perror(file1); |
done(); |
done(0); |
} |
} |
if ((f2 = fopen(file2, "r")) == NULL) { |
if ((f2 = fopen(file2, "r")) == NULL) { |
fprintf(stderr, "diff: "); |
fprintf(stderr, "diff: "); |
perror(file2); |
perror(file2); |
fclose(f1); |
fclose(f1); |
done(); |
done(0); |
} |
} |
if (stb1.st_size != stb2.st_size) |
if (stb1.st_size != stb2.st_size) |
goto notsame; |
goto notsame; |
|
|
printf("Binary files %s and %s differ\n", file1, file2); |
printf("Binary files %s and %s differ\n", file1, file2); |
fclose(f1); |
fclose(f1); |
fclose(f2); |
fclose(f2); |
done(); |
done(0); |
} |
} |
prepare(0, f1); |
prepare(0, f1); |
prepare(1, f2); |
prepare(1, f2); |
|
|
same: |
same: |
if (opt == D_CONTEXT && anychange == 0) |
if (opt == D_CONTEXT && anychange == 0) |
printf("No differences encountered\n"); |
printf("No differences encountered\n"); |
done(); |
done(0); |
} |
} |
|
|
char *tempfile = _PATH_TMP; |
char *tempfile = _PATH_TMP; |
|
|
if (f < 0) { |
if (f < 0) { |
fprintf(stderr, "diff: "); |
fprintf(stderr, "diff: "); |
perror(tempfile); |
perror(tempfile); |
done(); |
done(0); |
} |
} |
while ((i = read(0, buf, BUFSIZ)) > 0) |
while ((i = read(0, buf, BUFSIZ)) > 0) |
if (write(f, buf, i) != i) { |
if (write(f, buf, i) != i) { |
fprintf(stderr, "diff: "); |
fprintf(stderr, "diff: "); |
perror(tempfile); |
perror(tempfile); |
done(); |
done(0); |
} |
} |
close(f); |
close(f); |
return (tempfile); |
return (tempfile); |
|
|
|
|
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"); |
done(); |
done(0); |
} |
} |
tail = rindex(file, '/'); |
tail = rindex(file, '/'); |
if (tail == 0) |
if (tail == 0) |
|
|
|
|
if ((input[0] = fopen(file1, "r")) == NULL) { |
if ((input[0] = fopen(file1, "r")) == NULL) { |
perror(file1); |
perror(file1); |
done(); |
done(0); |
} |
} |
if ((input[1] = fopen(file2, "r")) == NULL) { |
if ((input[1] = fopen(file2, "r")) == NULL) { |
perror(file2); |
perror(file2); |
done(); |
done(0); |
} |
} |
j = 1; |
j = 1; |
ixold[0] = ixnew[0] = 0; |
ixold[0] = ixnew[0] = 0; |