#include <stdio.h>
#include <termios.h>
#define oops(s,x) {perror(s); exit(x);}
main(int ac, char *av[])
{
struct termios info;
if (ac ==1 )
exit(0);
if(tcgetattr(0, &info) == -1)
oops("tcgetattr", 1);
if(av[1][0] == 'y')
info.c_lflag |= ECHO;
else
info.c_lflag &= ~ECHO;
if(tcsetattr(0,TCSANOW, &info) == -1)
oops("tcsetattr", 2);
}
'IT' 카테고리의 다른 글
창크기 알려주는 프로그램 (0) | 2014.10.08 |
---|---|
terminal info? status? 를 보여주는 프로그램 (0) | 2014.10.08 |
echo 상태를 나타내는 코드 (0) | 2014.10.08 |
fcntl을 이용한 (뭐하는지 모르겠는) 코드 (0) | 2014.10.08 |
getchar를 이용한 (뭐하는지 모르겠는) (0) | 2014.10.08 |