better fix for irix istream

This commit is contained in:
David Rose 2004-12-02 00:02:54 +00:00
parent 6ed0fe3017
commit 8d7a27547f

View File

@ -148,7 +148,7 @@ read_prc(istream &in) {
in.read(buffer, buffer_size);
size_t count = in.gcount();
while (count != 0 && !in.fail() && !in.eof()) {
while (count != 0) {
char *buffer_end = buffer + count;
// Look for the first line in the buffer..
@ -178,8 +178,16 @@ read_prc(istream &in) {
prev_line = string(start, length);
}
in.read(buffer, buffer_size);
count = in.gcount();
if (in.fail() || in.eof()) {
// If we got a failure reading the buffer last time, don't keep
// reading again. Irix seems to require this test; otherwise,
// it repeatedly returns the same text at the end of the file.
count = 0;
} else {
in.read(buffer, buffer_size);
count = in.gcount();
}
}
if (!prev_line.empty()) {