diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-12-03 17:30:09 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-12-03 17:30:09 +0000 |
commit | 4f5976cbb826df462c62a0a8e72ebe91c15a7ba4 (patch) | |
tree | e379d57a79fcd940058c53b335f5c17b605c4285 | |
parent | ad27a1413640c63310da6c25b95bb6f2fad122be (diff) | |
download | ruby-4f5976cbb826df462c62a0a8e72ebe91c15a7ba4.tar.gz |
* 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
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | io.c | 20 | ||||
-rw-r--r-- | lib/delegate.rb | 3 | ||||
-rw-r--r-- | test/ruby/test_env.rb | 2 |
4 files changed, 25 insertions, 8 deletions
@@ -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] @@ -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; } diff --git a/lib/delegate.rb b/lib/delegate.rb index 578859fdc6..41d35477e4 100644 --- a/lib/delegate.rb +++ b/lib/delegate.rb @@ -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 diff --git a/test/ruby/test_env.rb b/test/ruby/test_env.rb index 6ae28dbbee..7d660f05a5 100644 --- a/test/ruby/test_env.rb +++ b/test/ruby/test_env.rb @@ -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'] |