Re-use AWK components
[khatus.git] / bin / khatus_parse_bluetoothctl_show
diff --git a/bin/khatus_parse_bluetoothctl_show b/bin/khatus_parse_bluetoothctl_show
deleted file mode 100755 (executable)
index 0d56853..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-#! /usr/bin/awk -f
-
-BEGIN {
-    OFS = msg_fs ? msg_fs : "|"
-    Kfs = key_fs ? key_fs : ":"
-}
-
-/^Controller / {
-    controller = $2
-    controllers[++ctrl_count] = controller
-}
-
-/^\t[A-Z][A-Za-z]+:/ {
-    key = $1
-    sub(":$", "", key)
-    sub("^\t" $1 " *", "")
-    val = $0
-    data[controller, key] = val
-}
-
-END {
-    # Using the 1st seen controller. Should we select specific instead?
-    power_status = data[controllers[1], "Powered"]
-    if (ctrl_count > 0) {
-        if (power_status == "no") {
-            show = "off"
-        } else if (power_status == "yes") {
-            show = "on"
-        } else {
-            print_error("Unexpected bluetooth power status: " power_status)
-            show = "ERROR"
-        }
-    } else {
-        show = "n/a"
-    }
-    print("power_status", show)
-}
-
-function print_error(msg) {
-    print(msg) > "/dev/stderr"
-}
This page took 0.026228 seconds and 4 git commands to generate.