summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-04-09 18:04:08 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-04-09 18:04:08 +0000
commit32e799db485107ba9d47fb4fb4cd44c9d6f57b8a (patch)
treee33fd45f76d7f31959c1e5298902588de716657c /lib
parent35247a52ef719584a59ae9c518523f0ee825c8e3 (diff)
*** empty log message ***
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/debug.rb8
-rw-r--r--lib/ftools.rb11
-rw-r--r--lib/ftplib.rb6
-rw-r--r--lib/mailread.rb2
-rw-r--r--lib/matrix.rb3
-rw-r--r--lib/mkmf.rb2
-rw-r--r--lib/weakref.rb9
7 files changed, 24 insertions, 17 deletions
diff --git a/lib/debug.rb b/lib/debug.rb
index 90270a3..430d647 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 103e27a..7bba07e 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 617d858..4cba9c5 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 5e46606..2edcca0 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 4767b4b..bca6c40 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 df03b12..74de7be 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 d969553..c6fe8cd 100644
--- a/lib/weakref.rb
+++ b/lib/weakref.rb
@@ -16,8 +16,8 @@ class WeakRef<Delegator
class RefError<StandardError
end
- ID_MAP = {}
- ID_REV_MAP = {}
+ ID_MAP = {} # obj -> [ref,...]
+ ID_REV_MAP = {} # ref -> obj
ObjectSpace.add_finalizer(lambda{|id|
rids = ID_MAP[id]
if rids
@@ -29,10 +29,11 @@ class WeakRef<Delegator
rid = ID_REV_MAP[id]
if rid
ID_REV_MAP[id] = nil
- ID_MAP[rid] = nil
+ ID_MAP[rid].delete(id)
+ ID_MAP[rid] = nil if ID_MAP[rid].empty?
end
})
-
+
def initialize(orig)
super
@__id = orig.__id__