8 /* function prototypes */
9 void diep(const char *s
);
11 int main(int argc
, char *argv
[])
13 struct termios oldt
, newt
;
14 char password
[PASSLEN
];
17 /* check argument count */
19 fprintf(stderr
, "Usage: %s tty\n", argv
[0]);
23 /* open terminal device */
24 if ((fd
= open(argv
[1], O_RDONLY
| O_NOCTTY
) == -1))
27 /* get current termios structure */
28 if (tcgetattr(fd
, &oldt
) == -1)
31 /* set new termios structure */
33 newt
.c_lflag
&= ~ECHO
; /* disable echoing */
34 newt
.c_lflag
|= ECHONL
; /* echo NL even if ECHO is off */
36 if (tcsetattr(fd
, TCSANOW
, &newt
) == -1)
39 /* prompt for password and get it*/
41 scanf("%64s", password
);
43 /* restole old termios structure */
44 if (tcsetattr(fd
, TCSANOW
, &oldt
) == -1)
50 void diep(const char *s
) {