diff options
Diffstat (limited to 'shared')
-rw-r--r-- | shared/ansi-colors.h | 8 | ||||
-rw-r--r-- | shared/utils.c | 19 | ||||
-rw-r--r-- | shared/utils.h | 2 |
3 files changed, 29 insertions, 0 deletions
diff --git a/shared/ansi-colors.h b/shared/ansi-colors.h index 8294f2d..6e07e1e 100644 --- a/shared/ansi-colors.h +++ b/shared/ansi-colors.h @@ -1,6 +1,14 @@ #ifndef fooansicolorshfoo #define fooansicolorshfoo +extern const char *ansi_red; +extern const char *ansi_green; +extern const char *ansi_yellow; +extern const char *ansi_blue; +extern const char *ansi_magenta; +extern const char *ansi_grey; +extern const char *ansi_normal; + #define ANSI_RED "\x1B[0;31m" #define ANSI_GREEN "\x1B[0;32m" #define ANSI_YELLOW "\x1B[0;33m" diff --git a/shared/utils.c b/shared/utils.c index 20d9809..13cacac 100644 --- a/shared/utils.c +++ b/shared/utils.c @@ -17,6 +17,25 @@ unsigned debug_mask = 0; +const char *ansi_red = ""; +const char *ansi_green = ""; +const char *ansi_yellow = ""; +const char *ansi_blue = ""; +const char *ansi_magenta = ""; +const char *ansi_grey = ""; +const char *ansi_normal = ""; + +void enable_colors() +{ + ansi_red = ANSI_RED; + ansi_green = ANSI_GREEN; + ansi_yellow = ANSI_YELLOW; + ansi_blue = ANSI_BLUE; + ansi_magenta = ANSI_MAGENTA; + ansi_grey = ANSI_GREY; + ansi_normal = ANSI_NORMAL; +} + void socket_set_low_latency(int sfd, bool keepalive, bool iptos, bool nodelay) { int option; diff --git a/shared/utils.h b/shared/utils.h index 9171648..f5af292 100644 --- a/shared/utils.h +++ b/shared/utils.h @@ -66,6 +66,8 @@ struct saddr { struct list_head list; }; +void enable_colors(); + void socket_set_low_latency(int sfd, bool keepalive, bool iptos, bool nodelay); char *saddr_addr(struct saddr *saddr, char *buf, size_t len); |