# 2.11BSD#431 - /usr/src/lib/libc/gen/getpass.c

##### Functions

    getpass           X

       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 20 times

- in /usr/include/unistd.h line 78
- in /usr/src/bin/login/login.c line 101, 250
- in /usr/src/bin/passwd/passwd.c line 215-219(2), 227, 243
- in /usr/src/bin/su.c line 95
- in /usr/src/games/phantasia/func1.c line 76
- in /usr/src/games/phantasia/main.c line 213-215(2)
- in /usr/src/games/phantasia/phant.h line 149
- in /usr/src/lib/libc/net/ruserpass.c line 48
- in /usr/src/ucb/ftp/cmds.c line 1296, 1628
- in /usr/src/ucb/ftp/ftp.c line 233-238(2)
- in /usr/src/ucb/rsh.c line 35
- in /usr/src/usr.bin/crypt.c line 18, 88

#### Defined variables

sccsid defined in line 2; never used

Last modified: 1986-03-10 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 562 |