blob: 6a11e1301559afe1bf6c734123bdddfa0440b76a [file] [log] [blame]
Arnaldo Carvalho de Melo55755362010-08-08 19:48:31 -03001#define _GNU_SOURCE
2#include <stdio.h>
3#include <stdlib.h>
4#include <newt.h>
5
6#include "helpline.h"
7
8void ui_helpline__pop(void)
9{
10 newtPopHelpLine();
11}
12
13void ui_helpline__push(const char *msg)
14{
15 newtPushHelpLine(msg);
16}
17
18static void ui_helpline__vpush(const char *fmt, va_list ap)
19{
20 char *s;
21
22 if (vasprintf(&s, fmt, ap) < 0)
23 vfprintf(stderr, fmt, ap);
24 else {
25 ui_helpline__push(s);
26 free(s);
27 }
28}
29
30void ui_helpline__fpush(const char *fmt, ...)
31{
32 va_list ap;
33
34 va_start(ap, fmt);
35 ui_helpline__vpush(fmt, ap);
36 va_end(ap);
37}
38
39void ui_helpline__puts(const char *msg)
40{
41 ui_helpline__pop();
42 ui_helpline__push(msg);
43}