summaryrefslogtreecommitdiff
path: root/src/print_wireless_info.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/print_wireless_info.c')
-rw-r--r--src/print_wireless_info.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/print_wireless_info.c b/src/print_wireless_info.c
index 1aca346..530d9cf 100644
--- a/src/print_wireless_info.c
+++ b/src/print_wireless_info.c
@@ -224,6 +224,9 @@ static int get_wireless_info(const char *interface, wireless_info_t *info) {
void print_wireless_info(const char *interface, const char *format_up, const char *format_down) {
const char *walk;
wireless_info_t info;
+ if (output_format == O_I3BAR)
+ printf("{\"name\":\"wireless\", \"instance\": \"%s\", ", interface);
+
if (get_wireless_info(interface, &info)) {
walk = format_up;
if (info.flags & WIRELESS_INFO_FLAG_HAS_QUALITY)
@@ -234,6 +237,9 @@ void print_wireless_info(const char *interface, const char *format_up, const cha
printf("%s", color("color_bad"));
}
+ if (output_format == O_I3BAR)
+ printf("\"full_text\":\"");
+
for (; *walk != '\0'; walk++) {
if (*walk != '%') {
putchar(*walk);
@@ -308,4 +314,7 @@ void print_wireless_info(const char *interface, const char *format_up, const cha
}
(void)printf("%s", endcolor());
+
+ if (output_format == O_I3BAR)
+ printf("\"}");
}