strings: Print strings that have the minimum length
Previously, there was an off-by-one error when determining whether to print a strings, so when the string was exactly the minimum length, it was not printed. This fixes a bug with an x264 configure test, which expects to find a string of length 4 (BIGE/EBIG) to detect system endianness.
This commit is contained in:
parent
3eb89c44aa
commit
5377a9c3d1
12
strings.c
12
strings.c
@ -23,23 +23,21 @@ strings(FILE *fp, const char *fname, size_t len)
|
|||||||
if (r == Runeerror)
|
if (r == Runeerror)
|
||||||
continue;
|
continue;
|
||||||
if (!isprintrune(r)) {
|
if (!isprintrune(r)) {
|
||||||
if (i > len)
|
if (i == len)
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
i = 0;
|
i = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (i < len) {
|
if (i == len) {
|
||||||
rbuf[i++] = r;
|
|
||||||
continue;
|
|
||||||
} else if (i > len) {
|
|
||||||
efputrune(&r, stdout, "<stdout>");
|
efputrune(&r, stdout, "<stdout>");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
rbuf[i++] = r;
|
||||||
|
if (i < len)
|
||||||
|
continue;
|
||||||
printf(format, (long)off - i);
|
printf(format, (long)off - i);
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
efputrune(rbuf + i, stdout, "<stdout>");
|
efputrune(rbuf + i, stdout, "<stdout>");
|
||||||
efputrune(&r, stdout, "<stdout>");
|
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
free(rbuf);
|
free(rbuf);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user