mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-27 13:30:05 +00:00
Fix extra fread after EOF, non-wires-crossed version.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105270 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
11fe24624a
commit
c6e1f67b17
@ -26,13 +26,15 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
NumLines = 0;
|
||||
while ((NumRead = fread(Buffer, 1, sizeof(Buffer), stdin))) {
|
||||
do {
|
||||
unsigned i;
|
||||
|
||||
NumRead = fread(Buffer, 1, sizeof(Buffer), stdin);
|
||||
|
||||
for (i = 0; i != NumRead; ++i)
|
||||
if (Buffer[i] == '\n')
|
||||
++NumLines;
|
||||
}
|
||||
} while (NumRead == sizeof(Buffer));
|
||||
|
||||
if (!feof(stdin)) {
|
||||
fprintf(stderr, "%s: error reading stdin\n", argv[0]);
|
||||
|
Loading…
Reference in New Issue
Block a user