projects
/
p5sagit/p5-mst-13.2.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
Detypos (and sticking with US spelling since Dan Sugalski
[p5sagit/p5-mst-13.2.git]
/
h2pl
/
cbreak2.pl
1
$sgttyb_t = 'C4 S';
2
3
sub cbreak {
4
&set_cbreak(1);
5
}
6
7
sub cooked {
8
&set_cbreak(0);
9
}
10
11
sub set_cbreak {
12
local($on) = @_;
13
14
require 'sys/ioctl.pl';
15
16
ioctl(STDIN,$TIOCGETP,$sgttyb)
17
|| die "Can't ioctl TIOCGETP: $!";
18
19
@ary = unpack($sgttyb_t,$sgttyb);
20
if ($on) {
21
$ary[4] |= $CBREAK;
22
$ary[4] &= ~$ECHO;
23
} else {
24
$ary[4] &= ~$CBREAK;
25
$ary[4] |= $ECHO;
26
}
27
$sgttyb = pack($sgttyb_t,@ary);
28
ioctl(STDIN,$TIOCSETP,$sgttyb)
29
|| die "Can't ioctl TIOCSETP: $!";
30
31
}
32
33
1;