/*
-** Copyright (C) 2006- Sami Kerola < >
+** Copyright (C) 2006- Sami Kerola <kerolasa@iki.fi>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
};
}
- if ((num_leases > leasesmallocsize) ||
- (num_touches > touchesmallocsize) ||
- (num_backups > backupsmallocsize)) {
+ if ((leasesmallocsize < num_leases) ||
+ (touchesmallocsize < num_touches) ||
+ (backupsmallocsize < num_backups)) {
printf("WARNING: running out of memory\n");
printf("\tlease/touch/backup = %lu/%lu/%lu\n",
leasesmallocsize, touchesmallocsize,
i++;
/* Long word which is almost causing overflow. Not any of words
* this program is looking for are this long. */
- if (i > MAXLEN) {
+ if (MAXLEN < i) {
newclause = false;
i = 0;
continue;
range_p->backups = 0;
range_p->shared_net = shared_p;
num_ranges++;
- if (num_ranges > RANGES) {
+ if (RANGES < num_ranges) {
eprintf
("parse_config: Range space full! Increase RANGES and recompile.");
exit(EXIT_FAILURE);
/* printf ("include file: %s\n", word); */
argument = 0;
next_free_shared_name =
- parse_config(false, word, current_shared_name,
+ parse_config(false, word,
+ current_shared_name,
next_free_shared_name,
shared_p);
newclause = true;
fprintf
(outfile,
"shared net name first ip last ip max cur percent touch t+c t+c perc");
- if (num_backups > 0) {
+ if (0 < num_backups) {
fprintf(outfile, " bu bu perc");
}
fprintf(outfile, "\n");
range_p->count)) /
(range_p->last_ip - range_p->first_ip -
1));
- if (num_backups > 0) {
+ if (0 < num_backups) {
fprintf(outfile, "%7lu %8.3f",
range_p->backups,
(float) (100 * range_p->backups) /
fprintf(outfile, "Shared networks:\n");
fprintf(outfile,
"name max cur percent touch t+c t+c perc");
- if (num_backups > 0) {
+ if (0 < num_backups) {
fprintf(outfile, " bu bu perc");
}
fprintf(outfile, "\n");
(shared_p->touched +
shared_p->used)) /
shared_p->available);
- if (num_backups > 0) {
+ if (0 < num_backups) {
fprintf(outfile, "%7lu %8.3f",
shared_p->backups,
(float) (100 * shared_p->backups) /
fprintf(outfile,
"name max cur percent touch t+c t+c perc");
- if (num_backups > 0) {
+ if (0 < num_backups) {
fprintf(outfile, " bu bu perc");
}
fprintf(outfile, "\n");
shared_networks->used)) /
shared_networks->available);
- if (num_backups > 0) {
+ if (0 < num_backups) {
fprintf(outfile, "%7lu %8.3f",
shared_networks->backups,
(float) (100 * shared_networks->backups) /
output_line(outfile, "th", "ralign", "touch");
output_line(outfile, "th", "ralign", "t+c");
output_line(outfile, "th", "ralign", "t+c perc");
- if (num_backups > 0) {
+ if (0 < num_backups) {
output_line(outfile, "th", "ralign", "bu");
output_line(outfile, "th", "ralign", "bu perc");
}
range_p->count)) /
(range_p->last_ip -
range_p->first_ip - 1));
- if (num_backups > 0) {
+ if (0 < num_backups) {
output_long(outfile, "td",
range_p->backups);
output_float(outfile, "td",
output_line(outfile, "th", "ralign", "touch");
output_line(outfile, "th", "ralign", "t+c");
output_line(outfile, "th", "ralign", "t+c perc");
- if (num_backups > 0) {
+ if (0 < num_backups) {
output_line(outfile, "th", "ralign", "bu");
output_line(outfile, "th", "ralign", "bu perc");
}
(shared_p->touched +
shared_p->used)) /
shared_p->available);
- if (num_backups > 0) {
+ if (0 < num_backups) {
output_long(outfile, "td",
shared_p->backups);
output_float(outfile, "td",
output_line(outfile, "th", "ralign", "touch");
output_line(outfile, "th", "ralign", "t+c");
output_line(outfile, "th", "ralign", "t+c perc");
- if (num_backups > 0) {
+ if (0 < num_backups) {
output_line(outfile, "th", "ralign", "bu");
output_line(outfile, "th", "ralign", "bu perc");
}
(shared_networks->touched +
shared_networks->used)) /
shared_networks->available);
- if (num_backups > 0) {
+ if (0 < num_backups) {
output_long(outfile, "td",
shared_networks->backups);
output_float(outfile, "td",
fprintf
(outfile,
"\"shared net name\",\"first ip\",\"last ip\",\"max\",\"cur\",\"percent\",\"touch\",\"t+c\",\"t+c perc\"");
- if (num_backups > 0) {
+ if (0 < num_backups) {
fprintf(outfile, ",\"bu\",\"bu perc\"");
}
fprintf(outfile, "\n");
range_p->count)) /
(range_p->last_ip - range_p->first_ip -
1));
- if (num_backups > 0) {
+ if (0 < num_backups) {
fprintf(outfile, ",\"%lu\",\"%.3f\"",
range_p->backups,
(float) (100 * range_p->backups) /
fprintf(outfile, "\"Shared networks:\"\n");
fprintf(outfile,
"\"name\",\"max\",\"cur\",\"percent\",\"touch\",\"t+c\",\"t+c perc\"");
- if (num_backups > 0) {
+ if (0 < num_backups) {
fprintf(outfile, ",\"bu\",\"bu perc\"");
}
fprintf(outfile, "\n");
(shared_p->touched +
shared_p->used)) /
shared_p->available);
- if (num_backups > 0) {
+ if (0 < num_backups) {
fprintf(outfile, ",\"%lu\",\"%.3f\"",
shared_p->backups,
(float) (100 * shared_p->backups) /
fprintf(outfile, "\"Sum of all ranges:\"\n");
fprintf(outfile,
"\"name\",\"max\",\"cur\",\"percent\",\"touch\",\"t+c\",\"t+c perc\"");
- if (num_backups > 0) {
+ if (0 < num_backups) {
fprintf(outfile, ",\"bu\",\"bu perc\"");
}
fprintf(outfile, "\n");
(shared_networks->touched +
shared_networks->used)) /
shared_networks->available);
- if (num_backups > 0) {
+ if (0 < num_backups) {
fprintf(outfile, "%7lu %8.3f",
shared_networks->backups,
(float) (100 * shared_networks->backups) /