6
static int tc_modified = 0;
7
static struct termios oldset;
12
struct termios newset;
14
if (tcgetattr(STDIN_FILENO, &oldset) == 0 && (oldset.c_lflag & ECHO)) {
17
newset.c_lflag &= ~(ECHO | ECHOE | ECHOK | ECHONL);
18
(void) tcsetattr(STDIN_FILENO, TCSANOW, &newset);
26
if (tc_modified != 0) {
27
tcsetattr(STDIN_FILENO, TCSANOW, &oldset);
33
readnoecho(char* buf, int maxl)
40
n = read(STDIN_FILENO, &c, 1);
41
if (n == -1 && (errno == EAGAIN || errno == EINTR))
54
fprintf(stderr, "\n");
60
readpassw(char *buf, int maxlen)
64
fprintf(stderr, "password:");
66
return(readnoecho(buf, maxlen));