summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-03-22 07:26:42 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-03-22 07:26:42 +0000
commit2bd0c2bf73acd0841619f67e3448573e5b6e3064 (patch)
tree8d1f8bb30c4092ea1c809a0f7bfe65bb0cd94d66 /process.c
parent890521d11783ac21503052e2a5f86c4ddfc6a9d8 (diff)
* the VMS support patch submitted by Akiyoshi, Masamichi
<Masamichi.Akiyoshi@jp.compaq.com> is merged. * eval.c (exec_under): changing ruby_class is OK, but should not alter cbase. * eval.c (yield_under_i): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
-rw-r--r--process.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/process.c b/process.c
index 4763a87..a2b3d7c 100644
--- a/process.c
+++ b/process.c
@@ -713,7 +713,7 @@ static VALUE
rb_f_fork(obj)
VALUE obj;
{
-#if !defined(__human68k__) && !defined(NT) && !defined(__MACOS__) && !defined(__EMX__)
+#if !defined(__human68k__) && !defined(NT) && !defined(__MACOS__) && !defined(__EMX__) && !defined(__VMS)
int pid;
rb_secure(2);
@@ -886,6 +886,30 @@ rb_f_system(argc, argv)
last_status_set(status == -1 ? 127 : status);
return status == 0 ? Qtrue : Qfalse;
#else
+#if defined(__VMS)
+ VALUE cmd;
+ int status;
+
+ if (argc == 0) {
+ rb_last_status = Qnil;
+ rb_raise(rb_eArgError, "wrong number of arguments");
+ }
+
+ if (TYPE(argv[0]) == T_ARRAY) {
+ if (RARRAY(argv[0])->len != 2) {
+ rb_raise(rb_eArgError, "wrong first argument");
+ }
+ argv[0] = RARRAY(argv[0])->ptr[0];
+ }
+ cmd = rb_ary_join(rb_ary_new4(argc, argv), rb_str_new2(" "));
+
+ SafeStringValue(cmd);
+ status = system(RSTRING(cmd)->ptr);
+ last_status_set((status & 0xff) << 8);
+
+ if (status == 0) return Qtrue;
+ return Qfalse;
+#else
volatile VALUE prog = 0;
int pid;
int i;
@@ -938,6 +962,7 @@ rb_f_system(argc, argv)
if (NUM2INT(rb_last_status) == 0)
return Qtrue;
return Qfalse;
+#endif /* __VMS */
#endif /* __human68k__ */
#endif /* DJGPP */
#endif /* NT */