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);