1: #if defined(LIBC_SCCS) && !defined(lint)
2: static char sccsid[] = "@(#)getpass.c 5.2 (Berkeley) 3/9/86";
3: #endif LIBC_SCCS and not lint
4:
5: #include <stdio.h>
6: #include <signal.h>
7: #include <sgtty.h>
8:
9: char *
10: getpass(prompt)
11: char *prompt;
12: {
13: struct sgttyb ttyb;
14: int flags;
15: register char *p;
16: register c;
17: FILE *fi;
18: static char pbuf[9];
19: int (*signal())();
20: int (*sig)();
21:
22: if ((fi = fdopen(open("/dev/tty", 2), "r")) == NULL)
23: fi = stdin;
24: else
25: setbuf(fi, (char *)NULL);
26: sig = signal(SIGINT, SIG_IGN);
27: ioctl(fileno(fi), TIOCGETP, &ttyb);
28: flags = ttyb.sg_flags;
29: ttyb.sg_flags &= ~ECHO;
30: ioctl(fileno(fi), TIOCSETP, &ttyb);
31: fprintf(stderr, "%s", prompt); fflush(stderr);
32: for (p=pbuf; (c = getc(fi))!='\n' && c!=EOF;) {
33: if (p < &pbuf[8])
34: *p++ = c;
35: }
36: *p = '\0';
37: fprintf(stderr, "\n"); fflush(stderr);
38: ttyb.sg_flags = flags;
39: ioctl(fileno(fi), TIOCSETP, &ttyb);
40: signal(SIGINT, sig);
41: if (fi != stdin)
42: fclose(fi);
43: return(pbuf);
44: }
Defined functions
getpass
defined in line
9; used 32 times
- in /usr/src/bin/login.c line
75,
214
- in /usr/src/bin/passwd.c line
44,
270,
278,
316
- in /usr/src/bin/su.c line
38,
99
- in /usr/src/lib/libc/net/rexec.c line
23
- in /usr/src/lib/libc/net/ruserpass.c line
18,
45
- in /usr/src/new/mh/support/bboards/mmdfI/bboards/getbbent.c line
70,
465
- in /usr/src/new/mh/support/bboards/mmdfII/bboards/getbbent.c line
70,
465
- in /usr/src/new/mh/support/pop/mmdfII/pop/getbbent.c line
70,
465
- in /usr/src/new/mh/support/pop/popwrd.c line
18,
88,
112
- in /usr/src/new/mh/zotnet/bboards/getbbent.c line
70,
465
- in /usr/src/new/xns/examples/ch/listaliasof.c line
62
- in /usr/src/ucb/ex/ex.c line
270
- in /usr/src/ucb/ex/ex.h line
330
- in /usr/src/ucb/ftp/ruserpass.c line
29
- in /usr/src/ucb/lock.c line
38
- in /usr/src/ucb/rsh.c line
35
- in /usr/src/usr.bin/crypt.c line
16,
87
- in /usr/src/usr.bin/xsend/enroll.c line
22
- in /usr/src/usr.bin/xsend/xget.c line
34
Defined variables
sccsid
defined in line
2;
never used