summaryrefslogtreecommitdiff
path: root/lib/net/telnet.rb
diff options
context:
space:
mode:
authorwakou <wakou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-09-11 22:37:27 +0000
committerwakou <wakou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-09-11 22:37:27 +0000
commit9d823983dc3e88cb7775c78908a4bb5133ad88ac (patch)
tree590cad5fa0fd83899da0994096b426225de45ced /lib/net/telnet.rb
parente2adc86984ba979812162645b6a447dfced6f930 (diff)
wakou
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@932 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/net/telnet.rb')
-rw-r--r--lib/net/telnet.rb19
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/net/telnet.rb b/lib/net/telnet.rb
index 43d8069..1b8a52b 100644
--- a/lib/net/telnet.rb
+++ b/lib/net/telnet.rb
@@ -510,12 +510,7 @@ module Net
end
end
- def print(string)
- if $VERBOSE
- $stderr.puts 'WARNING: Telnet#print("string") NOT adds "\n" to the last of "string", in the future.'
- $stderr.puts ' cf. Telnet#puts().'
- end
- string = string + "\n"
+ def _print(string)
string = string.gsub(/#{IAC}/no, IAC + IAC) if @options["Telnetmode"]
if @options["Binmode"]
@@ -535,7 +530,15 @@ module Net
end
def puts(string)
- self.print(string)
+ self._print(string + "\n")
+ end
+
+ def print(string)
+ if $VERBOSE
+ $stderr.puts 'WARNING: Telnet#print("string") NOT adds "\n" to the last of "string", in the future.'
+ $stderr.puts ' cf. Telnet#puts().'
+ end
+ self.puts(string)
end
def cmd(options)
@@ -550,7 +553,7 @@ module Net
string = options
end
- self.print(string)
+ self.puts(string)
if iterator?
waitfor({"Prompt" => match, "Timeout" => time_out}){|c| yield c }
else