mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-18 08:47:00 +00:00
output: unify time stamp creations
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>
This commit is contained in:
parent
ff3d9523e6
commit
6d737a7607
6 changed files with 36 additions and 67 deletions
21
src/output.c
21
src/output.c
|
|
@ -609,22 +609,6 @@ static int output_json(struct conf_t *state, const int print_mac_addreses)
|
|||
*/
|
||||
static void html_header(struct conf_t *state, FILE *restrict f)
|
||||
{
|
||||
char outstr[200];
|
||||
struct tm *tmp, result;
|
||||
|
||||
struct stat statbuf;
|
||||
|
||||
stat(state->dhcpdlease_file, &statbuf);
|
||||
|
||||
tmp = localtime_r(&statbuf.st_mtime, &result);
|
||||
if (tmp == NULL) {
|
||||
error(EXIT_FAILURE, errno, "html_header: localtime");
|
||||
}
|
||||
setlocale(LC_CTYPE, "");
|
||||
setlocale(LC_NUMERIC, "");
|
||||
if (strftime(outstr, sizeof(outstr), nl_langinfo(D_T_FMT), &result) == 0) {
|
||||
error(EXIT_FAILURE, 0, "html_header: strftime returned 0");
|
||||
}
|
||||
fprintf(f, "<!DOCTYPE html>\n");
|
||||
fprintf(f, "<html>\n");
|
||||
fprintf(f, "<head>\n");
|
||||
|
|
@ -641,8 +625,9 @@ static void html_header(struct conf_t *state, FILE *restrict f)
|
|||
fprintf(f, "<body>\n");
|
||||
fprintf(f, "<div class=\"container\">\n");
|
||||
fprintf(f, "<h2>ISC DHCPD status</h2>\n");
|
||||
fprintf(f, "<small>File %s was last modified at %s</small><hr />\n", state->dhcpdlease_file,
|
||||
outstr);
|
||||
fprintf(f, "<small>File %s was last modified at ", state->dhcpdlease_file);
|
||||
dp_time_tool(f, state->dhcpdlease_file, 0);
|
||||
fprintf(f, "</small><hr />\n");
|
||||
}
|
||||
|
||||
/*! \brief Footer for full html output format.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue