From cdb450376e52bad45969c87a44908ef6e9997f39 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sat, 26 Sep 2009 13:26:13 +0200 Subject: [PATCH] =?utf8?q?Bugfix:=20Don=E2=80=99t=20show=20colors=20in=20w?= =?utf8?q?ireless=20info=20if=20colors=20are=20disabled=20(Thanks=20shatte?= =?utf8?q?r)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/get_wireless_info.c | 4 +--- src/output.c | 4 ++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/get_wireless_info.c b/src/get_wireless_info.c index 529ba71..2cdcb8c 100644 --- a/src/get_wireless_info.c +++ b/src/get_wireless_info.c @@ -33,9 +33,7 @@ const char *get_wireless_info() { if (sscanf(interfaces, "%*[^:]: 0000 %d", &quality) != 1) continue; if ((quality == UCHAR_MAX) || (quality == 0)) { - if (use_colors) - (void)snprintf(part, sizeof(part), "%sW: down%s", color("#FF0000"), endcolor()); - else (void)snprintf(part, sizeof(part), "W: down"); + (void)snprintf(part, sizeof(part), "%sW: down%s", color("#FF0000"), endcolor()); } else (void)snprintf(part, sizeof(part), "%sW: (%03d%%) %s%s", color("#00FF00"), quality, get_ip_addr(wlan_interface), endcolor()); return part; diff --git a/src/output.c b/src/output.c index c153a01..eee458b 100644 --- a/src/output.c +++ b/src/output.c @@ -26,6 +26,10 @@ void write_error_to_statusbar(const char *message) { */ char *color(const char *colorstr) { static char colorbuf[32]; + if (!use_colors) { + colorbuf[0] = '\0'; + return colorbuf; + } #ifdef DZEN (void)snprintf(colorbuf, sizeof(colorbuf), "^fg(%s)", colorstr); #elif XMOBAR -- 2.39.5