output: add mustach templating support

Based on José Bollo's mustache C implementation.  This adaptation uses
project specific data structures to avoid overhead with json parsing.

Reference: https://gitlab.com/jobol/mustach.git
Commit: d84608a69033d38c81b8fcff0cb272e225dd5428
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2017-11-09 09:49:26 +00:00
parent fe847bb9b1
commit 7d9a5b5561
No known key found for this signature in database
GPG key ID: A9553245FDE9B739
9 changed files with 741 additions and 6 deletions

View file

@ -60,7 +60,7 @@
#include "dhcpd-pools.h"
/*! \brief Calculate range percentages and such. */
static void range_output_helper(struct output_helper_t *oh, struct range_t *range_p)
void range_output_helper(struct output_helper_t *oh, struct range_t *range_p)
{
/* counts and calculations */
oh->range_size = get_range_size(range_p);
@ -87,7 +87,7 @@ static void range_output_helper(struct output_helper_t *oh, struct range_t *rang
}
/*! \brief Calculate shared network percentages and such. */
static void shnet_output_helper(struct output_helper_t *oh, struct shared_network_t *shared_p)
void shnet_output_helper(struct output_helper_t *oh, struct shared_network_t *shared_p)
{
/* counts and calculations */
oh->tc = shared_p->touched + shared_p->used;
@ -1265,6 +1265,9 @@ int output_analysis(const char c)
case 'c':
ret = output_csv();
break;
case 'm':
ret = mustach_dhcpd_pools();
break;
default:
error(EXIT_FAILURE, 0, "unknown output format: '%c'", c);
}