int ui_browser__warning(struct ui_browser *browser, int timeout, const char *format, ...) { va_list args; char *text; int key = 0, err; va_start(args, format); err = vasprintf(&text, format, args); va_end(args); if (err < 0) { va_start(args, format); ui_helpline__vpush(format, args); va_end(args); } else { while ((key == ui__question_window("Warning!", text, "Press any key...", timeout)) == K_RESIZE) ui_browser__handle_resize(browser); free(text); } return key; }
void ui__exit(bool wait_for_ok) { if (wait_for_ok) ui__question_window("Fatal Error", ui_helpline__last_msg, "Press any key...", 0); SLtt_set_cursor_visibility(1); SLsmg_refresh(); SLsmg_reset_smg(); SLang_reset_tty(); perf_error__unregister(&perf_tui_eops); }
static int __ui__warning(const char *title, const char *format, va_list args) { char *s; if (vasprintf(&s, format, args) > 0) { int key; key = ui__question_window(title, s, "Press any key...", 0); free(s); return key; } fprintf(stderr, "%s\n", title); vfprintf(stderr, format, args); return K_ESC; }
int ui__dialog_yesno(const char *msg) { return ui__question_window(NULL, msg, "Enter: Yes, ESC: No", 0); }
int ui__help_window(const char *text) { return ui__question_window("Help", text, "Press any key...", 0); }