changed system-calls to avoid namespace pollution

This commit is contained in:
eck
1990-01-22 11:44:21 +00:00
parent c514c25061
commit e13435712d
11 changed files with 68 additions and 72 deletions

View File

@@ -8,13 +8,13 @@
#include <sgtty.h>
#define O_RDONLY 0
int open(const char *path, int flags);
int write(int d, const char *buf, int nbytes);
int read(int d, char *buf, int nbytes);
int close(int d);
int _open(const char *path, int flags);
int _write(int d, const char *buf, int nbytes);
int _read(int d, char *buf, int nbytes);
int _close(int d);
int stty(int, struct sgttyb *);
int gtty(int, struct sgttyb *);
int _stty(int, struct sgttyb *);
int _gtty(int, struct sgttyb *);
char *
getpass(const char *prompt)
@@ -25,20 +25,20 @@ getpass(const char *prompt)
int fd;
void (*savesig)(int);
if ((fd = open("/dev/tty", O_RDONLY)) < 0) fd = 0;
if ((fd = _open("/dev/tty", O_RDONLY)) < 0) fd = 0;
savesig = signal(SIGINT, SIG_IGN);
write(2, prompt, strlen(prompt));
gtty(fd, &tty);
_write(2, prompt, strlen(prompt));
_gtty(fd, &tty);
ttysave = tty;
tty.sg_flags &= ~ECHO;
stty(fd, &tty);
i = read(fd, pwdbuf, 9);
_stty(fd, &tty);
i = _read(fd, pwdbuf, 9);
while (pwdbuf[i - 1] != '\n')
read(fd, &pwdbuf[i - 1], 1);
_read(fd, &pwdbuf[i - 1], 1);
pwdbuf[i - 1] = '\0';
stty(fd, &ttysave);
write(2, "\n", 1);
if (fd != 0) close(fd);
_stty(fd, &ttysave);
_write(2, "\n", 1);
if (fd != 0) _close(fd);
signal(SIGINT, savesig);
return(pwdbuf);
}