output: make warning and critical colors work in html output

Users should combine this with --color=always to web pages to work
correctly.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2017-11-12 22:09:19 +00:00
parent a64630aa49
commit c029c7581a
No known key found for this signature in database
GPG key ID: A9553245FDE9B739
3 changed files with 81 additions and 55 deletions

View file

@ -108,6 +108,35 @@ enum prefix_t {
NUM_OF_PREFIX
};
/*! \enum output_formats
* \brief Enumeration of output formats. Keep the text and html first, they
* are used color array selector.
*/
enum output_formats {
OUT_FORM_TEXT,
OUT_FORM_HTML,
NUM_OF_OUT_FORMS
};
/*! \enum count_status_t
* \brief Enumeration of possible range and shared net statuses.
*/
enum count_status_t {
STATUS_OK,
STATUS_WARN,
STATUS_CRIT,
STATUS_IGNORED,
STATUS_SUPPRESSED,
COLOR_RESET
};
enum color_mode {
color_unknown,
color_off,
color_on,
color_auto /* default */
};
/*! \struct shared_network_t
* \brief Counters for an individual shared network.
*/
@ -133,17 +162,6 @@ struct range_t {
double backups;
};
/*! \enum count_status_t
* \brief Enumeration of possible range and shared net statuses.
*/
enum count_status_t {
STATUS_OK,
STATUS_WARN,
STATUS_CRIT,
STATUS_IGNORED,
STATUS_SUPPRESSED
};
/*! \struct output_helper_t
* \brief Various per range and shared net temporary calculation results.
*/
@ -204,21 +222,6 @@ enum limbits {
# define STATE_WARNING 1
# define STATE_CRITICAL 2
/*! \def COLOR_BOLD_RED
* \brief Shell warning color.
*/
# define COLOR_BOLD_RED "\033[1;31m"
# define COLOR_BOLD_YELLOW "\033[1;33m"
# define COLOR_BOLD_GREEN "\033[1;32m"
# define COLOR_BOLD_BLUE "\033[1;34m"
# define COLOR_RESET "\033[0m"
enum color_mode {
color_unknown,
color_off,
color_on,
color_auto /* default */
};
/*! \var comparer_t
* \brief Function pointer holding sort algorithm.
*/
@ -246,7 +249,7 @@ struct conf_t {
enum dhcp_version ip_version;
const char *dhcpdconf_file;
const char *dhcpdlease_file;
const int output_format;
int output_format;
struct output_sort *sorts;
const char *output_file;
const char *mustach_template;