diff --git a/THANKS b/THANKS index fb9f030..2c48a08 100644 --- a/THANKS +++ b/THANKS @@ -27,3 +27,4 @@ Cheer Xiao Gilles Bouthenot Helmut Grohne Joey D. +Ryan Steinmetz diff --git a/bootstrap.conf b/bootstrap.conf index d0d2c01..dcb0617 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -27,8 +27,10 @@ gnulib_modules=" fopen free getopt-gnu + inet_pton langinfo netinet_in + progname realloc-gnu stat stddef diff --git a/lib/.gitignore b/lib/.gitignore index 66f0e0d..3ce8e00 100644 --- a/lib/.gitignore +++ b/lib/.gitignore @@ -3,11 +3,13 @@ /.deps/ /.gitignore~ /.libs/ +/arpa/ /Makefile /Makefile.am /Makefile.in /_Exit.c /arg-nonnull.h +/arpa_inet.in.h /atexit.c /c++defs.h /c-ctype.c @@ -55,6 +57,7 @@ /getopt1.c /getopt_int.h /gettext.h +/inet_pton.c /intprops.h /langinfo.h /langinfo.in.h @@ -74,6 +77,8 @@ /msvc-nothrow.h /netinet_in.in.h /pathmax.h +/progname.c +/progname.h /quote.h /quotearg.c /quotearg.h diff --git a/src/dhcpd-pools.c b/src/dhcpd-pools.c index 19b9d15..754f6fc 100644 --- a/src/dhcpd-pools.c +++ b/src/dhcpd-pools.c @@ -51,6 +51,7 @@ #include "closeout.h" #include "defaults.h" #include "dhcpd-pools.h" +#include "progname.h" #include "xalloc.h" /*! \brief Start of execution. Parse options, and call other other @@ -92,6 +93,7 @@ int main(int argc, char **argv) }; atexit(close_stdout); + set_program_name(argv[0]); /* FIXME: These allocations should be fully dynamic, e.g., grow * if needed. */ @@ -199,7 +201,7 @@ int main(int argc, char **argv) default: errx(EXIT_FAILURE, "Try `%s --help' for more information.", - program_invocation_short_name); + program_name); } } diff --git a/src/other.c b/src/other.c index 45229cf..397c697 100644 --- a/src/other.c +++ b/src/other.c @@ -41,9 +41,12 @@ #include "dhcpd-pools.h" #include "defaults.h" +#include "progname.h" +#include #include #include +#include #include #include #include @@ -282,7 +285,7 @@ void __attribute__ ((__noreturn__)) usage(int status) fprintf(out, "\ Usage: %s [OPTIONS]\n\n\ This is ISC dhcpd pools usage analyzer.\n\ -\n", program_invocation_short_name); +\n", program_name); fprintf(out, "\ -c, --config=FILE path to the dhcpd.conf file\n\ -l, --leases=FILE path to the dhcpd.leases file\n"); diff --git a/src/output.c b/src/output.c index d06276f..cb80ba7 100644 --- a/src/output.c +++ b/src/output.c @@ -53,6 +53,7 @@ #include "close-stream.h" #include "dhcpd-pools.h" +#include "progname.h" #include "strftime.h" /*! \brief Text output format, which is the default. @@ -1063,11 +1064,11 @@ int output_alarming(void) if (0 < rc || 0 < sc) { ret_val = 2; fprintf(outfile, "CRITICAL: %s: ", - program_invocation_short_name); + program_name); } else if (0 < rw || 0 < sw) { ret_val = 1; fprintf(outfile, "WARNING: %s: ", - program_invocation_short_name); + program_name); } else { ret_val = 0; fprintf(outfile, "OK: "); diff --git a/src/sort.c b/src/sort.c index b276bc7..5a2a4e1 100644 --- a/src/sort.c +++ b/src/sort.c @@ -47,6 +47,7 @@ #include #include "dhcpd-pools.h" +#include "progname.h" /*! \brief Compare IP address, with IPv4/v6 determination. * \param a Binary IP address. @@ -216,7 +217,7 @@ comparer_t field_selector(char c) default: warnx("field_selector: unknown sort order `%c'", c); errx(EXIT_FAILURE, "Try `%s --help' for more information.", - program_invocation_short_name); + program_name); } return NULL; }