mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-16 07:47:00 +00:00
main: simplify option parsing
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
a192f51545
commit
b568725e7d
1 changed files with 3 additions and 3 deletions
|
|
@ -198,11 +198,11 @@ static char parse_command_line_opts(struct conf_t *state, int argc, char **argv)
|
|||
{
|
||||
/* Output sorting option */
|
||||
struct output_sort *p = state->sorts;
|
||||
size_t len;
|
||||
char *ptr = optarg;
|
||||
|
||||
while (p && p->next)
|
||||
p = p->next;
|
||||
for (len = 0; len < strlen(optarg); len++) {
|
||||
while (*ptr) {
|
||||
if (state->sorts == NULL) {
|
||||
state->sorts =
|
||||
xcalloc(1, sizeof(struct output_sort));
|
||||
|
|
@ -211,7 +211,7 @@ static char parse_command_line_opts(struct conf_t *state, int argc, char **argv)
|
|||
p->next = xcalloc(1, sizeof(struct output_sort));
|
||||
p = p->next;
|
||||
}
|
||||
p->func = field_selector(optarg[len]);
|
||||
p->func = field_selector(*ptr++);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue