backup counting: fix output regression

The backup count was not printed at all.  This bug was introduced in
version 2.17 (May 2012) when the uthash was taken in use.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2012-12-09 22:14:22 +00:00
parent 3471c91796
commit f1411858cb
4 changed files with 23 additions and 26 deletions

View file

@ -45,6 +45,7 @@
#include <inttypes.h>
#include <langinfo.h>
#include <netinet/in.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
@ -90,7 +91,7 @@ int output_txt(void)
max_ipaddr_length,
"last ip",
"max", "cur", "percent", "touch", "t+c", "t+c perc");
if (0 < num_backups) {
if (config.backups_found == true) {
fprintf(outfile, " bu bu perc");
}
fprintf(outfile, "\n");
@ -121,7 +122,7 @@ int output_txt(void)
(float)(100 *
(range_p->touched +
range_p->count)) / range_size);
if (0 < num_backups) {
if (config.backups_found == true) {
fprintf(outfile, "%7lu %8.3f",
range_p->backups,
(float)(100 * range_p->backups) /
@ -140,7 +141,7 @@ int output_txt(void)
fprintf(outfile, "Shared networks:\n");
fprintf(outfile,
"name max cur percent touch t+c t+c perc");
if (0 < num_backups) {
if (config.backups_found == true) {
fprintf(outfile, " bu bu perc");
}
fprintf(outfile, "\n");
@ -159,7 +160,7 @@ int output_txt(void)
(shared_p->touched +
shared_p->used)) /
shared_p->available);
if (0 < num_backups) {
if (config.backups_found == true) {
fprintf(outfile, "%7lu %8.3f",
shared_p->backups,
(float)(100 * shared_p->backups) /
@ -178,7 +179,7 @@ int output_txt(void)
fprintf(outfile,
"name max cur percent touch t+c t+c perc");
if (0 < num_backups) {
if (config.backups_found == true) {
fprintf(outfile, " bu bu perc");
}
fprintf(outfile, "\n");
@ -197,7 +198,7 @@ int output_txt(void)
shared_networks->used)) /
shared_networks->available);
if (0 < num_backups) {
if (config.backups_found == true) {
fprintf(outfile, "%7lu %8.3f",
shared_networks->backups,
(float)(100 * shared_networks->backups) /
@ -710,7 +711,7 @@ int output_html(void)
output_line(outfile, "th", "ralign", "touch");
output_line(outfile, "th", "ralign", "t+c");
output_line(outfile, "th", "ralign", "t+c perc");
if (0 < num_backups) {
if (config.backups_found == true) {
output_line(outfile, "th", "ralign", "bu");
output_line(outfile, "th", "ralign", "bu perc");
}
@ -742,7 +743,7 @@ int output_html(void)
(float)(100 *
(range_p->touched +
range_p->count)) / range_size);
if (0 < num_backups) {
if (config.backups_found == true) {
output_long(outfile, "td", range_p->backups);
output_float(outfile, "td",
(float)(100 *
@ -766,7 +767,7 @@ int output_html(void)
output_line(outfile, "th", "ralign", "touch");
output_line(outfile, "th", "ralign", "t+c");
output_line(outfile, "th", "ralign", "t+c perc");
if (0 < num_backups) {
if (config.backups_found == true) {
output_line(outfile, "th", "ralign", "bu");
output_line(outfile, "th", "ralign", "bu perc");
}
@ -790,7 +791,7 @@ int output_html(void)
(shared_p->touched +
shared_p->used)) /
shared_p->available);
if (0 < num_backups) {
if (config.backups_found == true) {
output_long(outfile, "td", shared_p->backups);
output_float(outfile, "td",
(float)(100 *
@ -811,7 +812,7 @@ int output_html(void)
output_line(outfile, "th", "ralign", "touch");
output_line(outfile, "th", "ralign", "t+c");
output_line(outfile, "th", "ralign", "t+c perc");
if (0 < num_backups) {
if (config.backups_found == true) {
output_line(outfile, "th", "ralign", "bu");
output_line(outfile, "th", "ralign", "bu perc");
}
@ -834,7 +835,7 @@ int output_html(void)
(shared_networks->touched +
shared_networks->used)) /
shared_networks->available);
if (0 < num_backups) {
if (config.backups_found == true) {
output_long(outfile, "td", shared_networks->backups);
output_float(outfile, "td",
(float)(100 *
@ -889,7 +890,7 @@ int output_csv(void)
fprintf
(outfile,
"\"shared net name\",\"first ip\",\"last ip\",\"max\",\"cur\",\"percent\",\"touch\",\"t+c\",\"t+c perc\"");
if (0 < num_backups) {
if (config.backups_found == true) {
fprintf(outfile, ",\"bu\",\"bu perc\"");
}
fprintf(outfile, "\n");
@ -914,7 +915,7 @@ int output_csv(void)
(float)(100 *
(range_p->touched +
range_p->count)) / range_size);
if (0 < num_backups) {
if (config.backups_found == true) {
fprintf(outfile, ",\"%lu\",\"%.3f\"",
range_p->backups,
(float)(100 * range_p->backups) /
@ -931,7 +932,7 @@ int output_csv(void)
fprintf(outfile, "\"Shared networks:\"\n");
fprintf(outfile,
"\"name\",\"max\",\"cur\",\"percent\",\"touch\",\"t+c\",\"t+c perc\"");
if (0 < num_backups) {
if (config.backups_found == true) {
fprintf(outfile, ",\"bu\",\"bu perc\"");
}
fprintf(outfile, "\n");
@ -951,7 +952,7 @@ int output_csv(void)
(shared_p->touched +
shared_p->used)) /
shared_p->available);
if (0 < num_backups) {
if (config.backups_found == true) {
fprintf(outfile, ",\"%lu\",\"%.3f\"",
shared_p->backups,
(float)(100 * shared_p->backups) /
@ -966,7 +967,7 @@ int output_csv(void)
fprintf(outfile, "\"Sum of all ranges:\"\n");
fprintf(outfile,
"\"name\",\"max\",\"cur\",\"percent\",\"touch\",\"t+c\",\"t+c perc\"");
if (0 < num_backups) {
if (config.backups_found == true) {
fprintf(outfile, ",\"bu\",\"bu perc\"");
}
fprintf(outfile, "\n");
@ -985,7 +986,7 @@ int output_csv(void)
(shared_networks->touched +
shared_networks->used)) /
shared_networks->available);
if (0 < num_backups) {
if (config.backups_found == true) {
fprintf(outfile, "%7lu %8.3f",
shared_networks->backups,
(float)(100 * shared_networks->backups) /