summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-27 06:26:41 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-27 06:26:41 +0000
commit909477ec1de6f7f89d29405eb3ad268ecbd3ebf7 (patch)
treef9afcfb5fea290a88b556158fcbc8aa3001dff8e /file.c
parent9614d22b5d6dcb4e0ee6fe12bad0c1021230cacf (diff)
* file.c (null_device): move from io.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r--file.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/file.c b/file.c
index 962fa9ac4e..8da764a4c2 100644
--- a/file.c
+++ b/file.c
@@ -5191,6 +5191,17 @@ define_filetest_function(const char *name, VALUE (*func)(ANYARGS), int argc)
rb_define_singleton_method(rb_cFile, name, func, argc);
}
+static const char null_device[] =
+#if defined DOSISH
+ "NUL"
+#elif defined AMIGA || defined __amigaos__
+ "NIL"
+#elif defined __VMS
+ "NL:"
+#else
+ "/dev/null"
+#endif
+ ;
/*
* A <code>File</code> is an abstraction of any file object accessible
@@ -5327,6 +5338,8 @@ Init_File(void)
rb_file_const("LOCK_UN", INT2FIX(LOCK_UN));
rb_file_const("LOCK_NB", INT2FIX(LOCK_NB));
+ rb_file_const("NULL", rb_obj_freeze(rb_usascii_str_new2(null_device)));
+
rb_define_method(rb_cFile, "path", rb_file_path, 0);
rb_define_method(rb_cFile, "to_path", rb_file_path, 0);
rb_define_global_function("test", rb_f_test, -1);