Linux Kernel
3.7.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
tools
perf
ui
helpline.c
Go to the documentation of this file.
1
#include <
stdio.h
>
2
#include <
stdlib.h
>
3
#include <string.h>
4
5
#include "../debug.h"
6
#include "
helpline.h
"
7
#include "
ui.h
"
8
9
char
ui_helpline__current
[512];
10
11
static
void
nop_helpline__pop(
void
)
12
{
13
}
14
15
static
void
nop_helpline__push(
const
char
*
msg
__maybe_unused
)
16
{
17
}
18
19
static
struct
ui_helpline
default_helpline_fns = {
20
.pop = nop_helpline__pop,
21
.push = nop_helpline__push,
22
};
23
24
struct
ui_helpline
*
helpline_fns
= &default_helpline_fns;
25
26
void
ui_helpline__pop
(
void
)
27
{
28
helpline_fns->
pop
();
29
}
30
31
void
ui_helpline__push
(
const
char
*
msg
)
32
{
33
helpline_fns->
push
(msg);
34
}
35
36
void
ui_helpline__vpush
(
const
char
*
fmt
,
va_list
ap)
37
{
38
char
*
s
;
39
40
if
(vasprintf(&s, fmt, ap) < 0)
41
vfprintf
(stderr, fmt, ap);
42
else
{
43
ui_helpline__push
(s);
44
free
(s);
45
}
46
}
47
48
void
ui_helpline__fpush
(
const
char
*
fmt
, ...)
49
{
50
va_list
ap;
51
52
va_start
(ap, fmt);
53
ui_helpline__vpush
(fmt, ap);
54
va_end
(ap);
55
}
56
57
void
ui_helpline__puts
(
const
char
*
msg
)
58
{
59
ui_helpline__pop
();
60
ui_helpline__push
(msg);
61
}
Generated on Thu Jan 10 2013 15:09:18 for Linux Kernel by
1.8.2