1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
$NetBSD: patch-ac,v 1.2 1999/11/15 17:16:22 rh Exp $
--- client/get_password.c.orig Thu Nov 26 21:00:42 1998
+++ client/get_password.c Mon Nov 15 18:12:46 1999
@@ -27,8 +27,8 @@
#include <termio.h>
#define TERMIO struct termio
#else
-#include <sgtty.h>
-#define TERMIO struct sgttyb
+#include <termios.h>
+#define TERMIO struct termios
#endif
#endif
#ifdef alpha_linux_port
@@ -130,13 +130,14 @@
get_password(buff,sizeof(buff)-1,fileno(stdin),isatty(fileno(stdout)));
ioctl(fileno(stdin),(int) TCSETA, &org);
#else
- gtty(fileno(stdin), &org);
+ tcgetattr(fileno(stdin), &org);
tmp=org;
- tmp.sg_flags &= ~ECHO;
- tmp.sg_flags |= RAW;
- stty(fileno(stdin), &tmp);
+ tmp.c_lflag &= ~(ECHO | ISIG | ICANON);
+ tmp.c_cc[VMIN] = 1;
+ tmp.c_cc[VTIME]= 0;
+ tcsetattr(fileno(stdin), TCSAFLUSH, &tmp);
get_password(buff,sizeof(buff)-1,fileno(stdin),isatty(fileno(stdout)));
- stty(fileno(stdin), &org);
+ tcsetattr(fileno(stdin), TCSAFLUSH, &org);
#endif
if (isatty(fileno(stdout)))
fputc('\n',stdout);
|