# HG changeset patch # User jwe # Date 1040171669 0 # Node ID 0179e6309248bb1d901dd9862f51a9376be23689 # Parent 5ebaf7eee36ed15dd4051a4135e215f80334440e [project @ 2002-12-18 00:34:29 by jwe] diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,11 @@ 2002-12-17 John W. Eaton + * variables.cc (Fclear): Fix off-by-one error. + + * oct-stream.cc (octave_base_stream::do_gets): Correctly read + last line of file even if it does not end with new line + character. + * pt-select.cc (equal): Don't look up == op, just try it and see whether it works. diff --git a/src/oct-stream.cc b/src/oct-stream.cc --- a/src/oct-stream.cc +++ b/src/oct-stream.cc @@ -974,26 +974,22 @@ break; } - if (is.fail ()) - { - err = true; - std::string msg = fcn; - msg.append (": read error"); - error (msg); - } - else if (char_count == 0 && is.eof ()) - { - err = true; - std::string msg = fcn; - msg.append (": at end of file"); - error (msg); - } - else + if (is.good () || (is.eof () && char_count > 0)) { buf << OSSTREAM_ENDS; retval = OSSTREAM_STR (buf); OSSTREAM_FREEZE (buf); } + else + { + err = true; + std::string msg = fcn; + if (is.eof () && char_count == 0) + msg.append (": at end of file"); + else + msg.append (": read error"); + error (msg); + } } else { diff --git a/src/variables.cc b/src/variables.cc --- a/src/variables.cc +++ b/src/variables.cc @@ -1700,7 +1700,7 @@ break; } - if (idx < argc) + if (idx <= argc) { if (! have_dash_option) {