Esempio n. 1
0
int userprompt(unsigned id,...)
{
    char *fmt, *str;
    int ch;

    if(!getPromptString(id, &str, &fmt))
        return 0;

    /* Issue message */
    if(*fmt) {
        va_list ap;

        va_start(ap, id);
        vprintf(fmt, ap);
        va_end(ap);
    }

    while((ch = vcgetchar()) == 0 || (ch = mapMetakey(str, ch)) == 0)
        beep();                     /* hit erroreous character */

    outc('\n');                /* advance to next line */
    freePromptString(str, fmt);

    return ch;
}
Esempio n. 2
0
int vcgetcstr(const char *const legalCh)
{   int ch;

    assert(legalCh);

    fflush(stdout);               /* Make sure the pending output arrives the
								   screen as we bypass the stdio interface */
    while ((ch = vcgetchar()) == 0 || !strchr(legalCh, ch))
        beep();                     /* hit erroreous character */
    outc('\n');                /* advance to next line */
    return ch;
}
Esempio n. 3
0
/*
 *  get a visual character that must match one of the supplied
 *  ones
 */
int vcgetcstr(const char *const legalCh)
{
  int ch;

  assert(legalCh);

  fflush(stdout);               /* Make sure the pending output arrives the
                                   screen as we bypass the stdio interface */
  while ((ch = toupper(vcgetchar())) == 0
         || !strchr(legalCh, ch))
  {
    if (cbreak)
    {
      ch = CTL_C;                /* This is ^C for ^Break */
      break;
    }
    beep();                     /* hit erroreous character */
  }
  putchar('\n');                /* advance to next line */
  return ch;
}