2005-07-14 22:45:10 +00:00
|
|
|
require 'rex/ui'
|
|
|
|
|
|
|
|
module Rex
|
|
|
|
module Ui
|
|
|
|
module Text
|
|
|
|
|
|
|
|
###
|
|
|
|
#
|
|
|
|
# This class implements input against standard in.
|
|
|
|
#
|
|
|
|
###
|
|
|
|
class Input::Stdio < Rex::Ui::Text::Input
|
2005-11-15 05:22:13 +00:00
|
|
|
|
2005-12-07 03:40:09 +00:00
|
|
|
#
|
|
|
|
# Reads text from standard input.
|
|
|
|
#
|
|
|
|
def sysread(len = 1)
|
|
|
|
$stdin.sysread(len)
|
|
|
|
end
|
|
|
|
|
2005-11-15 05:22:13 +00:00
|
|
|
#
|
|
|
|
# Wait for a line of input to be read from standard input.
|
|
|
|
#
|
2005-07-14 22:45:10 +00:00
|
|
|
def gets
|
|
|
|
return $stdin.gets
|
|
|
|
end
|
|
|
|
|
2005-11-15 05:22:13 +00:00
|
|
|
#
|
|
|
|
# Returns whether or not EOF has been reached on stdin.
|
|
|
|
#
|
2005-07-14 22:45:10 +00:00
|
|
|
def eof?
|
2005-12-21 04:32:06 +00:00
|
|
|
$stdin.closed?
|
2005-07-14 22:45:10 +00:00
|
|
|
end
|
2005-07-16 07:32:11 +00:00
|
|
|
|
2005-11-15 05:22:13 +00:00
|
|
|
#
|
|
|
|
# Returns the file descriptor associated with standard input.
|
|
|
|
#
|
2005-07-16 07:32:11 +00:00
|
|
|
def fd
|
|
|
|
return $stdin
|
|
|
|
end
|
2005-07-14 22:45:10 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
2008-10-19 21:03:39 +00:00
|
|
|
end
|