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:
Sami Kerola 2011-01-22 13:06:04 +01:00
parent ee35f8bb1f
commit c11cc921bc
2 changed files with 8 additions and 6 deletions

View file

@ -246,6 +246,7 @@ int main(int argc, char **argv)
shared_net_names + strlen(shared_net_names) + 1,
shared_networks);
/* FIXME: move to output.c and use FILE *outfile */
if ((config.output_format[0] == 'x')
|| (config.output_format[0] == 'X')) {
printf("<dhcpstatus>\n");
@ -271,6 +272,7 @@ int main(int argc, char **argv)
if (errno == 25)
errno = 0;
/* FIXME: move to output.c and use FILE *outfile */
if ((config.output_format[0] == 'x')
|| (config.output_format[0] == 'X')) {
printf("</dhcpstatus>\n");

View file

@ -134,16 +134,16 @@ int parse_leases(void)
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"))) {
nth_field(3, macstring, line);
macstring[strlen(macstring) - 1] = '\0';
if (config.output_format[0] == 'X') {
printf
("<active_lease>\n\t<ip>%s</ip>\n\t<macaddress>%s</macaddress>\n</active_lease>\n",
ipstring, macstring);
};
printf
("<active_lease>\n\t<ip>%s</ip>\n\t<macaddress>%s</macaddress>\n</active_lease>\n",
ipstring, macstring);
}
if ((leasesmallocsize < num_leases) ||