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 | 43373faa32b613b227c614671492ed1a571fa901 (patch) | |
tree | e379d57a79fcd940058c53b335f5c17b605c4285 /io.c | |
parent | 0d0c4be9181c0dbd07965ce353d0118312afc04f (diff) | |
download | ruby-43373faa32b613b227c614671492ed1a571fa901.tar.gz ruby-43373faa32b613b227c614671492ed1a571fa901.tar.xz ruby-43373faa32b613b227c614671492ed1a571fa901.zip |
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@5096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -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; } |