summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-12-14 09:00:08 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-12-14 09:00:08 +0000
commit17a5fa1b4344199cef86c2cea4f1ba35f021593d (patch)
treea85bb7fdd3bbae60a1a69b2efa898ce949f8e2ac /ruby.c
parent11187ce939d94c3a2f6d9239114c2696a8271834 (diff)
1.1c final (hopefully)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@347 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 6f2b1d8ebb..9e060c0783 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
@@ -615,6 +619,7 @@ set_arg0(val, id)
static int len;
if (origargv == 0) Fail("$0 not initialized");
+#ifndef __hpux
if (len == 0) {
s = origargv[0];
s += strlen(s);
@@ -625,7 +630,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';
@@ -638,6 +645,21 @@ set_arg0(val, id)
*s++ = ' ';
}
rb_progname = str_taint(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