pacemaker
2.0.3-4b1f869f0f
Scalable High-Availability cluster resource manager
include
crm
common
curses_internal.h
Go to the documentation of this file.
1
/*
2
* Copyright 2015-2019 the Pacemaker project contributors
3
*
4
* The version control history for this file may have further details.
5
*
6
* This source code is licensed under the GNU Lesser General Public License
7
* version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
8
*/
9
10
#ifndef CURSES_INTERNAL_H
11
# define CURSES_INTERNAL_H
12
13
# include <stdio.h>
14
15
# include <
config.h
>
16
# include <
crm/common/logging.h
>
17
18
/*
19
* The man pages for both curses and ncurses suggest inclusion of "curses.h".
20
* We believe the following to be acceptable and portable.
21
*/
22
23
# if defined(HAVE_LIBNCURSES) || defined(HAVE_LIBCURSES)
24
# if defined(HAVE_NCURSES_H) && !defined(HAVE_INCOMPATIBLE_PRINTW)
25
# include <ncurses.h>
26
# define CURSES_ENABLED 1
27
# elif defined(HAVE_NCURSES_NCURSES_H) && !defined(HAVE_INCOMPATIBLE_PRINTW)
28
# include <ncurses/ncurses.h>
29
# define CURSES_ENABLED 1
30
# elif defined(HAVE_CURSES_H) && !defined(HAVE_INCOMPATIBLE_PRINTW)
31
# include <curses.h>
32
# define CURSES_ENABLED 1
33
# elif defined(HAVE_CURSES_CURSES_H) && !defined(HAVE_INCOMPATIBLE_PRINTW)
34
# include <curses/curses.h>
35
# define CURSES_ENABLED 1
36
# else
37
# define CURSES_ENABLED 0
38
# endif
39
# else
40
# define CURSES_ENABLED 0
41
# endif
42
43
# if CURSES_ENABLED
44
# define status_printw(fmt, args...) printw(fmt, ##args)
45
# else
46
# define status_printw(fmt, args...) \
47
crm_err("printw support requires ncurses to be available during configure"); \
48
do_crm_log(LOG_WARNING, fmt, ##args);
49
# endif
50
51
# define status_print(fmt, args...) \
52
if(options & pe_print_html) { \
53
FILE *stream = print_data; \
54
fprintf(stream, fmt, ##args); \
55
} else if(options & pe_print_ncurses) { \
56
status_printw(fmt, ##args); \
57
} else if(options & pe_print_printf) { \
58
FILE *stream = print_data; \
59
fprintf(stream, fmt, ##args); \
60
} else if(options & pe_print_xml) { \
61
FILE *stream = print_data; \
62
fprintf(stream, fmt, ##args); \
63
} else if(options & pe_print_log) { \
64
int log_level = *(int*)print_data; \
65
do_crm_log(log_level, fmt, ##args); \
66
}
67
68
#endif
logging.h
Wrappers for and extensions to libqb logging.
config.h
Generated on Thu Mar 4 2021 09:29:48 for pacemaker by
1.8.17