mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-16 07:47:00 +00:00
Do not analyze if sort field selector is rubbish.
Error message also had a bug, it's changed to be over all more helpful. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
10488b0a04
commit
9cc94f1b9f
2 changed files with 8 additions and 4 deletions
|
|
@ -122,6 +122,9 @@ int main(int argc, char **argv)
|
||||||
strncpy(config.sort, optarg,
|
strncpy(config.sort, optarg,
|
||||||
(size_t) sorts);
|
(size_t) sorts);
|
||||||
}
|
}
|
||||||
|
for (i = 0; i < sorts; i++) {
|
||||||
|
field_selector(config.sort[i]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
/* What ever sort in reverse order */
|
/* What ever sort in reverse order */
|
||||||
|
|
@ -181,7 +184,7 @@ int main(int argc, char **argv)
|
||||||
output_analysis = output_csv;
|
output_analysis = output_csv;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
errx(EXIT_FAILURE, "main: unknown ouput format `%c'",
|
errx(EXIT_FAILURE, "main: unknown output format `%c'",
|
||||||
config.output_format[0]);
|
config.output_format[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
|
|
||||||
#include "dhcpd-pools.h"
|
#include "dhcpd-pools.h"
|
||||||
|
|
@ -117,9 +118,9 @@ void field_selector(char c)
|
||||||
returner = ret_tcperc;
|
returner = ret_tcperc;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
errx(EXIT_FAILURE,
|
warnx("field_selector: unknown sort order `%c'", c);
|
||||||
"field_selector: unknown sort order `%c'",
|
errx(EXIT_FAILURE, "Try `%s --help' for more information.",
|
||||||
config.sort[0]);
|
program_invocation_short_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue