summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--defines.h2
-rw-r--r--lib/resolv-replace.rb31
3 files changed, 25 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index e89c6ec..ed6e0c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Fri Sep 26 18:35:40 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/resolv-replace.rb: 1.8 compliance. [ruby-talk:82946]
+
Mon Sep 26 17:39:27 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* test/ruby/test_marshal.rb: add test for ruby's objects.
diff --git a/defines.h b/defines.h
index 2744b16..1cc659a 100644
--- a/defines.h
+++ b/defines.h
@@ -144,7 +144,7 @@ flush_register_windows(void)
volatile
#endif
# if defined(__sparc_v9__) || defined(__sparcv9) || defined(__arch64__)
- ("flushw" : :)
+ ("flushw")
# elif defined(linux) || defined(__linux__)
("ta 0x83")
# else /* Solaris, OpenBSD, NetBSD, etc. */
diff --git a/lib/resolv-replace.rb b/lib/resolv-replace.rb
index ad5c97b..560a813 100644
--- a/lib/resolv-replace.rb
+++ b/lib/resolv-replace.rb
@@ -1,9 +1,10 @@
+require 'socket'
require 'resolv'
class BasicSocket
alias original_resolv_send send
def send(mesg, flags, *rest)
- rest[0] = Resolv.getaddress(rest[0]).to_s if 0 < rest.length
+ rest[0] = Resolv.getaddress(rest[0]).to_s unless rest.empty?
original_resolv_send(mesg, flags, *rest)
end
end
@@ -15,19 +16,20 @@ class << IPSocket
end
end
-class << TCPSocket
- alias original_resolv_new new
- def new(host, service)
- original_resolv_new(Resolv.getaddress(host).to_s, service)
- end
-
- alias original_resolv_open open
- def open(host, service)
- original_resolv_open(Resolv.getaddress(host).to_s, service)
+class TCPSocket
+ alias original_resolv_initialize initialize
+ def initialize(host, serv, *rest)
+ rest[0] = Resolv.getaddress(rest[0]).to_s unless rest.empty?
+ original_resolv_initialize(Resolv.getaddress(host).to_s, serv, *rest)
end
end
class UDPSocket
+ alias original_resolv_bind bind
+ def bind(host, port)
+ original_resolv_bind(Resolv.getaddress(host).to_s, port)
+ end
+
alias original_resolv_connect connect
def connect(host, port)
original_resolv_connect(Resolv.getaddress(host).to_s, port)
@@ -35,7 +37,14 @@ class UDPSocket
alias original_resolv_send send
def send(mesg, flags, *rest)
- rest[0] = Resolv.getaddress(rest[0]).to_s if 0 < rest.length
+ rest[0] = Resolv.getaddress(rest[0]).to_s unless rest.empty?
original_resolv_send(mesg, flags, *rest)
end
end
+
+class SOCKSSocket
+ alias original_resolv_initialize initialize
+ def initialize(host, serv)
+ original_resolv_initialize(Resolv.getaddress(host).to_s, port)
+ end
+end if defined? SOCKSSocket