1 /* 2 * turn raw (no echo, etc.) on and off. 3 * ptyfs is gone, so don't even try tcsetattr, etc. 4 */ 5 #define _POSIX_SOURCE 6 #define _RESEARCH_SOURCE 7 8 #include <sys/types.h> 9 #include <unistd.h> 10 #include <fcntl.h> 11 #include <libv.h> 12 13 static int ctlfd = -1; 14 15 /* fd is ignored */ 16 tty_echooff(int)17tty_echooff(int) 18 { 19 if(ctlfd >= 0) 20 return 0; 21 ctlfd = open("/dev/consctl", O_WRONLY); 22 if(ctlfd < 0) 23 return -1; 24 write(ctlfd, "rawon", 5); 25 return 0; 26 } 27 tty_echoon(int)28tty_echoon(int) 29 { 30 if(ctlfd >= 0){ 31 write(ctlfd, "rawoff", 6); 32 close(ctlfd); 33 ctlfd = -1; 34 return 0; 35 } 36 return -1; 37 } 38