Lines 136-141
getpasswd(const char *prompt, int fd)
Link Here
|
136 |
#ifndef WIN32 |
136 |
#ifndef WIN32 |
137 |
sigset_t sig, old_sig; |
137 |
sigset_t sig, old_sig; |
138 |
struct termios ts; |
138 |
struct termios ts; |
|
|
139 |
int old_c_lflag; |
139 |
#else |
140 |
#else |
140 |
/* Force stdin on windows. */ |
141 |
/* Force stdin on windows. */ |
141 |
fd = 0; |
142 |
fd = 0; |
Lines 178-183
getpasswd(const char *prompt, int fd)
Link Here
|
178 |
* - disable cannonical mode (input read line by line mode) |
179 |
* - disable cannonical mode (input read line by line mode) |
179 |
*/ |
180 |
*/ |
180 |
tcgetattr(fileno(fp), &ts); |
181 |
tcgetattr(fileno(fp), &ts); |
|
|
182 |
old_c_lflag = ts.c_lflag; |
181 |
ts.c_lflag &= ~(ECHO | ICANON | ISIG); |
183 |
ts.c_lflag &= ~(ECHO | ICANON | ISIG); |
182 |
tcsetattr(fileno(fp), TCSAFLUSH, &ts); |
184 |
tcsetattr(fileno(fp), TCSAFLUSH, &ts); |
183 |
|
185 |
|
Lines 194-199
getpasswd(const char *prompt, int fd)
Link Here
|
194 |
*/ |
196 |
*/ |
195 |
_putch(PW_CR_CHAR); |
197 |
_putch(PW_CR_CHAR); |
196 |
_putch(PW_LF_CHAR); |
198 |
_putch(PW_LF_CHAR); |
|
|
199 |
#else |
200 |
/* Reset terminal settings |
201 |
*/ |
202 |
fputs("\n", fp); |
203 |
ts.c_lflag = old_c_lflag; |
204 |
tcsetattr(fileno(fp), TCSAFLUSH, &ts); |
197 |
#endif |
205 |
#endif |
198 |
|
206 |
|
199 |
fclose(fp); |
207 |
fclose(fp); |
200 |
- |
|
|