From bcab5ca9d1b50cc940d3c2cf190c6ef18a20f3d0 Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 16 Apr 1999 06:03:36 +0000 Subject: prepare to alpha git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/telnet.rb | 20 +++++++++++++++++--- lib/thread.rb | 3 +++ 2 files changed, 20 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/telnet.rb b/lib/telnet.rb index 098cbc9772..a84180365b 100644 --- a/lib/telnet.rb +++ b/lib/telnet.rb @@ -2,7 +2,7 @@ = simple telnet cliant library -telnet.rb ver0.162 1999/03/18 +telnet.rb ver0.163 1999/04/11 Wakou Aoyama @@ -30,6 +30,17 @@ if set "Telnetmode" option FALSE. not TELNET command interpretation. the same character as "Prompt" is included in the data, and, when the network or the host is very heavy, the value is enlarged. +=== status output + + host = Telnet.new({"Hosh" => "localhost"){|c| print c } + +connection status output. + +example + +Trying localhost... +Connected to localhost. + == waitfor (wait for match) @@ -133,6 +144,9 @@ of cource, set sync=TRUE or flush is necessary. = history +ver0.163 1999/04/11 +STDOUT.write(message) --> yield(message) if iterator? + ver0.162 1999/03/17 add "Proxy" option required timeout.rb @@ -291,7 +305,7 @@ class Telnet < SimpleDelegator end else message = "Trying " + @options["Host"] + "...\n" - STDOUT.write(message) + yield(message) if iterator? @log.write(message) if @options.include?("Output_log") @dumplog.write(message) if @options.include?("Dump_log") @@ -310,7 +324,7 @@ class Telnet < SimpleDelegator @sock.binmode message = "Connected to " + @options["Host"] + ".\n" - STDOUT.write(message) + yield(message) if iterator? @log.write(message) if @options.include?("Output_log") @dumplog.write(message) if @options.include?("Dump_log") end diff --git a/lib/thread.rb b/lib/thread.rb index 4e6d765686..936768fa9b 100644 --- a/lib/thread.rb +++ b/lib/thread.rb @@ -120,6 +120,7 @@ class Queue Thread.critical = false t.run if t end + alias enq push def pop non_block=false Thread.critical = true @@ -139,6 +140,8 @@ class Queue Thread.critical = false end end + alias shift pop + alias deq pop def empty? @que.length == 0 -- cgit v1.2.3