summaryrefslogtreecommitdiff
path: root/lib/net
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2008-03-21 19:57:19 -0600
committerJamis Buck <jamis@37signals.com>2008-03-21 19:57:19 -0600
commit7dc5d9e6c329023c846880bf11e3820e6b040bd7 (patch)
tree026b258abde2a60eddb66ddc62eb10ffc575aaba /lib/net
parent2f81f7a95039eabfa956ef8527ad9cfc21eb7377 (diff)
downloadnet-ssh-7dc5d9e6c329023c846880bf11e3820e6b040bd7.tar.gz
docs for Net::SSH::Connection::Term constants. make Channel#request_pty implementation a bit clearer.
Diffstat (limited to 'lib/net')
-rw-r--r--lib/net/ssh/connection/channel.rb11
-rw-r--r--lib/net/ssh/connection/term.rb111
2 files changed, 113 insertions, 9 deletions
diff --git a/lib/net/ssh/connection/channel.rb b/lib/net/ssh/connection/channel.rb
index db31e6b..ebbd974 100644
--- a/lib/net/ssh/connection/channel.rb
+++ b/lib/net/ssh/connection/channel.rb
@@ -209,17 +209,16 @@ module Net; module SSH; module Connection
opts = VALID_PTY_OPTIONS.merge(opts)
- modes = opts[:modes].inject([]) do |memo, (mode, data)|
- memo << :byte << mode
- memo << :long << data
+ modes = opts[:modes].inject(Buffer.new) do |memo, (mode, data)|
+ memo.write_byte(mode).write_long(data)
end
- modes << :byte << Term::TTY_OP_END
- modes = Buffer.from(*modes).to_s
+ # mark the end of the mode opcode list with a 0 byte
+ modes.write_byte(0)
send_channel_request("pty-req", :string, opts[:term],
:long, opts[:chars_wide], :long, opts[:chars_high],
:long, opts[:pixels_wide], :long, opts[:pixels_high],
- :string, modes, &block)
+ :string, modes.to_s, &block)
end
# Sends data to the channel's remote endpoint. This usually has the
diff --git a/lib/net/ssh/connection/term.rb b/lib/net/ssh/connection/term.rb
index fd254c1..d9752f7 100644
--- a/lib/net/ssh/connection/term.rb
+++ b/lib/net/ssh/connection/term.rb
@@ -2,69 +2,174 @@ module Net; module SSH; module Connection
# Terminal opcodes, for use when opening pty's.
module Term
-
- TTY_OP_END = 0
+ # Interrupt character; 255 if none. Similarly for the other characters.
+ # Not all of these characters are supported on all systems.
VINTR = 1
+
+ # The quit character (sends SIGQUIT signal on POSIX systems).
VQUIT = 2
+
+ # Erase the character to left of the cursor.
VERASE = 3
+
+ # Kill the current input line.
VKILL = 4
+
+ # End-of-file character (sends EOF from the terminal).
VEOF = 5
+
+ # End-of-line character in addition to carriage return and/or linefeed.
VEOL = 6
+
+ # Additional end-of-line character.
VEOL2 = 7
+
+ # Continues paused output (normally control-Q).
VSTART = 8
+
+ # Pauses output (normally control-S).
VSTOP = 9
+
+ # Suspends the current program.
VSUSP = 10
+
+ # Another suspend character.
VDSUSP = 11
+
+ # Reprints the current input line.
VREPRINT = 12
+
+ # Erases a word left of cursor.
VWERASE = 13
+
+ # Enter the next character typed literally, even if it is a special
+ # character.
VLNEXT = 14
+
+ # Character to flush output.
VFLUSH = 15
+
+ # Switch to a different shell layer.
VSWITCH = 16
+
+ # Prints system status line (load, command, pid, etc).
VSTATUS = 17
+
+ # Toggles the flushing of terminal output.
VDISCARD = 18
+ # The ignore parity flag. The parameter SHOULD be 0 if this flag is FALSE,
+ # and 1 if it is TRUE.
IGNPAR = 30
+
+ # Mark parity and framing errors.
PARMRK = 31
+
+ # Enable checking of parity errors.
INPCK = 32
+
+ # Strip 8th bit off characters.
ISTRIP = 33
+
+ # Map NL into CR on input.
INCLR = 34
+
+ # Ignore CR on input.
IGNCR = 35
+
+ # Map CR to NL on input.
ICRNL = 36
+
+ # Translate uppercase characters to lowercase.
IUCLC = 37
+
+ # Enable output flow control.
IXON = 38
+
+ # Any char will restart after stop.
IXANY = 39
+
+ # Enable input flow control.
IXOFF = 40
+
+ # Ring bell on input queue full.
IMAXBEL = 41
+ # Enable signals INTR, QUIT, [D]SUSP.
ISIG = 50
+
+ # Canonicalize input lines.
ICANON = 51
+
+ # Enable input and output of uppercase characters by preceding their
+ # lowercase equivalents with "\".
XCASE = 52
+
+ # Enable echoing.
ECHO = 53
+
+ # Visually erase chars.
ECHOE = 54
+
+ # Kill character discards current line.
ECHOK = 55
+
+ # Echo NL even if ECHO is off.
ECHONL = 56
+
+ # Don't flush after interrupt.
NOFLSH = 57
+
+ # Stop background jobs from output.
TOSTOP= 58
+
+ # Enable extensions.
IEXTEN = 59
+
+ # Echo control characters as ^(Char).
ECHOCTL = 60
+
+ # Visual erase for line kill.
ECHOKE = 61
+
+ # Retype pending input.
PENDIN = 62
+ # Enable output processing.
OPOST = 70
+
+ # Convert lowercase to uppercase.
OLCUC = 71
+
+ # Map NL to CR-NL.
ONLCR = 72
+
+ # Translate carriage return to newline (output).
OCRNL = 73
+
+ # Translate newline to carriage return-newline (output).
ONOCR = 74
+
+ # Newline performs a carriage return (output).
ONLRET = 75
+ # 7 bit mode.
CS7 = 90
+
+ # 8 bit mode.
CS8 = 91
+
+ # Parity enable.
PARENB = 92
+
+ # Odd parity, else even.
PARODD = 93
+ # Specifies the input baud rate in bits per second.
TTY_OP_ISPEED = 128
- TTY_OP_OSPEED = 129
+ # Specifies the output baud rate in bits per second.
+ TTY_OP_OSPEED = 129
end
end; end; end