summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/io.c b/io.c
index a422cc0869..0375b87cc4 100644
--- a/io.c
+++ b/io.c
@@ -2156,7 +2156,9 @@ rb_f_p(argc, argv)
for (i=0; i<argc; i++) {
rb_p(argv[i]);
}
+ if (TYPE(rb_defout) == T_FILE) {
rb_io_flush(rb_defout);
+ }
return Qnil;
}
@@ -2238,8 +2240,6 @@ set_outfile(val, var, orig, stdf)
GetOpenFile(val, fptr);
rb_io_check_writable(fptr);
-
- GetOpenFile(*var, fptr);
f = GetWriteFile(fptr);
dup2(fileno(f), fileno(stdf));
@@ -2281,7 +2281,7 @@ prep_stdio(f, mode, klass)
return (VALUE)io;
}
-static VALUE
+static void
prep_path(io, path)
VALUE io;
char *path;
@@ -3095,8 +3095,9 @@ argf_tell()
}
static VALUE
-argf_seek(self, offset, ptrname)
- VALUE self, offset, ptrname;
+argf_seek(argc, argv)
+ int argc;
+ VALUE *argv;
{
if (!next_argv()) {
rb_raise(rb_eArgError, "no stream to seek");
@@ -3105,7 +3106,7 @@ argf_seek(self, offset, ptrname)
if (TYPE(current_file) != T_FILE) {
return argf_forward();
}
- return rb_io_seek(current_file, offset, ptrname);
+ return rb_io_seek(argc, argv, current_file);
}
static VALUE
@@ -3474,7 +3475,7 @@ Init_IO()
rb_define_singleton_method(argf, "getc", argf_getc, 0);
rb_define_singleton_method(argf, "readchar", argf_readchar, 0);
rb_define_singleton_method(argf, "tell", argf_tell, 0);
- rb_define_singleton_method(argf, "seek", argf_seek, 2);
+ rb_define_singleton_method(argf, "seek", argf_seek, -1);
rb_define_singleton_method(argf, "rewind", argf_rewind, 0);
rb_define_singleton_method(argf, "pos", argf_tell, 0);
rb_define_singleton_method(argf, "pos=", argf_set_pos, 1);