static void fg_message (int flags, const char *title, const char *text) { Dlg_head *d; d = do_create_message (flags, title, text); tty_getch (); dlg_run_done (d); destroy_dlg (d); }
static void fg_message (int flags, const char *title, const char *text) { WDialog *d; d = do_create_message (flags, title, text); tty_getch (); dlg_run_done (d); dlg_destroy (d); }
size_t tty_read(uint64_t source, struct vfs_obj *file, uint8_t *buffer, size_t size, uint64_t offset) { size_t i; for (i = 0; i < size; i++) { buffer[i] = tty_getch(); if (buffer[i] == '\0') { break; } } return i; }
int tty_gets (size_t nchars, char buf [], int number, int echo) { unsigned ofs = 0; char ch; for (;;) { ch = tty_getch (); /*printf ("{%d}", ch);*/ fflush (stdout); if (ch == ESC) return (1); else if (ch == BS || ch == DEL) if (ofs) { ofs--; if (echo) { printf ("%c %c", BS, BS); fflush (stdout); } } else printf ("\a"); else if (ch == CR || ch == LF) { if (echo) { printf ("\r\n"); fflush (stdout); } buf [ofs] = '\0'; return (0); } else if (number && (ch < '0' || ch > '9')) printf ("\a"); else if (ch < ' ' || ch > '~') printf ("\a"); else { if (ofs < nchars - 1) { buf [ofs++] = ch; if (echo) { if (echo == '*') printf ("*"); else printf ("%c", ch); fflush (stdout); } } else printf ("\a"); } } }