- if (isprint(c) && (p - buf < buflen)) {
- (void) waddch(cur_ms->ms_input, c);
- *p++ = c;
- x++;
- } else
- putchar(CTL('G'));
- break;
- }
- }
- end_input:
- (void) waddch(cur_ms->ms_input, '\n');
- (void) waddch(cur_ms->ms_input, '\r');
-
- (void) wclrtoeol(cur_ms->ms_input);
- refresh_ms(cur_ms);
- *p = '\0';
- Start_paging();
- goto gotit;
- } else {
- printf("%s", prompt);
- if (gets(buf) == NULL)
- return 0;
- Start_paging();
- goto gotit;
- }
-gotit:
- strcpy(buf, strtrim(buf));
- return 1;
-}
-
-/* Prompt the user for input in the input window of cur_ms, but don't echo
- and allow some control characters */
-int Password_input(prompt, buf, buflen)
- char *prompt;
- char *buf;
- int buflen;
-{
- int c;
- char *p;
- int y, x, oldx;
-
- if (cur_ms != NULLMS) {
- more_flg = 1;
- getyx(cur_ms->ms_input, y, x);
- (void) wmove(cur_ms->ms_input, y, 0);
-
- touchwin(cur_ms->ms_screen);
- refresh_ms(cur_ms);
- (void) waddstr(cur_ms->ms_input, prompt);
- getyx(cur_ms->ms_input, y, x);
-
- oldx = x;
- for (p = buf; p - buf < buflen;) {
- (void) wmove(cur_ms->ms_input, y, x);
- (void) wclrtoeol(cur_ms->ms_input);
- refresh_ms(cur_ms);
- c = getchar() & 0x7f;
- switch (c) {
- case CTL('C'):
- return 0;
- case CTL('Z'):
- (void) kill(getpid(), SIGTSTP);
- touchwin(curscr);
- break;
- case CTL('L'):
- (void) wclear(cur_ms->ms_input);
- (void) waddstr(cur_ms->ms_input, prompt);
- refresh_ms(cur_ms);
- getyx(cur_ms->ms_input, y, x);
- break;
- case '\n':
- case '\r':
- (void) waddch(cur_ms->ms_input, '\n');
- (void) waddch(cur_ms->ms_input, '\r');
-
- (void) wclrtoeol(cur_ms->ms_input);
- refresh_ms(cur_ms);
- *p = '\0';
- Start_paging();
- return 1;
- case '\b':
- case '\177':
- if (p > buf) {
- p--;
- x--;