It is better to use library function to create date-time string than sprintf
various struct tm members. In same go retire time() call that is obsoleted
by clock_gettime().
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
These few lines has been part of code without any point in releases 2.17 to
3.0 and six and half years. Oops.
Reference: ae7747db87
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
In unlikely event of NaN being compared avoid exception. If NaN appears in
input data it will be evaluated as equal with any value.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
src/other.c:387:3: warning: switch missing default case [-Wswitch-default]
The one in do_counting() should be unreachable, so add abort() call to it.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
src/output.c:731:38: warning: implicit conversion from ‘float’ to ‘double’
when passing argument to function [-Wdouble-promotion]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Add error condition checks. Add lease file binding states. Check all
output formats. Check leases file that is in mad order, cse all sorting
methods when checking this. Use json output to check status classfications.
Add cidr range checks. Add conf include and comment parsing input checks.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
When making --skip to take arguments ignored was for moment a work name for
'suppressed' state, and that was accidentally left to usage() output.
Reference: 3369278fc0
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This is a bug. The xstrstr_init initialized wrong IP version functions when
this function was the first to run and set function pointers.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Use iso time stamp in both mustach and html outputs. Effectively this is a
removal of libc langinfo D_T_FMT format, that pulled a lot of gnulib stuff
to project almost unnecessarily.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Base level printing; localstime, number of ranges and shared networks,
project version, and file paths and time stamps.
Also print error and stop template processing when unknown tag is
encountered.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Earlier main() had lots of temporary variables related to command line
parsing. By moving these to separate function runtime can forget these
variables when moving on. If nothing else this makes running gdb nicer when
debugging crashes, but as said stack memory should also be spared for better
purpose.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
src/sort.c:255:5: warning: no previous prototype for 'merge'
src/sort.c:290:2: warning: ISO C90 forbids mixed declarations and code
src/mustach-dhcpd-pools.c:67:5: warning: no previous prototype for 'must_put_err'
src/output.c:109:26: warning: comparing floating point with == or != is unsafe (x5)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Update DataTables and Bootstrap versions. Add free IP counts to table.
Replace yellow as warning with magenta that is easier to read from white
background. Use italic and bold to emphasis warning and critical. Remove
strips. Use ascent percent sort by default.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This way memory is allocated only for items that are in use, and walking
through shared network items is also more straightforward.
As an unfortunate side effect in --perfdata output shared networks are no
longer printed in reverse order. This should be a cosmetic issue.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Following error did not inform clearly what is wrong.
$ ./dhcpd-pools -l samples/dhcpd.leases -c samples/dhcpd.conf -fm
./dhcpd-pools: must_read_template: open: (null): Bad address
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This also fixes backup state counts that were added to shared networks
twice, making the numbers to be much greater than they really where.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Earlier variables magically appeared to scope of functions that took void as
argument. One could figure out perhaps they were globals, but programs that
do that are unnessarily hard to follow.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>