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
Re: Cannot handle date (0, 0, 0, 2, 0, 1970)
[p5sagit/p5-mst-13.2.git]
/
h2pl
/
cbreak.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 'sizeof.ph';
15
require 'sys/ioctl.ph';
16
17
ioctl(STDIN,&TIOCGETP,$sgttyb)
18
|| die "Can't ioctl TIOCGETP: $!";
19
20
@ary = unpack($sgttyb_t,$sgttyb);
21
if ($on) {
22
$ary[4] |= &CBREAK;
23
$ary[4] &= ~&ECHO;
24
} else {
25
$ary[4] &= ~&CBREAK;
26
$ary[4] |= &ECHO;
27
}
28
$sgttyb = pack($sgttyb_t,@ary);
29
ioctl(STDIN,&TIOCSETP,$sgttyb)
30
|| die "Can't ioctl TIOCSETP: $!";
31
32
}
33
34
1;