#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#include <err.h>
#include "dhcpd-pools.h"
if (config.output_file[0]) {
outfile = fopen(config.output_file, "w+");
if (outfile == NULL) {
- eprintf("output_txt: %s:", config.output_file);
- exit(EXIT_FAILURE);
+ err(EXIT_FAILURE, "output_txt: %s",
+ config.output_file);
}
} else {
outfile = stdout;
if (outfile == stdout) {
ret = fflush(stdout);
if (ret) {
- eprintf("output_txt: fflush:");
+ warn("output_txt: fflush");
}
} else {
ret = fclose(outfile);
if (ret) {
- eprintf("output_txt: fclose:");
+ warn("output_txt: fclose");
}
}
if (config.output_file[0]) {
outfile = fopen(config.output_file, "w+");
if (outfile == NULL) {
- eprintf("output_xml: %s:", config.output_file);
- exit(EXIT_FAILURE);
+ err(EXIT_FAILURE, "output_xml: %s",
+ config.output_file);
}
} else {
outfile = stdout;
if (outfile == stdout) {
ret = fflush(stdout);
if (ret) {
- eprintf("output_xml: fflush:");
+ warn("output_xml: fflush");
}
} else {
ret = fclose(outfile);
if (ret) {
- eprintf("output_xml: fclose:");
+ warn("output_xml: fclose");
}
}
if (config.output_file[0]) {
outfile = fopen(config.output_file, "w+");
if (outfile == NULL) {
- eprintf("output_html: %s:", config.output_file);
- exit(EXIT_FAILURE);
+ err(EXIT_FAILURE, "output_html: %s",
+ config.output_file);
}
} else {
outfile = stdout;
if (outfile == stdout) {
ret = fflush(stdout);
if (ret) {
- eprintf("output_html: fflush:");
+ warn("output_html: fflush");
}
} else {
ret = fclose(outfile);
if (ret) {
- eprintf("output_html: fclose:");
+ warn("output_html: fclose");
}
}
return 0;
if (config.output_file[0]) {
outfile = fopen(config.output_file, "w+");
if (outfile == NULL) {
- eprintf("output_csv: %s:", config.output_file);
- exit(EXIT_FAILURE);
+ err(EXIT_FAILURE, "output_csv: %s",
+ config.output_file);
}
} else {
outfile = stdout;
if (outfile == stdout) {
ret = fflush(stdout);
if (ret) {
- eprintf("output_cvs: fflush:");
+ warn("output_cvs: fflush");
}
} else {
ret = fclose(outfile);
if (ret) {
- eprintf("output_cvs: fclose:");
+ warn("output_cvs: fclose");
}
}