From 7b4c7a681cc4c0a53dc8a8baf4853e921cfbf5de Mon Sep 17 00:00:00 2001 From: bigbiff Date: Thu, 1 Jan 2015 19:44:14 -0500 Subject: Update blkid to 2.25.0 Break libblkid into 4 libraries: libblkid, libuuid, libutil-linux and libfdisk. This should help in later patch updates. Change-Id: I680d9a7feb031e5c29a603e9c58aff4b65826262 --- libblkid/src/colors.h | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 libblkid/src/colors.h (limited to 'libblkid/src/colors.h') diff --git a/libblkid/src/colors.h b/libblkid/src/colors.h new file mode 100644 index 000000000..97efc486a --- /dev/null +++ b/libblkid/src/colors.h @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2012 Ondrej Oprala + * Copyright (C) 2012-2014 Karel Zak + * + * This file may be distributed under the terms of the + * GNU Lesser General Public License. + */ +#ifndef UTIL_LINUX_COLORS_H +#define UTIL_LINUX_COLORS_H + +#include +#include + +#define UL_COLOR_RESET "\033[0m" +#define UL_COLOR_BOLD "\033[1m" +#define UL_COLOR_HALFBRIGHT "\033[2m" +#define UL_COLOR_UNDERSCORE "\033[4m" +#define UL_COLOR_BLINK "\033[5m" +#define UL_COLOR_REVERSE "\033[7m" + +/* Standard colors */ +#define UL_COLOR_BLACK "\033[30m" +#define UL_COLOR_RED "\033[31m" +#define UL_COLOR_GREEN "\033[32m" +#define UL_COLOR_BROWN "\033[33m" /* well, brown */ +#define UL_COLOR_BLUE "\033[34m" +#define UL_COLOR_MAGENTA "\033[35m" +#define UL_COLOR_CYAN "\033[36m" +#define UL_COLOR_GRAY "\033[37m" + +/* Bold variants */ +#define UL_COLOR_DARK_GRAY "\033[1;30m" +#define UL_COLOR_BOLD_RED "\033[1;31m" +#define UL_COLOR_BOLD_GREEN "\033[1;32m" +#define UL_COLOR_BOLD_YELLOW "\033[1;33m" +#define UL_COLOR_BOLD_BLUE "\033[1;34m" +#define UL_COLOR_BOLD_MAGENTA "\033[1;35m" +#define UL_COLOR_BOLD_CYAN "\033[1;36m" + +#define UL_COLOR_WHITE "\033[1;37m" + +/* --color[=WHEN] */ +enum colortmode { + UL_COLORMODE_AUTO = 0, + UL_COLORMODE_NEVER, + UL_COLORMODE_ALWAYS, + UL_COLORMODE_UNDEF, + + __UL_NCOLORMODES /* last */ +}; + +extern int colormode_from_string(const char *str); +extern int colormode_or_err(const char *str, const char *errmsg); + +/* Initialize the global variable UL_COLOR_TERM_OK */ +extern int colors_init(int mode, const char *util_name); + +/* Returns 1 or 0 */ +extern int colors_wanted(void); + +/* temporary enable/disable colors */ +extern void colors_off(void); +extern void colors_on(void); + + +/* Set the color */ +extern void color_fenable(const char *seq, FILE *f); + +extern void color_scheme_fenable(const char *name, const char *dflt, FILE *f); +extern const char *color_scheme_get_sequence(const char *name, const char *dflt); + +static inline void color_enable(const char *seq) +{ + color_fenable(seq, stdout); +} + +static inline void color_scheme_enable(const char *name, const char *dflt) +{ + color_scheme_fenable(name, dflt, stdout); +} + +/* Reset colors to default */ +extern void color_fdisable(FILE *f); + +static inline void color_disable(void) +{ + color_fdisable(stdout); +} + +/* converts "red" to UL_COLOR_RED, etc. */ +extern const char *color_sequence_from_colorname(const char *str); + + +#endif /* UTIL_LINUX_COLORS_H */ -- cgit v1.2.3