diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-09-03 05:37:42 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-09-03 05:37:42 +0000 |
commit | 0f35b58a2fbae58a20979de77a3a642c42f41899 (patch) | |
tree | cab4099dba0fde8650c94226a1f9ce94549561c9 /io.c | |
parent | c9d1be6327640aa5bc01f8c6c8846e4e3fb31337 (diff) |
* ruby.c (proc_options): should not alter origargv[].
* ruby.c (set_arg0): long strings for $0 dumped core.
* ruby.c (set_arg0): use setprogtitle() if it's available.
* io.c (rb_io_popen): accept integer flags as mode.
* file.c (rb_find_file_ext): extension table can be supplied from
outside. renamed.
* eval.c (rb_f_require): replace rb_find_file_noext by
rb_find_file_ext.
* eval.c (rb_provided): should also check feature without
extension.
* numeric.c (flo_to_s): do not rely on decimal point to be '.'
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -1339,7 +1339,7 @@ rb_io_binmode_flags(mode) return flags; } -int +static int rb_io_mode_binmode(mode) const char *mode; { @@ -1378,10 +1378,9 @@ rb_io_mode_binmode(mode) } static char* -rb_io_modestr(flags) +rb_io_binmode_mode(flags, mode) int flags; { - static char mode[4]; char *p = mode; switch (flags & (O_RDONLY|O_WRONLY|O_RDWR)) { @@ -1517,11 +1516,12 @@ rb_file_sysopen_internal(io, fname, flags, mode) OpenFile *fptr; int fd; char *m; + char mbuf[4]; MakeOpenFile(io, fptr); fd = rb_sysopen(fname, flags, mode); - m = rb_io_modestr(flags); + m = rb_io_binmode_mode(flags, mbuf); fptr->mode = rb_io_binmode_flags(flags); fptr->f = rb_fdopen(fd, m); fptr->path = strdup(fname); @@ -1760,10 +1760,14 @@ rb_io_popen(str, argc, argv, klass) { char *mode; VALUE pname, pmode, port; + char mbuf[4]; if (rb_scan_args(argc, argv, "11", &pname, &pmode) == 1) { mode = "r"; } + else if (FIXNUM_P(pmode)) { + mode = rb_io_binmode_mode(FIX2INT(pmode), mbuf); + } else { mode = StringValuePtr(pmode); } @@ -1817,7 +1821,7 @@ rb_open_file(argc, argv, io) if (FIXNUM_P(vmode) || !NIL_P(perm)) { flags = FIXNUM_P(vmode) ? NUM2INT(vmode) : rb_io_mode_binmode(StringValuePtr(vmode)); fmode = NIL_P(perm) ? 0666 : NUM2INT(perm); - + file = rb_file_sysopen_internal(io, path, flags, fmode); } else { |