11 void ui_helpline__pop(void)
15 char ui_helpline__current[512];
17 void ui_helpline__push(const char *msg)
19 const size_t sz = sizeof(ui_helpline__current);
21 SLsmg_gotorc(SLtt_Screen_Rows - 1, 0);
23 SLsmg_write_nstring((char *)msg, SLtt_Screen_Cols);
25 strncpy(ui_helpline__current, msg, sz)[sz - 1] = '\0';
28 void ui_helpline__vpush(const char *fmt, va_list ap)
32 if (vasprintf(&s, fmt, ap) < 0)
33 vfprintf(stderr, fmt, ap);
40 void ui_helpline__fpush(const char *fmt, ...)
45 ui_helpline__vpush(fmt, ap);
49 void ui_helpline__puts(const char *msg)
52 ui_helpline__push(msg);
55 void ui_helpline__init(void)
57 ui_helpline__puts(" ");
60 char ui_helpline__last_msg[1024];
62 int ui_helpline__show_help(const char *format, va_list ap)
67 pthread_mutex_lock(&ui__lock);
68 ret = vscnprintf(ui_helpline__last_msg + backlog,
69 sizeof(ui_helpline__last_msg) - backlog, format, ap);
72 if (ui_helpline__last_msg[backlog - 1] == '\n') {
73 ui_helpline__puts(ui_helpline__last_msg);
77 pthread_mutex_unlock(&ui__lock);