extra code in pp_concat, Take 2
[p5sagit/p5-mst-13.2.git] / h2pl / cbreak2.pl
CommitLineData
87250799 1$sgttyb_t = 'C4 S';
2
3sub cbreak {
4 &set_cbreak(1);
5}
6
7sub cooked {
8 &set_cbreak(0);
9}
10
11sub 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
331;