2002-06-20 12:08:05 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include <config.h>
|
|
|
|
#endif
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
char *getpass(const char *prompt)
|
|
|
|
{
|
|
|
|
static char buf[128];
|
|
|
|
size_t i;
|
|
|
|
|
|
|
|
fputs(prompt, stderr);
|
|
|
|
fflush(stderr);
|
2004-07-12 15:19:28 +00:00
|
|
|
for (i = 0; i < sizeof(buf) - 1; i++) {
|
2002-06-20 12:08:05 +00:00
|
|
|
buf[i] = _getch();
|
|
|
|
if (buf[i] == '\r')
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
buf[i] = 0;
|
|
|
|
fputs("\n", stderr);
|
|
|
|
return buf;
|
|
|
|
}
|
|
|
|
|