10 void ui_helpline__pop(void)
14 char ui_helpline__current[512];
16 void ui_helpline__push(const char *msg)
18 const size_t sz = sizeof(ui_helpline__current);
20 SLsmg_gotorc(SLtt_Screen_Rows - 1, 0);
22 SLsmg_write_nstring((char *)msg, SLtt_Screen_Cols);
24 strncpy(ui_helpline__current, msg, sz)[sz - 1] = '\0';
27 void ui_helpline__vpush(const char *fmt, va_list ap)
31 if (vasprintf(&s, fmt, ap) < 0)
32 vfprintf(stderr, fmt, ap);
39 void ui_helpline__fpush(const char *fmt, ...)
44 ui_helpline__vpush(fmt, ap);
48 void ui_helpline__puts(const char *msg)
51 ui_helpline__push(msg);
54 void ui_helpline__init(void)
56 ui_helpline__puts(" ");
59 char ui_helpline__last_msg[1024];
61 int ui_helpline__show_help(const char *format, va_list ap)
66 pthread_mutex_lock(&ui__lock);
67 ret = vsnprintf(ui_helpline__last_msg + backlog,
68 sizeof(ui_helpline__last_msg) - backlog, format, ap);
71 if (ui_helpline__last_msg[backlog - 1] == '\n') {
72 ui_helpline__puts(ui_helpline__last_msg);
76 pthread_mutex_unlock(&ui__lock);