From: Siraaj Khandkar Date: Wed, 6 Mar 2019 18:03:13 +0000 (-0500) Subject: Fix shown as percentage when no link present X-Git-Url: https://git.xandkar.net/?a=commitdiff_plain;h=fcc91548b828f5f4dcbaebe64c18cc6bb1df5a88;p=khatus.git Fix shown as percentage when no link present --- diff --git a/x2/src/awk/exe/bar.awk b/x2/src/awk/exe/bar.awk index 84f0ada..0e81833 100644 --- a/x2/src/awk/exe/bar.awk +++ b/x2/src/awk/exe/bar.awk @@ -182,9 +182,12 @@ function bar_make_status_net_wifi(interface, src) { return cache_get_fmt_def(src, "status" Kfs interface, 10, "%s") } -function bar_make_status_net_wifi_link(interface, src) { - src = "khatus_sensor_net_wifi_status" - return cache_get_fmt_def(src, "link" Kfs interface, 10, "%d%%") +function bar_make_status_net_wifi_link(interface, link) { + cache_get_fmt_def(link, "khatus_sensor_net_wifi_status", "link" Kfs interface, 10) + if (!link["is_expired"] && link["value"]) + return sprintf("%d%%", link["value"]) + else + return "--" } # -----------------------------------------------------------------------------