summaryrefslogtreecommitdiff
path: root/src/print_eth_info.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/print_eth_info.c')
-rw-r--r--src/print_eth_info.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/print_eth_info.c b/src/print_eth_info.c
index 28ba6c1..4fae191 100644
--- a/src/print_eth_info.c
+++ b/src/print_eth_info.c
@@ -78,6 +78,9 @@ void print_eth_info(const char *interface, const char *format_up, const char *fo
const char *walk;
const char *ip_address = get_ip_addr(interface);
+ if (output_format == O_I3BAR)
+ printf("{\"name\":\"ethernet\", \"instance\": \"%s\", ", interface);
+
if (ip_address == NULL) {
printf("%s", color("color_bad"));
printf("%s", format_down);
@@ -87,6 +90,9 @@ void print_eth_info(const char *interface, const char *format_up, const char *fo
printf("%s", color("color_good"));
}
+ if (output_format == O_I3BAR)
+ printf("\"full_text\":\"");
+
for (walk = format_up; *walk != '\0'; walk++) {
if (*walk != '%') {
putchar(*walk);
@@ -103,4 +109,7 @@ void print_eth_info(const char *interface, const char *format_up, const char *fo
}
(void)printf("%s", endcolor());
+
+ if (output_format == O_I3BAR)
+ printf("\"}");
}