diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-08-08 18:48:31 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-08-10 15:08:51 -0400 |
commit | 5575536fc7ad7577a4e687a13e2f49acebc519f3 (patch) | |
tree | 9cba0637a9fa243b78be5f1083deff11a27f45e9 /tools/perf/util/ui/helpline.c | |
parent | d247eb6b924bbc2f13748c89b6c72c7a3d46645c (diff) |
perf ui: Move ui_helpline routines to separate file in util/ui/
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/ui/helpline.c')
-rw-r--r-- | tools/perf/util/ui/helpline.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tools/perf/util/ui/helpline.c b/tools/perf/util/ui/helpline.c new file mode 100644 index 000000000000..6a11e1301559 --- /dev/null +++ b/tools/perf/util/ui/helpline.c | |||
@@ -0,0 +1,43 @@ | |||
1 | #define _GNU_SOURCE | ||
2 | #include <stdio.h> | ||
3 | #include <stdlib.h> | ||
4 | #include <newt.h> | ||
5 | |||
6 | #include "helpline.h" | ||
7 | |||
8 | void ui_helpline__pop(void) | ||
9 | { | ||
10 | newtPopHelpLine(); | ||
11 | } | ||
12 | |||
13 | void ui_helpline__push(const char *msg) | ||
14 | { | ||
15 | newtPushHelpLine(msg); | ||
16 | } | ||
17 | |||
18 | static 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 | |||
30 | void 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 | |||
39 | void ui_helpline__puts(const char *msg) | ||
40 | { | ||
41 | ui_helpline__pop(); | ||
42 | ui_helpline__push(msg); | ||
43 | } | ||