summaryrefslogtreecommitdiff
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
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
-rw-r--r--ChangeLog26
-rw-r--r--config.guess15
-rw-r--r--configure.in38
-rw-r--r--dln.c17
-rw-r--r--eval.c46
-rw-r--r--ext/extmk.rb.in15
-rw-r--r--ext/tk/lib/tkfont.rb31
-rw-r--r--hash.c4
-rw-r--r--intern.h2
-rw-r--r--lib/delegate.rb16
-rw-r--r--lib/mkmf.rb10
-rw-r--r--pack.c151
-rw-r--r--process.c26
-rw-r--r--ruby.c22
-rw-r--r--sample/cal.rb4
-rw-r--r--top.sed2
16 files changed, 324 insertions, 101 deletions
diff --git a/ChangeLog b/ChangeLog
index b60d6ada2b..420074acfa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+Wed Dec 9 13:37:12 1998 MAEDA shugo <shugo@aianet.ne.jp>
+
+ * pack.c (encodes): use buffering for B-encoding.
+
+ * pack.c (pack_pack): Q-encoding by 'M'.
+
+Mon Dec 7 18:24:50 1998 WATANABE Tetsuya <tetsu@jpn.hp.com>
+
+ * ruby.c (set_arg0): $0 supprt for HP-UX.
+
+Mon Dec 7 01:30:28 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * dln.c (dln_strerror): better error messages on win32.
+
+Thu Dec 3 16:50:17 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/extmk.rb.in (realclean): trouble on install.
+
+Sun Nov 29 22:25:39 1998 Takaaki Tateishi <ttate@jaist.ac.jp>
+
+ * process.c (f_exec): check number of argument.
+
+Thu Nov 26 17:27:30 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1c9 released.
+
Wed Nov 25 13:07:12 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
* parse.y (yycompile): reduce known memory leak (hard to remove).
diff --git a/config.guess b/config.guess
index d62857905a..d1eb24fcc1 100644
--- a/config.guess
+++ b/config.guess
@@ -740,6 +740,21 @@ EOF
BePC:BeOS:*:*)
echo i586-pc-beos
exit 0 ;;
+
+ *:Rhapsody:*:*)
+ arch=`/usr/bin/arch`
+ case "$arch" in
+ ppc)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ ;;
+ i[3456]86)
+ echo i386-apple-rhapsody${UNAME_RELEASE}
+ ;;
+ *)
+ echo $arch-apple-rhapsody${UNAME_RELEASE}
+ ;;
+ esac
+ exit 0 ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
diff --git a/configure.in b/configure.in
index b978754f05..9ef13c52a3 100644
--- a/configure.in
+++ b/configure.in
@@ -34,25 +34,37 @@ fat_binary=no
AC_ARG_ENABLE( fat-binary,
[--enable-fat-binary build a NeXT/Apple Multi Architecture Binary. ],
[ fat_binary=$enableval ] )
- if test "$fat_binary" = yes ; then
+ if test "$fat_binary" = yes ; then
AC_MSG_CHECKING( target architecture )
- if test "$host_os" = "rhapsody" ; then
- echo -n "Rhapsody: "
- if test "$TARGET_ARCHS" = "" ; then
- TARGET_ARCHS="ppc i486"
+ case "$host_os" in
+ rhapsody*)
+ echo -n "MacOS X Server: "
+ if test "$TARGET_ARCHS" = "" ; then
+ TARGET_ARCHS="ppc i386"
fi
- else
+ ;;
+ nextstep*|openstep*)
echo -n "NeXTSTEP/OPENSTEP: "
- if test "$TARGET_ARCHS" = "" ; then
- if test `/usr/bin/arch` = "m68k" ; then
- TARGET_ARCHS="m68k i486"
- else
- TARGET_ARCHS="m68k `/usr/bin/arch`"
- fi
+
+ if test "$host_os" = "rhapsody" ; then
+ echo -n "Rhapsody: "
+ if test "$TARGET_ARCHS" = "" ; then
+ TARGET_ARCHS="ppc i486"
+ fi
+ else
+ echo -n "NeXTSTEP/OPENSTEP: "
+ if test "$TARGET_ARCHS" = "" ; then
+ if test `/usr/bin/arch` = "m68k" ; then
+ TARGET_ARCHS="m68k i486"
+ else # Black and Native one
+ TARGET_ARCHS="m68k `/usr/bin/arch`"
+ fi
+ fi
fi
- fi
+ ;;
+ esac
# /usr/lib/arch_tool -archify_list $TARGET_ARCHS
for archs in $TARGET_ARCHS
do
diff --git a/dln.c b/dln.c
index 9fe4208f4c..d9c129532e 100644
--- a/dln.c
+++ b/dln.c
@@ -1129,15 +1129,22 @@ dln_strerror()
#ifdef _WIN32
static char message[1024];
+ int error = GetLastError();
+ char *p = message;
+ p += sprintf(message, "%d: ", error);
FormatMessage(
FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
- GetLastError(),
- MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
- message,
- sizeof message,
+ error,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ p,
+ sizeof message - strlen(message),
NULL);
+ for (p = message; *p; p++) {
+ if (*p == '\n' || *p == '\r')
+ *p = ' ';
+ }
return message;
#endif
}
@@ -1213,7 +1220,7 @@ dln_load(file)
/* Load file */
if ((handle =
LoadLibraryExA(winfile, NULL, LOAD_WITH_ALTERED_SEARCH_PATH)) == NULL) {
- printf("LoadLibraryExA\n");
+ printf("LoadLibraryExA: %s\n", winfile);
goto failed;
}
diff --git a/eval.c b/eval.c
index c024a56502..a1f35d6822 100644
--- a/eval.c
+++ b/eval.c
@@ -385,7 +385,10 @@ static struct SCOPE *top_scope;
_frame.cbase = the_frame->cbase; \
the_frame = &_frame; \
-#define POP_FRAME() the_frame = _frame.prev; }
+#define POP_FRAME() \
+ sourcefile = _frame.file; \
+ sourceline = _frame.line; \
+ the_frame = _frame.prev; }
struct BLOCK {
NODE *var;
@@ -6256,6 +6259,34 @@ int thread_tick = THREAD_TICK;
static VALUE thread_raise _((int, VALUE*, VALUE));
+#if defined(HAVE_SETITIMER) && !defined(__BOW__)
+static int thread_init = 0;
+
+void
+thread_start_timer()
+{
+ struct itimerval tval;
+
+ if (!thread_init) return;
+ tval.it_interval.tv_sec = 0;
+ tval.it_interval.tv_usec = 100000;
+ tval.it_value = tval.it_interval;
+ setitimer(ITIMER_VIRTUAL, &tval, NULL);
+}
+
+void
+thread_stop_timer()
+{
+ struct itimerval tval;
+
+ if (!thread_init) return;
+ tval.it_interval.tv_sec = 0;
+ tval.it_interval.tv_usec = 0;
+ tval.it_value = tval.it_interval;
+ setitimer(ITIMER_VIRTUAL, &tval, NULL);
+}
+#endif
+
VALUE
thread_create(fn, arg)
VALUE (*fn)();
@@ -6267,11 +6298,7 @@ thread_create(fn, arg)
enum thread_status status;
#if defined(HAVE_SETITIMER) && !defined(__BOW__)
- static init = 0;
-
- if (!init) {
- struct itimerval tval;
-
+ if (!thread_init) {
#ifdef POSIX_SIGNAL
posix_signal(SIGVTALRM, catch_timer);
posix_signal(SIGALRM, catch_timer);
@@ -6280,11 +6307,8 @@ thread_create(fn, arg)
signal(SIGALRM, catch_timer);
#endif
- tval.it_interval.tv_sec = 0;
- tval.it_interval.tv_usec = 100000;
- tval.it_value = tval.it_interval;
- setitimer(ITIMER_VIRTUAL, &tval, NULL);
- init = 1;
+ thread_init = 1;
+ thread_start_timer();
}
#endif
diff --git a/ext/extmk.rb.in b/ext/extmk.rb.in
index b60951538d..e1623529b6 100644
--- a/ext/extmk.rb.in
+++ b/ext/extmk.rb.in
@@ -313,11 +313,11 @@ archdir = $(pkglibdir)/@arch@
mfile.printf $objs.join(" ")
mfile.printf "\n"
- mfile.printf "\
-TARGET = %s.%s
+ mfile.printf << EOS
+TARGET = #{target}.#{$static ? "a" : "@DLEXT@"}
-INSTALL = %s@INSTALL@
-INSTALL_DATA = %s@INSTALL_DATA@
+INSTALL = #{$dots}@INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
binsuffix = @binsuffix@
@@ -328,16 +328,15 @@ clean:; @rm -f *.o *.a *.so *.sl
@rm -f core ruby$(binsuffix) *~
realclean: clean
-", target,
- if $static then "a" else "@DLEXT@" end, $dots, $dots
+EOS
- mfile.printf "\
+ mfile.printf <<EOS
install:
@test -d $(DESTDIR)$(libdir) || mkdir $(DESTDIR)$(libdir)
@test -d $(DESTDIR)$(pkglibdir) || mkdir $(DESTDIR)$(pkglibdir)
@test -d $(DESTDIR)$(archdir) || mkdir $(DESTDIR)$(archdir)
-"
+EOS
if !$static
mfile.printf "\
$(INSTALL) $(TARGET) $(DESTDIR)$(archdir)/$(TARGET)
diff --git a/ext/tk/lib/tkfont.rb b/ext/tk/lib/tkfont.rb
index 1c11f8f842..e0394dc880 100644
--- a/ext/tk/lib/tkfont.rb
+++ b/ext/tk/lib/tkfont.rb
@@ -26,9 +26,9 @@ class TkFont
when /^8\.*/
if window
- list(tk_call('font', 'families', '-displayof', window))
+ tk_split_simplelist(tk_call('font', 'families', '-displayof', window))
else
- list(tk_call('font', 'families'))
+ tk_split_simplelist(tk_call('font', 'families'))
end
end
end
@@ -64,7 +64,9 @@ class TkFont
def TkFont.init_widget_font(path, *args)
case (Tk::TK_VERSION)
when /^4\.*/
- conf = tk_split_list(tk_call(*args))
+ conf = tk_split_simplelist(tk_call(*args)).
+ find_all{|prop| prop[0..5]=='-font ' || prop[0..10]=='-kanjifont '}.
+ collect{|prop| tk_split_simplelist(prop)}
if font_inf = conf.assoc('-font')
ltn = font_inf[4]
ltn = nil if ltn == []
@@ -81,11 +83,13 @@ class TkFont
TkFont.new(ltn, knj).call_font_configure(path, *(args + [{}]))
when /^8\.*/
- conf = tk_split_list(tk_call(*args))
- unless font_inf = conf.assoc('-font')
+ font_prop = tk_split_simplelist(tk_call(*args)).find{|prop|
+ prop[0..5] == '-font '
+ }
+ unless font_prop
raise RuntimeError, "unknown option '-font'"
end
- fnt = font_inf[4]
+ fnt = tk_split_simplelist(font_prop)[4]
if fnt == []
TkFont.new(nil, nil).call_font_configure(path, *(args + [{}]))
else
@@ -343,7 +347,7 @@ class TkFont
if JAPANIZED_TK
@fontslot = {'font'=>@compoundfont}
tk_call('font', 'create', @compoundfont,
- '-compound', "#{@latinfont} #{@kanjifont}", *hash_kv(keys))
+ '-compound', [@latinfont, @kanjifont], *hash_kv(keys))
else
tk_call('font', 'create', @compoundfont)
latinkeys = {}
@@ -409,11 +413,12 @@ class TkFont
tk_call('font', 'actual', font, "-displayof", window, "-#{option}")
end
else
- l = tk_split_list(if window
- tk_call('font', 'actual', font, "-displayof", window)
- else
- tk_call('font', 'actual', font)
- end)
+ l = tk_split_simplelist(if window
+ tk_call('font', 'actual', font,
+ "-displayof", window)
+ else
+ tk_call('font', 'actual', font)
+ end)
r = []
while key=l.shift
if key == '-compound'
@@ -455,7 +460,7 @@ class TkFont
elsif option
tk_call('font', 'configure', font, "-#{option}")
else
- l = tk_split_list(tk_call('font', 'configure', font))
+ l = tk_split_simplelist(tk_call('font', 'configure', font))
r = []
while key=l.shift
if key == '-compound'
diff --git a/hash.c b/hash.c
index 56256ea3fe..cd00832a39 100644
--- a/hash.c
+++ b/hash.c
@@ -1002,7 +1002,7 @@ static VALUE
env_each(hash)
VALUE hash;
{
- VALUE ary = env_keys();
+ volatile VALUE ary = env_keys();
VALUE *ptr = RARRAY(ary)->ptr;
int len = RARRAY(ary)->len;
@@ -1019,7 +1019,7 @@ env_each(hash)
static VALUE
env_delete_if()
{
- VALUE ary = env_keys();
+ volatile VALUE ary = env_keys();
VALUE *ptr = RARRAY(ary)->ptr;
int len = RARRAY(ary)->len;
diff --git a/intern.h b/intern.h
index 35c599788c..2af9d24e8d 100644
--- a/intern.h
+++ b/intern.h
@@ -124,6 +124,8 @@ VALUE class_new_instance _((int, VALUE*, VALUE));
VALUE f_lambda _((void));
void rb_set_end_proc _((void (*)(),VALUE));
void gc_mark_threads _((void));
+void thread_start_timer _((void));
+void thread_stop_timer _((void));
void thread_schedule _((void));
void thread_wait_fd _((int));
void thread_fd_writable _((int));
diff --git a/lib/delegate.rb b/lib/delegate.rb
index 16e68c9d6c..ce2bbc241b 100644
--- a/lib/delegate.rb
+++ b/lib/delegate.rb
@@ -20,11 +20,13 @@ class Delegator
def initialize(obj)
preserved = ::Kernel.instance_methods
+ preserved -= ["to_s","to_a","inspect","==","=~","==="]
for t in self.type.ancestors
preserved |= t.instance_methods
+ preserved |= t.private_instance_methods
+ preserved |= t.protected_instance_methods
break if t == Delegator
end
- preserved -= ["to_s","to_a","inspect","hash","eql?","==","=~","==="]
for method in obj.methods
next if preserved.include? method
eval <<EOS
@@ -32,8 +34,14 @@ def self.#{method}(*args, &block)
begin
__getobj__.__send__(:#{method}, *args, &block)
rescue Exception
- n = if /:in `__getobj__'$/ =~ $@[0] then 1 else 2 end #`
- $@[1,n] = nil
+ c = -caller(0).size
+ if /:in `__getobj__'$/ =~ $@[c-1] #`
+ n = 1
+ else
+ c -= 2
+ n = 3
+ end
+ $@[c,n] = nil
raise
end
end
@@ -72,7 +80,7 @@ def DelegateClass(superclass)
klass = Class.new
methods = superclass.instance_methods
methods -= ::Kernel.instance_methods
- methods |= ["to_s","to_a","inspect","hash","eql?","==","=~","==="]
+ methods |= ["to_s","to_a","inspect","==","=~","==="]
klass.module_eval <<EOS
def initialize(obj)
@obj = obj
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 0aa9d98b9c..218b3b19f6 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -289,7 +289,8 @@ LDSHARED = #{CONFIG["LDSHARED"]}
prefix = #{CONFIG["prefix"]}
exec_prefix = #{CONFIG["exec_prefix"]}
-libdir = #{$archdir}
+libdir = #{$libdir}
+archdir = #{$archdir}
#### End of system configuration section. ####
@@ -312,11 +313,12 @@ clean:; @rm -f *.o *.so *.sl
realclean: clean
-install: $(libdir)/$(TARGET)
+install: $(archdir)/$(TARGET)
-$(libdir)/$(TARGET): $(TARGET)
+$(archdir)/$(TARGET): $(TARGET)
@test -d $(libdir) || mkdir $(libdir)
- $(INSTALL) $(TARGET) $(libdir)/$(TARGET)
+ @test -d $(archdir) || mkdir $(archdir)
+ $(INSTALL) $(TARGET) $(archdir)/$(TARGET)
EOMF
install_rb(mfile)
mfile.printf "\n"
diff --git a/pack.c b/pack.c
index 840b837ce5..903f5a9bc0 100644
--- a/pack.c
+++ b/pack.c
@@ -77,6 +77,7 @@ endian()
static char *toofew = "too few arguments";
static void encodes _((VALUE,char*,int,int));
+static void qpencode _((VALUE,VALUE,int));
static void
pack_add_ptr(str, add)
@@ -469,6 +470,13 @@ pack_pack(ary, fmt)
}
break;
+ case 'M':
+ from = obj_as_string(NEXTFROM);
+ if (len <= 1)
+ len = 72;
+ qpencode(res, from, len);
+ break;
+
case 'P':
len = 1;
/* FALL THROUGH */
@@ -505,38 +513,121 @@ encodes(str, s, len, type)
int len;
int type;
{
- char hunk[4];
+ char *buff = ALLOCA_N(char, len * 4 / 3 + 6);
+ int i = 0;
char *p, *pend;
char *trans = type == 'u' ? uu_table : b64_table;
int padding;
if (type == 'u') {
- *hunk = len + ' ';
- str_cat(str, hunk, 1);
+ buff[i++] = len + ' ';
padding = '`';
}
else {
padding = '=';
}
- while (len > 0) {
- hunk[0] = trans[077 & (*s >> 2)];
- hunk[1] = trans[077 & (((*s << 4) & 060) | ((s[1] >> 4) & 017))];
- hunk[2] = trans[077 & (((s[1] << 2) & 074) | ((s[2] >> 6) & 03))];
- hunk[3] = trans[077 & s[2]];
- str_cat(str, hunk, 4);
+ while (len >= 3) {
+ buff[i++] = trans[077 & (*s >> 2)];
+ buff[i++] = trans[077 & (((*s << 4) & 060) | ((s[1] >> 4) & 017))];
+ buff[i++] = trans[077 & (((s[1] << 2) & 074) | ((s[2] >> 6) & 03))];
+ buff[i++] = trans[077 & s[2]];
s += 3;
len -= 3;
}
- p = RSTRING(str)->ptr;
- pend = RSTRING(str)->ptr + RSTRING(str)->len;
- if (len == -1) {
- pend[-1] = padding;
+ if (len == 2) {
+ buff[i++] = trans[077 & (*s >> 2)];
+ buff[i++] = trans[077 & (((*s << 4) & 060) | ((s[1] >> 4) & 017))];
+ buff[i++] = trans[077 & (((s[1] << 2) & 074) | (('\0' >> 6) & 03))];
+ buff[i++] = padding;
}
- else if (len == -2) {
- pend[-2] = padding;
- pend[-1] = padding;
+ else if (len == 1) {
+ buff[i++] = trans[077 & (*s >> 2)];
+ buff[i++] = trans[077 & (((*s << 4) & 060) | (('\0' >> 4) & 017))];
+ buff[i++] = padding;
+ buff[i++] = padding;
+ }
+ buff[i++] = '\n';
+ str_cat(str, buff, i);
+}
+
+static char hex_table[] = "0123456789ABCDEF";
+
+static void
+qpencode(str, from, len)
+ VALUE str, from;
+ int len;
+{
+ char buff[1024];
+ int i = 0, n = 0, prev = EOF;
+ unsigned char *s = RSTRING(from)->ptr;
+ unsigned char *send = s + RSTRING(from)->len;
+
+ while (s < send) {
+ if ((*s > 126) ||
+ (*s < 32 && *s != '\n' && *s != '\t') ||
+ (*s == '=')) {
+ buff[i++] = '=';
+ buff[i++] = hex_table[*s >> 4];
+ buff[i++] = hex_table[*s & 0x0f];
+ n += 3;
+ prev = EOF;
+ }
+ else if (*s == '\n') {
+ if (prev == ' ' || prev == '\t') {
+ buff[i++] = '=';
+ buff[i++] = *s;
+ }
+ buff[i++] = *s;
+ n = 0;
+ prev = *s;
+ }
+ else {
+ buff[i++] = *s;
+ n++;
+ prev = *s;
+ }
+ if (n > len) {
+ buff[i++] = '=';
+ buff[i++] = '\n';
+ n = 0;
+ prev = '\n';
+ }
+ if (i > 1024 - 5) {
+ str_cat(str, buff, i);
+ i = 0;
+ }
+ s++;
+ }
+ if (n > 0) {
+ buff[i++] = '=';
+ buff[i++] = '\n';
+ }
+ if (i > 0) {
+ str_cat(str, buff, i);
+ }
+}
+
+#if defined(__GNUC__) && __GNUC__ >= 2 && !defined(RUBY_NO_INLINE)
+static __inline__ int
+#else
+static int
+#endif
+hex2num(c)
+ char c;
+{
+ switch (c) {
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ return c - '0';
+ case 'a': case 'b': case 'c':
+ case 'd': case 'e': case 'f':
+ return c - 'a' + 10;
+ case 'A': case 'B': case 'C':
+ case 'D': case 'E': case 'F':
+ return c - 'A' + 10;
+ default:
+ return -1;
}
- str_cat(str, "\n", 1);
}
static VALUE
@@ -929,6 +1020,32 @@ pack_unpack(str, fmt)
}
break;
+ case 'M':
+ {
+ VALUE str = str_new(0, send - s);
+ char *ptr = RSTRING(str)->ptr;
+ int c1, c2;
+
+ while (s < send) {
+ if (*s == '=') {
+ if (++s == send) break;
+ if (*s != '\n' && s < send - 1) {
+ if ((c1 = hex2num(*s)) == -1) break;
+ if (++s == send) break;
+ if ((c2 = hex2num(*s)) == -1) break;
+ *ptr++ = c1 << 4 | c2;
+ }
+ }
+ else {
+ *ptr++ = *s;
+ }
+ s++;
+ }
+ RSTRING(str)->len = ptr - RSTRING(str)->ptr;
+ ary_push(ary, str);
+ }
+ break;
+
case '@':
s = RSTRING(str)->ptr + len;
break;
diff --git a/process.c b/process.c
index dd7d5cf963..e96f5d6974 100644
--- a/process.c
+++ b/process.c
@@ -213,27 +213,8 @@ f_waitpid(obj, vpid, vflags)
char *strtok();
#if defined(THREAD) && defined(HAVE_SETITIMER)
-static void
-before_exec()
-{
- struct itimerval tval;
-
- tval.it_interval.tv_sec = 0;
- tval.it_interval.tv_usec = 0;
- tval.it_value = tval.it_interval;
- setitimer(ITIMER_VIRTUAL, &tval, NULL);
-}
-
-static void
-after_exec()
-{
- struct itimerval tval;
-
- tval.it_interval.tv_sec = 0;
- tval.it_interval.tv_usec = 100000;
- tval.it_value = tval.it_interval;
- setitimer(ITIMER_VIRTUAL, &tval, NULL);
-}
+#define before_exec() thread_stop_timer()
+#define after_exec() thread_start_timer()
#else
#define before_exec()
#define after_exec()
@@ -503,6 +484,9 @@ f_exec(argc, argv)
VALUE prog = 0;
int i;
+ if (argc == 0) {
+ ArgError("wrong # of arguments");
+ }
if (TYPE(argv[0]) == T_ARRAY) {
if (RARRAY(argv[0])->len != 2) {
ArgError("wrong first argument");
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
diff --git a/sample/cal.rb b/sample/cal.rb
index b0f5d88335..a5f4b4db18 100644
--- a/sample/cal.rb
+++ b/sample/cal.rb
@@ -1,7 +1,7 @@
#! /usr/local/bin/ruby
# cal.rb (bsd compatible version): Written by Tadayoshi Funaba 1998
-# $Id: bsdcal.rb,v 1.1 1998/06/01 12:53:01 tadf Exp $
+# $Id: bsdcal.rb,v 1.2 1998/12/01 13:47:40 tadf Exp $
require 'date2'
@@ -59,7 +59,7 @@ def zip(xs)
until xs.empty?
ln = (if $jd then l, r, *xs = xs; [l, r]
else l, c, r, *xs = xs; [l, c, r] end).
- collect{|x| x.split(/\n/no)}
+ collect{|x| x.split(/\n/no, -1)}
8.times do
yr << ln.collect{|x|
x.shift.ljust((($w + 1) * 7) - 1)}.join(' ') << "\n"
diff --git a/top.sed b/top.sed
index bb9a96c146..a9ec12f7b6 100644
--- a/top.sed
+++ b/top.sed
@@ -33,7 +33,7 @@ s%@AR@%ar%g
s%@INSTALL_PROGRAM@%${INSTALL}%g
s%@INSTALL_DATA@%${INSTALL} -m 644%g
s%@SET_MAKE@%%g
-s%@LIBOBJS@% crypt.o flock.o snprintf.o%g
+s%@LIBOBJS@% crypt.o flock.o vsnprintf.o%g
s%@ALLOCA@%%g
s%@DLDFLAGS@%%g
s%@STATIC@%%g