statzone

DNS zone file analyzer targeted at TLD zones
Log | Files | Refs | README | LICENSE

commit 3e36e79bedfa30841af70a49c157cc7f8c7f31ad
parent 5af85205cb2b2cd5583e3de0fef4ec87ef70fa30
Author: Frederic Cambus <fred@statdns.com>
Date:   Tue, 30 Mar 2021 21:45:51 +0200

Add a signal handler for SIGINFO, wrapping summary().

Diffstat:
Msrc/statzone.cpp | 12++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/statzone.cpp b/src/statzone.cpp @@ -13,11 +13,11 @@ #include <err.h> #include <getopt.h> #include <inttypes.h> -#include <signal.h> #include <string.h> #include <sys/stat.h> #include <chrono> +#include <csignal> #include <iostream> #include <string> #include <unordered_set> @@ -56,6 +56,14 @@ summary() std::cerr << " seconds." << std::endl; } +#ifdef SIGINFO +void +siginfo_handler(int signum) +{ + summary(); +} +#endif + int main(int argc, char *argv[]) { @@ -90,7 +98,7 @@ main(int argc, char *argv[]) #endif #ifdef SIGINFO - signal(SIGINFO, summary); + signal(SIGINFO, siginfo_handler); #endif while ((opt = getopt(argc, argv, "hv")) != -1) {