summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-12-16 07:30:36 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-12-16 07:30:36 +0000
commite299d511db939232c628d6880e61c32e83937d66 (patch)
treea2083bfd64a4fb3ed7454a7e7062ff9f7fa1232e /ruby.c
parentce8859c5563493a94f57d3b630e7b9c1d3cd656f (diff)
first public release of 1.1d (pre1.2) series
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1dev@354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/ruby.c b/ruby.c
index 289798ab9c..fb78235d92 100644
--- a/ruby.c
+++ b/ruby.c
@@ -20,6 +20,10 @@
#include <fcntl.h>
#include <ctype.h>
+#ifdef __hpux
+#include <sys/pstat.h>
+#endif
+
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -607,6 +611,7 @@ set_arg0(val, id)
static int len;
if (origargv == 0) rb_raise(rb_eRuntimeError, "$0 not initialized");
+#ifndef __hpux
if (len == 0) {
s = origargv[0];
s += strlen(s);
@@ -617,7 +622,9 @@ set_arg0(val, id)
}
len = s - origargv[0];
}
+#endif
s = str2cstr(val, &i);
+#ifndef __hpux
if (i > len) {
memcpy(origargv[0], s, len);
origargv[0][len] = '\0';
@@ -630,6 +637,21 @@ set_arg0(val, id)
*s++ = ' ';
}
rb_progname = rb_tainted_str_new2(origargv[0]);
+#else
+ if (i >= PST_CLEN) {
+ union pstun j;
+ j.pst_command = s;
+ i = PST_CLEN;
+ RSTRING(val)->len = i;
+ *(s + i) = '\0';
+ pstat(PSTAT_SETCMD, j, PST_CLEN, 0, 0);
+ } else {
+ union pstun j;
+ j.pst_command = s;
+ pstat(PSTAT_SETCMD, j, i, 0, 0);
+ }
+ rb_progname = str_taint(str_new(s, i));
+#endif
}
void