1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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> 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] * lib/drb/drb.rb: correct fcntl parameter. [ruby-dev:22120]

20
io.c
View file

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

View file

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

View file

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