Revive commandline.c test program

master
Mike Massonnet 2014-11-15 22:59:30 +01:00
parent ad2168018a
commit d6d8e31dac
2 changed files with 8 additions and 6 deletions

View File

@ -33,6 +33,11 @@ libnetload_la_LIBADD = \
@LIBXFCE4PANEL_LIBS@ \ @LIBXFCE4PANEL_LIBS@ \
@LIBXFCE4UI_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 # .desktop file
# #
# Some automake trickery here. Because we cannot use $(libexecdir) in the # Some automake trickery here. Because we cannot use $(libexecdir) in the

View File

@ -33,9 +33,6 @@
#include "net.h" #include "net.h"
#include "utils.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; netdata data;
@ -76,9 +73,9 @@ int main(int argc, char* argv[])
for (;;) for (;;)
{ {
get_current_netload(&data, &in, &out, &tot); get_current_netload(&data, &in, &out, &tot);
format_with_thousandssep(bufIn, 20, (double)in, 2); format_byte_humanreadable(bufIn, 20, (double)in, 0);
format_with_thousandssep(bufOut, 20, (double)in, 2); format_byte_humanreadable(bufOut, 20, (double)out, 0);
format_with_thousandssep(bufTot, 20, (double)in, 2); format_byte_humanreadable(bufTot, 20, (double)tot, 0);
printf("Current netload:\nIN : %s\nOUT: %s\nTOT: %s\nIP: %s\n", printf("Current netload:\nIN : %s\nOUT: %s\nTOT: %s\nIP: %s\n",
bufIn, bufOut, bufTot, get_ip_address(&data)); bufIn, bufOut, bufTot, get_ip_address(&data));
sleep(1); sleep(1);