* io.c (argf_read): should not terminate on empty string; wait

until real EOF.  [ruby-dev:21969]

* io.c (argf_read): should adjust length to read, when length is
  specified and read spans command line argument files.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2003-12-03 17:30:09 +00:00
parent ad27a14136
commit 4f5976cbb8
4 changed files with 25 additions and 8 deletions

View File

@ -1,3 +1,11 @@
Thu Dec 4 01:45:24 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* io.c (argf_read): should not terminate on empty string; wait
until real EOF. [ruby-dev:21969]
* io.c (argf_read): should adjust length to read, when length is
specified and read spans command line argument files.
Wed Dec 3 19:38:36 2003 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
* lib/drb/drb.rb: correct fcntl parameter. [ruby-dev:22120]

20
io.c
View File

@ -3828,16 +3828,24 @@ argf_read(argc, argv)
else {
tmp = io_read(argc, argv, current_file);
}
if (NIL_P(tmp) && next_p != -1) {
argf_close(current_file);
next_p = 1;
if (argc == 0) goto retry;
if (NIL_P(tmp)) {
if (next_p != -1) {
argf_close(current_file);
next_p = 1;
goto retry;
}
return str;
}
if (NIL_P(tmp) || RSTRING(tmp)->len == 0) return str;
else if (NIL_P(str)) str = tmp;
else rb_str_append(str, tmp);
if (argc == 0) goto retry;
if (argc == 1) {
if (RSTRING(str)->len < len) {
len -= RSTRING(str)->len;
argv[0] = INT2NUM(len);
goto retry;
}
}
return str;
}

View File

@ -46,6 +46,7 @@ class Delegator
end
end
end
alias initialize_methods initialize
def __getobj__
raise NotImplementedError, "need to define `__getobj__'"
@ -55,7 +56,7 @@ class Delegator
__getobj__
end
def marshal_load(obj)
initialize(obj)
initialize_methods(obj)
end
end

View File

@ -3,7 +3,7 @@ require 'test/unit'
$KCODE = 'none'
class TestEnv < Test::Unit::TestCase
IGNORE_CASE = /djgpp|bccwin|mswin|mingw|emx/ =~ RUBY_PLATFORM
IGNORE_CASE = /djgpp|bccwin|mswin|mingw/ =~ RUBY_PLATFORM
def setup
@backup = ENV['test']