-#ifdef DEBUG
-extern int debug;
-#endif
-
-char * mygetpass(prompt)
-char *prompt;
-{
-#if defined(DOS) || defined(VMS)
- static char buf[256];
- int i, c;
-
-#ifdef DEBUG
- if (debug & D_TRACE)
- printf("->mygetpass(%s)\n", prompt);
-#endif
- printf("%s", prompt);
- i = 0;
- while ( (c = getch()) != EOF && c != '\n' && c != '\r' )
- buf[i++] = c;
- if ( c == EOF )
- return( NULL );
- buf[i] = '\0';
- return (buf);
-#else
- int no_pass = 0;
- char i, j, k;
- TERMIO_TYPE ttyb;
- TERMFLAG_TYPE flags;
- static char pbuf[513];
- register char *p;
- register int c;
- FILE *fi;
- SIG_FN (*sig)();
-
-#ifdef DEBUG
- if (debug & D_TRACE)
- printf("->mygetpass(%s)\n", prompt);
-#endif
- /*
- * Stolen from the getpass() routine. Can't use the plain
- * getpass() for two reasons. One is that LDAP passwords
- * can be really, really long - much longer than 8 chars.
- * The second is that we like to make this client available
- * out of inetd via a Merit asynch port, and we need to be
- * able to do telnet control codes to turn on and off line
- * blanking.
- */
- if ((fi = fdopen(open("/dev/tty", 2), "r")) == NULL)
- fi = stdin;
- else
- setbuf(fi, (char *)NULL);
- sig = signal(SIGINT, SIG_IGN);
- if (fi != stdin) {
- if (GETATTR(fileno(fi), &ttyb) < 0)
- perror("GETATTR");
- }
- flags = GETFLAGS( ttyb );
- SETFLAGS( ttyb, flags & ~ECHO );
- if (fi != stdin) {
- if (SETATTR(fileno(fi), &ttyb) < 0)
- perror("SETATTR");
- }