From cef03de0a99906215ac4a7a4eca9879b418d748d Mon Sep 17 00:00:00 2001
From: Sami Kerola
Date: Fri, 8 Jul 2011 22:33:13 +0200
Subject: [PATCH] output: change to full html behaviour
The full html will now print the mtime of dhcpd.leases file in
header. Additionally at the footer of the page the dhcpd-pools
will have package name and version number.
Signed-off-by: Sami Kerola
---
src/output.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/src/output.c b/src/output.c
index 6350ae1..a422b75 100644
--- a/src/output.c
+++ b/src/output.c
@@ -37,9 +37,12 @@
#include
#include
+#include
#include
#include
#include
+#include
+#include
#define _FILE_OFFSET_BITS 64
#include
@@ -312,6 +315,20 @@ int output_xml(void)
void html_header(FILE * f)
{
+ char outstr[200];
+ struct tm *tmp;
+
+ struct stat statbuf;
+ stat(config.dhcpdlease_file, &statbuf);
+
+ tmp = localtime(&statbuf.st_mtime);
+ if (tmp == NULL) {
+ err(EXIT_FAILURE, "html_header: localtime");
+ }
+ if (strftime(outstr, sizeof(outstr), nl_langinfo(D_T_FMT), tmp) == 0) {
+ errx(EXIT_FAILURE, "html_header: strftime returned 0");
+ }
+
fprintf(f, "\n");
fprintf(f, "\n");
@@ -367,6 +384,7 @@ void html_header(FILE * f)
fprintf(f, " \n");
fprintf(f, "\n");
fprintf(f, "\n");
+ fprintf(f, "The lease file mtime: %s", outstr);
}
void html_footer(FILE * f)
@@ -375,7 +393,7 @@ void html_footer(FILE * f)
fprintf(f, "
\n");
fprintf(f, "\nData generated by ");
fprintf(f, "", PACKAGE_URL);
- fprintf(f, "%s.\n
\n", PACKAGE_NAME);
+ fprintf(f, "%s.\n
\n", PACKAGE_STRING);
fprintf(f, "\n");
fprintf(f, "