diff options
Diffstat (limited to 'coreutils/diff.c')
| -rw-r--r-- | coreutils/diff.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/coreutils/diff.c b/coreutils/diff.c index f26bcca86..2920bf143 100644 --- a/coreutils/diff.c +++ b/coreutils/diff.c | |||
| @@ -183,7 +183,7 @@ static int readhash(FILE * f) | |||
| 183 | for (i = 0; (t = getc(f)) != '\n'; i++) { | 183 | for (i = 0; (t = getc(f)) != '\n'; i++) { |
| 184 | if (t == EOF) { | 184 | if (t == EOF) { |
| 185 | if (i == 0) | 185 | if (i == 0) |
| 186 | return (0); | 186 | return 0; |
| 187 | break; | 187 | break; |
| 188 | } | 188 | } |
| 189 | sum = sum * 127 + t; | 189 | sum = sum * 127 + t; |
| @@ -191,7 +191,7 @@ static int readhash(FILE * f) | |||
| 191 | for (i = 0; (t = getc(f)) != '\n'; i++) { | 191 | for (i = 0; (t = getc(f)) != '\n'; i++) { |
| 192 | if (t == EOF) { | 192 | if (t == EOF) { |
| 193 | if (i == 0) | 193 | if (i == 0) |
| 194 | return (0); | 194 | return 0; |
| 195 | break; | 195 | break; |
| 196 | } | 196 | } |
| 197 | sum = sum * 127 + t; | 197 | sum = sum * 127 + t; |
| @@ -216,7 +216,7 @@ static int readhash(FILE * f) | |||
| 216 | continue; | 216 | continue; |
| 217 | case EOF: | 217 | case EOF: |
| 218 | if (i == 0) | 218 | if (i == 0) |
| 219 | return (0); | 219 | return 0; |
| 220 | /* FALLTHROUGH */ | 220 | /* FALLTHROUGH */ |
| 221 | case '\n': | 221 | case '\n': |
| 222 | break; | 222 | break; |
| @@ -244,19 +244,19 @@ static int files_differ(FILE * f1, FILE * f2, int flags) | |||
| 244 | 244 | ||
| 245 | if ((flags & (D_EMPTY1 | D_EMPTY2)) || stb1.st_size != stb2.st_size || | 245 | if ((flags & (D_EMPTY1 | D_EMPTY2)) || stb1.st_size != stb2.st_size || |
| 246 | (stb1.st_mode & S_IFMT) != (stb2.st_mode & S_IFMT)) | 246 | (stb1.st_mode & S_IFMT) != (stb2.st_mode & S_IFMT)) |
| 247 | return (1); | 247 | return 1; |
| 248 | while (1) { | 248 | while (1) { |
| 249 | i = fread(buf1, 1, sizeof(buf1), f1); | 249 | i = fread(buf1, 1, sizeof(buf1), f1); |
| 250 | j = fread(buf2, 1, sizeof(buf2), f2); | 250 | j = fread(buf2, 1, sizeof(buf2), f2); |
| 251 | if (i != j) | 251 | if (i != j) |
| 252 | return (1); | 252 | return 1; |
| 253 | if (i == 0 && j == 0) { | 253 | if (i == 0 && j == 0) { |
| 254 | if (ferror(f1) || ferror(f2)) | 254 | if (ferror(f1) || ferror(f2)) |
| 255 | return (1); | 255 | return 1; |
| 256 | return (0); | 256 | return 0; |
| 257 | } | 257 | } |
| 258 | if (memcmp(buf1, buf2, i) != 0) | 258 | if (memcmp(buf1, buf2, i) != 0) |
| 259 | return (1); | 259 | return 1; |
| 260 | } | 260 | } |
| 261 | } | 261 | } |
| 262 | 262 | ||
| @@ -333,7 +333,7 @@ static int isqrt(int n) | |||
| 333 | int y, x = 1; | 333 | int y, x = 1; |
| 334 | 334 | ||
| 335 | if (n == 0) | 335 | if (n == 0) |
| 336 | return (0); | 336 | return 0; |
| 337 | 337 | ||
| 338 | do { | 338 | do { |
| 339 | y = x; | 339 | y = x; |
| @@ -610,7 +610,7 @@ static int fetch(long *f, int a, int b, FILE * lb, int ch) | |||
| 610 | int i, j, c, lastc, col, nc; | 610 | int i, j, c, lastc, col, nc; |
| 611 | 611 | ||
| 612 | if (a > b) | 612 | if (a > b) |
| 613 | return (0); | 613 | return 0; |
| 614 | for (i = a; i <= b; i++) { | 614 | for (i = a; i <= b; i++) { |
| 615 | fseek(lb, f[i - 1], SEEK_SET); | 615 | fseek(lb, f[i - 1], SEEK_SET); |
| 616 | nc = f[i] - f[i - 1]; | 616 | nc = f[i] - f[i - 1]; |
| @@ -623,7 +623,7 @@ static int fetch(long *f, int a, int b, FILE * lb, int ch) | |||
| 623 | for (j = 0, lastc = '\0'; j < nc; j++, lastc = c) { | 623 | for (j = 0, lastc = '\0'; j < nc; j++, lastc = c) { |
| 624 | if ((c = getc(lb)) == EOF) { | 624 | if ((c = getc(lb)) == EOF) { |
| 625 | puts("\n\\ No newline at end of file"); | 625 | puts("\n\\ No newline at end of file"); |
| 626 | return (0); | 626 | return 0; |
| 627 | } | 627 | } |
| 628 | if (c == '\t' && (cmd_flags & FLAG_t)) { | 628 | if (c == '\t' && (cmd_flags & FLAG_t)) { |
| 629 | do { | 629 | do { |
| @@ -635,7 +635,7 @@ static int fetch(long *f, int a, int b, FILE * lb, int ch) | |||
| 635 | } | 635 | } |
| 636 | } | 636 | } |
| 637 | } | 637 | } |
| 638 | return (0); | 638 | return 0; |
| 639 | } | 639 | } |
| 640 | 640 | ||
| 641 | static int asciifile(FILE * f) | 641 | static int asciifile(FILE * f) |
| @@ -646,18 +646,18 @@ static int asciifile(FILE * f) | |||
| 646 | #endif | 646 | #endif |
| 647 | 647 | ||
| 648 | if ((cmd_flags & FLAG_a) || f == NULL) | 648 | if ((cmd_flags & FLAG_a) || f == NULL) |
| 649 | return (1); | 649 | return 1; |
| 650 | 650 | ||
| 651 | #if ENABLE_FEATURE_DIFF_BINARY | 651 | #if ENABLE_FEATURE_DIFF_BINARY |
| 652 | rewind(f); | 652 | rewind(f); |
| 653 | cnt = fread(buf, 1, sizeof(buf), f); | 653 | cnt = fread(buf, 1, sizeof(buf), f); |
| 654 | for (i = 0; i < cnt; i++) { | 654 | for (i = 0; i < cnt; i++) { |
| 655 | if (!isprint(buf[i]) && !isspace(buf[i])) { | 655 | if (!isprint(buf[i]) && !isspace(buf[i])) { |
| 656 | return (0); | 656 | return 0; |
| 657 | } | 657 | } |
| 658 | } | 658 | } |
| 659 | #endif | 659 | #endif |
| 660 | return (1); | 660 | return 1; |
| 661 | } | 661 | } |
| 662 | 662 | ||
| 663 | /* dump accumulated "unified" diff changes */ | 663 | /* dump accumulated "unified" diff changes */ |
