summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-15 04:27:14 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-15 04:27:14 +0000
commit0c9d6711c62c95e91925140076bedd9187927abe (patch)
treeb76b4ce817a4fb169dfb69caa37db2cbb5c36a4c
parentaf8fc3e717f12add33495d309ed2e70051a4f6b9 (diff)
downloadruby-0c9d6711c62c95e91925140076bedd9187927abe.tar.gz
ruby-0c9d6711c62c95e91925140076bedd9187927abe.tar.xz
ruby-0c9d6711c62c95e91925140076bedd9187927abe.zip
* io.c (set_stdio): better message.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--io.c17
2 files changed, 19 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 534bb4869..975777723 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Thu May 15 13:26:48 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (set_stdio): better message.
+
Thu May 15 13:18:11 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* io.c (set_stdio): $stdin, $stdout, $stderr now became read-only.
diff --git a/io.c b/io.c
index 8d35acee9..df0396ea0 100644
--- a/io.c
+++ b/io.c
@@ -2767,8 +2767,21 @@ set_stdio(val, id, var)
ID id;
VALUE *var;
{
- rb_warn("assignment to %s is deprecated; use STDIN.reopen() instead", rb_id2name(id));
- rb_name_error(id, "%s is a read-only variable", rb_id2name(id));
+ char *vn = rb_id2name(id);
+ char *cn = "IO#";
+
+ if (strlen(vn) > 5) {
+ switch (vn[4]) {
+ case 'i':
+ cn = "STDIN."; break;
+ case 'o':
+ cn = "STDOUT."; break;
+ case 'e':
+ cn = "STDERR."; break;
+ }
+ }
+ rb_warn("assignment to %s is deprecated; use %sreopen() instead", vn, cn);
+ rb_name_error(id, "%s is a read-only variable", vn);
}
static VALUE