From 7152df6b9b3b95d93607127d853c02e03e42a327 Mon Sep 17 00:00:00 2001 From: matz Date: Sat, 18 Sep 1999 04:48:51 +0000 Subject: 990918-repack git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/e2mmap.rb | 2 +- lib/jcode.rb | 2 +- lib/telnet.rb | 96 +++++++++++++++++++++++++++++------------------------------ 3 files changed, 50 insertions(+), 50 deletions(-) (limited to 'lib') diff --git a/lib/e2mmap.rb b/lib/e2mmap.rb index e04ed4a5b4..2b023601d2 100644 --- a/lib/e2mmap.rb +++ b/lib/e2mmap.rb @@ -177,7 +177,7 @@ module Exception2MessageMapper def E2MM.e2mm_message(klass, exp) for c in klass.ancestors if mes = @MessageMap[[c,exp]] - p mes + #p mes m = klass.instance_eval('"' + mes + '"') return m end diff --git a/lib/jcode.rb b/lib/jcode.rb index 6e5bc9e99d..92b9284471 100644 --- a/lib/jcode.rb +++ b/lib/jcode.rb @@ -104,7 +104,7 @@ class String self.gsub!(pattern, last) else h = HashCache[from + "::" + to] ||= expand_ch_hash(from, to) - self.gsub!(pattern) do |c| p [c,h[c]]; h[c] end + self.gsub!(pattern) do |c| h[c] end end end diff --git a/lib/telnet.rb b/lib/telnet.rb index 9300bf6e18..3b0fc9ddaa 100644 --- a/lib/telnet.rb +++ b/lib/telnet.rb @@ -1,11 +1,11 @@ =begin -$Date: 1999/09/14 23:09:05 $ +$Date: 1999/09/17 17:41:41 $ == SIMPLE TELNET CLIANT LIBRARY telnet.rb -Version 0.30 +Version 0.40 Wakou Aoyama @@ -154,6 +154,12 @@ of cource, set sync=true or flush is necessary. == HISTORY +=== Version 0.40 + +1999/09/17 17:41:41 + +- bug fix: preprocess method + === Version 0.30 1999/09/14 23:09:05 @@ -392,8 +398,8 @@ class Telnet < SimpleDelegator EOL = CR + LF v = $-v $-v = false - VERSION = "0.30" - RELEASE_DATE = "$Date: 1999/09/14 23:09:05 $" + VERSION = "0.40" + RELEASE_DATE = "$Date: 1999/09/17 17:41:41 $" $-v = v def initialize(options) @@ -488,53 +494,47 @@ $-v = v # combine EOL into "\n" str.gsub!(/#{EOL}/no, "\n") unless @options["Binmode"] - # respond to "IAC DO x" - str.gsub!(/([^#{IAC}]?)#{IAC}#{DO}([#{OPT_BINARY}-#{OPT_NEW_ENVIRON}#{OPT_EXOPL}])/no){ - if OPT_BINARY == $2 - @telnet_option["BINARY"] = true - @sock.write(IAC + WILL + OPT_BINARY) - else - @sock.write(IAC + WONT + $2) - end - $1 - } - - # respond to "IAC DON'T x" with "IAC WON'T x" - str.gsub!(/([^#{IAC}]?)#{IAC}#{DONT}([#{OPT_BINARY}-#{OPT_NEW_ENVIRON}#{OPT_EXOPL}])/no){ - @sock.write(IAC + WONT + $2) - $1 - } - - # respond to "IAC WILL x" - str.gsub!(/([^#{IAC}]?)#{IAC}#{WILL}([#{OPT_BINARY}-#{OPT_NEW_ENVIRON}#{OPT_EXOPL}])/no){ - if OPT_ECHO == $2 - @sock.write(IAC + DO + OPT_ECHO) - elsif OPT_SGA == $2 - @telnet_option["SGA"] = true - @sock.write(IAC + DO + OPT_SGA) - end - $1 - } - - # respond to "IAC WON'T x" - str.gsub!(/([^#{IAC}]?)#{IAC}#{WONT}([#{OPT_BINARY}-#{OPT_NEW_ENVIRON}#{OPT_EXOPL}])/no){ - if OPT_ECHO == $2 - @sock.write(IAC + DONT + OPT_ECHO) - elsif OPT_SGA == $2 - @telnet_option["SGA"] = false - @sock.write(IAC + DONT + OPT_SGA) + str.gsub!(/#{IAC}( + #{IAC}| + #{AYT}| + [#{DO}#{DONT}#{WILL}#{WONT}] + [#{OPT_BINARY}-#{OPT_NEW_ENVIRON}#{OPT_EXOPL}] + )/xno){ + if IAC == $1 # handle escaped IAC characters + IAC + elsif AYT == $1 # respond to "IAC AYT" (are you there) + @sock.write("nobody here but us pigeons" + EOL) + '' + elsif DO[0] == $1[0] # respond to "IAC DO x" + if OPT_BINARY[0] == $1[1] + @telnet_option["BINARY"] = true + @sock.write(IAC + WILL + OPT_BINARY) + else + @sock.write(IAC + WONT + $1[1..1]) + end + '' + elsif DONT[0] == $1[0] # respond to "IAC DON'T x" with "IAC WON'T x" + @sock.write(IAC + WONT + $1[1..1]) + '' + elsif WILL[0] == $1[0] # respond to "IAC WILL x" + if OPT_ECHO[0] == $1[1] + @sock.write(IAC + DO + OPT_ECHO) + elsif OPT_SGA[0] == $1[1] + @telnet_option["SGA"] = true + @sock.write(IAC + DO + OPT_SGA) + end + '' + elsif WONT[0] == $1[0] # respond to "IAC WON'T x" + if OPT_ECHO[0] == $1[1] + @sock.write(IAC + DONT + OPT_ECHO) + elsif OPT_SGA[0] == $1[1] + @telnet_option["SGA"] = false + @sock.write(IAC + DONT + OPT_SGA) + end + '' end - $1 } - # respond to "IAC AYT" (are you there) - str.gsub!(/([^#{IAC}]?)#{IAC}#{AYT}/no){ - @sock.write("nobody here but us pigeons" + EOL) - $1 - } - - str.gsub!(/#{IAC}#{IAC}/no, IAC) # handle escaped IAC characters - str end # preprocess -- cgit v1.2.3