- 论坛徽章:
- 0
|
5可用积分
POSIX::Termios
new
Create a new Termios object. This object will be destroyed automatically when it is no longer needed. A Termios object corresponds to the termios C struct. new() mallocs a new one, getattr() fills it from a file descriptor, and setattr() sets a file descriptor's parameters to match Termios' contents.
$termios = POSIX::Termios->new;
getattr
Get terminal control attributes.
Obtain the attributes for stdin.
$termios->getattr( 0 ) # Recommended for clarity.
$termios->getattr()
Obtain the attributes for stdout.
$termios->getattr( 1 )
Returns undef on failure.
getcc
Retrieve a value from the c_cc field of a termios object. The c_cc field is an array so an index must be specified.
$c_cc[1] = $termios->getcc(1);
getcflag
Retrieve the c_cflag field of a termios object.
$c_cflag = $termios->getcflag;
getiflag
Retrieve the c_iflag field of a termios object.
$c_iflag = $termios->getiflag;
getispeed
Retrieve the input baud rate.
$ispeed = $termios->getispeed;
getlflag
Retrieve the c_lflag field of a termios object.
$c_lflag = $termios->getlflag;
getoflag
Retrieve the c_oflag field of a termios object.
$c_oflag = $termios->getoflag;
getospeed
Retrieve the output baud rate.
$ospeed = $termios->getospeed;
setattr
Set terminal control attributes.
Set attributes immediately for stdout.
$termios->setattr( 1, &POSIX::TCSANOW );
Returns undef on failure.
setcc
Set a value in the c_cc field of a termios object. The c_cc field is an array so an index must be specified.
$termios->setcc( &POSIX::VEOF, 1 );
setcflag
Set the c_cflag field of a termios object.
$termios->setcflag( $c_cflag | &POSIX::CLOCAL );
setiflag
Set the c_iflag field of a termios object.
$termios->setiflag( $c_iflag | &POSIX::BRKINT );
setispeed
Set the input baud rate.
$termios->setispeed( &POSIX::B9600 );
Returns undef on failure.
setlflag
Set the c_lflag field of a termios object.
$termios->setlflag( $c_lflag | &POSIX::ECHO );
setoflag
Set the c_oflag field of a termios object.
$termios->setoflag( $c_oflag | &POSIX::OPOST );
setospeed
Set the output baud rate.
$termios->setospeed( &POSIX::B9600 );
Returns undef on failure.
Baud rate values
B38400 B75 B200 B134 B300 B1800 B150 B0 B19200 B1200 B9600 B600 B4800 B50 B2400 B110
Terminal interface values
TCSADRAIN TCSANOW TCOON TCIOFLUSH TCOFLUSH TCION TCIFLUSH TCSAFLUSH TCIOFF TCOOFF
c_cc field values
VEOF VEOL VERASE VINTR VKILL VQUIT VSUSP VSTART VSTOP VMIN VTIME NCCS
c_cflag field values
CLOCAL CREAD CSIZE CS5 CS6 CS7 CS8 CSTOPB HUPCL PARENB PARODD
c_iflag field values
BRKINT ICRNL IGNBRK IGNCR IGNPAR INLCR INPCK ISTRIP IXOFF IXON PARMRK
c_lflag field values
ECHO ECHOE ECHOK ECHONL ICANON IEXTEN ISIG NOFLSH TOSTOP
c_oflag field values
OPOST |
最佳答案
查看完整内容
有用吗?《Linux 程序设计入门》 第四版 §5 终端 §5.4 termios结构§5.4 termios结构Termios是POSIX规定的标准接口,它和System V的接口termio.类似。使用数据结构termios,在termios.h中定义,该文件还包含小量的函数调用。使用termios.h中的函数调用时,要链接合适的函数库。根据系统,可能是标准的c库或者curses库。如有必要,编译的时候需要添加:-lcurses。老系统中甚至为-lncurses。http://blog.chinaunix.net/u/21908/sh ...
|