From 32e799db485107ba9d47fb4fb4cd44c9d6f57b8a Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 9 Apr 1999 18:04:08 +0000 Subject: *** empty log message *** git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/debug.rb | 8 ++++---- lib/ftools.rb | 11 +++++++++++ lib/ftplib.rb | 6 +----- lib/mailread.rb | 2 +- lib/matrix.rb | 3 +-- lib/mkmf.rb | 2 +- lib/weakref.rb | 9 +++++---- 7 files changed, 24 insertions(+), 17 deletions(-) (limited to 'lib') diff --git a/lib/debug.rb b/lib/debug.rb index 90270a3fe7..430d6472f6 100644 --- a/lib/debug.rb +++ b/lib/debug.rb @@ -92,16 +92,16 @@ class DEBUGGER__ when /^c(ont)?$/ return when /^s(tep)?\s*(\d+)?$/ - if $1 - lev = Integer($1) + if $2 + lev = Integer($2) else lev = 1 end @stop_next = lev return when /^n(ext)?\s*(\d+)?$/ - if $1 - lev = Integer($1) + if $2 + lev = Integer($2) else lev = 1 end diff --git a/lib/ftools.rb b/lib/ftools.rb index 103e27adbd..7bba07e9f1 100644 --- a/lib/ftools.rb +++ b/lib/ftools.rb @@ -24,6 +24,9 @@ class << File fsize = 1024 if fsize < 512 fsize = TOO_BIG if fsize > TOO_BIG + fmode = stat(from).mode + tpath = to + from = open(from, "r") from.binmode to = open(to, "w") @@ -47,6 +50,7 @@ class << File to.close from.close end + chmod(fmode, tpath) ret end @@ -66,10 +70,17 @@ class << File if PLATFORM =~ /djgpp|cygwin|mswin32/ and FileTest.file? to unlink to end + fstat = stat(from) begin rename from, to rescue + from_stat = stat(from) syscopy from, to and unlink from + utime(from_stat.atime, from_stat.mtime, to) + begin + chown(fstat.uid, fstat.gid, tpath) + rescue + end end end diff --git a/lib/ftplib.rb b/lib/ftplib.rb index 617d85899b..4cba9c50e5 100644 --- a/lib/ftplib.rb +++ b/lib/ftplib.rb @@ -293,11 +293,7 @@ class FTP buf = file.gets break if buf == nil if buf[-2, 2] != CRLF - if buf[-1] == ?\r or - buf[-1] == ?\n - buf = buf[0 .. -2] - end - buf = buf + CRLF + buf = buf.chop + CRLF end conn.write(buf) callback.call(buf) if use_callback diff --git a/lib/mailread.rb b/lib/mailread.rb index 5e46606c09..2edcca002a 100644 --- a/lib/mailread.rb +++ b/lib/mailread.rb @@ -43,6 +43,6 @@ class Mail end def [](field) - @header[field] + @header[field.capitalize] end end diff --git a/lib/matrix.rb b/lib/matrix.rb index 4767b4b545..bca6c40c95 100644 --- a/lib/matrix.rb +++ b/lib/matrix.rb @@ -221,7 +221,6 @@ class Matrix row[j] = values[j] row } - self rows(rows, FALSE) end @@ -875,7 +874,7 @@ class Vector # ARITHMETIC - def *(x) "is matrix or number" + def *(x) # is matrix or number case x when Numeric els = @elements.collect{|e| e * x} diff --git a/lib/mkmf.rb b/lib/mkmf.rb index df03b128fc..74de7beae3 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -55,7 +55,7 @@ CFLAGS = CONFIG["CFLAGS"] if PLATFORM == "m68k-human" CFLAGS.gsub!(/-c..-stack=[0-9]+ */, '') end -if /win32|djgpp|mingw32|m68k-human/i =~ PLATFORM +if /win32|djgpp|mingw32|m68k-human|i386-os2_emx/i =~ PLATFORM $null = open("nul", "w") else $null = open("/dev/null", "w") diff --git a/lib/weakref.rb b/lib/weakref.rb index d969553090..c6fe8cd21b 100644 --- a/lib/weakref.rb +++ b/lib/weakref.rb @@ -16,8 +16,8 @@ class WeakRef [ref,...] + ID_REV_MAP = {} # ref -> obj ObjectSpace.add_finalizer(lambda{|id| rids = ID_MAP[id] if rids @@ -29,10 +29,11 @@ class WeakRef