forked from alexch/rerun
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stty.rb
58 lines (42 loc) · 734 Bytes
/
stty.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# see /usr/include/sys/termios.h
# see man stty
require "wrong"
include Wrong
def tty
stty = `stty -g`
stty.split(':')
end
def tty_setting name
tty.grep(/^#{name}/).first.split('=').last
end
def oflag
tty_setting("oflag")
end
normal = tty
`stty raw`
raw = tty
`stty -raw`
minus_raw = tty
assert { minus_raw == normal }
`stty raw opost`
raw_opost = tty
d { raw - normal }
d { normal - raw }
d { normal - raw_opost }
puts "== normal"
# d { tty }
d{oflag}
def check setting
`stty #{setting}`
puts "testing #{setting}:\nline\nline"
print "\r\n"
end
check "raw"
check "-raw"
check "raw opost"
check "-raw"
check "raw gfmt1:oflag=3"
# check "oflag=3"
# check "lflag=200005cb"
# check "iflag=2b02"
`stty -raw`