home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari FTP
/
ATARI_FTP_0693.zip
/
ATARI_FTP_0693
/
Mint
/
mntlib25.zoo
/
getpass.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-09-17
|
524b
|
29 lines
#include <ioctl.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
char *
getpass(prompt)
const char *prompt;
{
static char buf[81];
char *ret;
struct sgttyb oldsb, newsb;
fflush(stdin);
gtty(0, &oldsb);
newsb = oldsb;
newsb.sg_flags &= ~ECHO;
stty(0, &newsb);
fputs(prompt, stderr); fflush(stderr);
buf[0] = buf[81] = 0;
if((ret = fgets(buf, 80, stdin)) != 0)
{
/* null terminate string */
buf[strlen(buf) - 1] = 0;
}
stty(0, &oldsb);
return ret;
}