From d6d8e31dac274ec73b082da9fcce9247d71e5157 Mon Sep 17 00:00:00 2001 From: Mike Massonnet Date: Sat, 15 Nov 2014 22:59:30 +0100 Subject: [PATCH] Revive commandline.c test program --- panel-plugin/Makefile.am | 5 +++++ panel-plugin/commandline.c | 9 +++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/panel-plugin/Makefile.am b/panel-plugin/Makefile.am index 94f6b95..f37efa2 100644 --- a/panel-plugin/Makefile.am +++ b/panel-plugin/Makefile.am @@ -33,6 +33,11 @@ libnetload_la_LIBADD = \ @LIBXFCE4PANEL_LIBS@ \ @LIBXFCE4UI_LIBS@ +check_PROGRAMS = commandline +commandline_SOURCES = commandline.c utils.c utils.h net.c net.h +commandline_CFLAGS = @LIBXFCE4PANEL_CFLAGS@ +commandline_LDADD = @LIBXFCE4PANEL_LIBS@ + # .desktop file # # Some automake trickery here. Because we cannot use $(libexecdir) in the diff --git a/panel-plugin/commandline.c b/panel-plugin/commandline.c index 9493c66..5624845 100644 --- a/panel-plugin/commandline.c +++ b/panel-plugin/commandline.c @@ -33,9 +33,6 @@ #include "net.h" #include "utils.h" -/* This is not good style, but it works for testing and simplifies compilation */ -#include "net.c" -#include "utils.c" netdata data; @@ -76,9 +73,9 @@ int main(int argc, char* argv[]) for (;;) { get_current_netload(&data, &in, &out, &tot); - format_with_thousandssep(bufIn, 20, (double)in, 2); - format_with_thousandssep(bufOut, 20, (double)in, 2); - format_with_thousandssep(bufTot, 20, (double)in, 2); + format_byte_humanreadable(bufIn, 20, (double)in, 0); + format_byte_humanreadable(bufOut, 20, (double)out, 0); + format_byte_humanreadable(bufTot, 20, (double)tot, 0); printf("Current netload:\nIN : %s\nOUT: %s\nTOT: %s\nIP: %s\n", bufIn, bufOut, bufTot, get_ip_address(&data)); sleep(1);