mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-17 08:16:59 +00:00
The xml output is dirty and marked as FIXME
The xml output does not use output file as all other outputs, it has sections here and there while everything is supposed to be in output.c, and finally the unnecessary field analysis loop made program about 20% slower when xml was not asked. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
ee35f8bb1f
commit
c11cc921bc
2 changed files with 8 additions and 6 deletions
|
|
@ -246,6 +246,7 @@ int main(int argc, char **argv)
|
||||||
shared_net_names + strlen(shared_net_names) + 1,
|
shared_net_names + strlen(shared_net_names) + 1,
|
||||||
shared_networks);
|
shared_networks);
|
||||||
|
|
||||||
|
/* FIXME: move to output.c and use FILE *outfile */
|
||||||
if ((config.output_format[0] == 'x')
|
if ((config.output_format[0] == 'x')
|
||||||
|| (config.output_format[0] == 'X')) {
|
|| (config.output_format[0] == 'X')) {
|
||||||
printf("<dhcpstatus>\n");
|
printf("<dhcpstatus>\n");
|
||||||
|
|
@ -271,6 +272,7 @@ int main(int argc, char **argv)
|
||||||
if (errno == 25)
|
if (errno == 25)
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
|
||||||
|
/* FIXME: move to output.c and use FILE *outfile */
|
||||||
if ((config.output_format[0] == 'x')
|
if ((config.output_format[0] == 'x')
|
||||||
|| (config.output_format[0] == 'X')) {
|
|| (config.output_format[0] == 'X')) {
|
||||||
printf("</dhcpstatus>\n");
|
printf("</dhcpstatus>\n");
|
||||||
|
|
|
||||||
|
|
@ -134,16 +134,16 @@ int parse_leases(void)
|
||||||
num_backups++;
|
num_backups++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((sw_active_lease == 1)
|
/* FIXME: move to output.c and use FILE *outfile */
|
||||||
|
if ((config.output_format[0] == 'X')
|
||||||
|
&& (sw_active_lease == 1)
|
||||||
&& (strstr(line, "hardware ethernet"))) {
|
&& (strstr(line, "hardware ethernet"))) {
|
||||||
nth_field(3, macstring, line);
|
nth_field(3, macstring, line);
|
||||||
macstring[strlen(macstring) - 1] = '\0';
|
macstring[strlen(macstring) - 1] = '\0';
|
||||||
|
|
||||||
if (config.output_format[0] == 'X') {
|
|
||||||
printf
|
printf
|
||||||
("<active_lease>\n\t<ip>%s</ip>\n\t<macaddress>%s</macaddress>\n</active_lease>\n",
|
("<active_lease>\n\t<ip>%s</ip>\n\t<macaddress>%s</macaddress>\n</active_lease>\n",
|
||||||
ipstring, macstring);
|
ipstring, macstring);
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((leasesmallocsize < num_leases) ||
|
if ((leasesmallocsize < num_leases) ||
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue