promptusr.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* promptusr.c --- prompt user for input/output
*/
#include <k5-int.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <termios.h>
#include <signal.h>
#include <setjmp.h>
typedef struct _krb5_uio {
int flags;
char * prompt;
char * response;
} *krb5_uio;
#define KRB5_UIO_GETRESPONSE 0x0001
#define KRB5_UIO_ECHORESPONSE 0x0002
#define KRB5_UIO_FREE_PROMPT 0x0004
/*ARGSUSED*/
static krb5_sigtype
int signo;
{
/*NOTREACHED*/
}
/*ARGSUSED*/
{
volatile krb5_error_code retval;
krb5_sigtype (*volatile ointrfunc)();
krb5_uio p;
int fd;
char read_string[BUFSIZ];
char *cp;
int ch;
/* get the file descriptor associated with stdin */
return errno;
goto cleanup;
}
/* save intrfunc */
if (p->prompt) {
}
if ((p->flags & KRB5_UIO_GETRESPONSE) == 0)
continue;
if ((p->flags & KRB5_UIO_ECHORESPONSE) == 0)
return errno;
(void) putchar('\n');
goto cleanup;
}
/* replace newline with null */
*cp = '\0';
else /* flush rest of input line */
do {
goto cleanup;
}
if ((p->flags & KRB5_UIO_ECHORESPONSE) == 0) {
(void) putchar('\n');
goto cleanup;
}
}
}
retval = 0;
if (retval) {
if (p->response) {
p->response = 0;
}
}
}
return retval;
}
/*ARGSUSED*/
void
{
if (p->response)
free(p);
}
}
#ifdef TEST_DRIVER
KRB5_UIO_ECHORESPONSE, "Password 2: " };
void
{
krb5_os_get_tty_uio(0, &uio_a);
exit(0);
}
#endif
#endif /* !_MSODS || _!MACINTOSH */