| 372 | } |
| 373 | |
| 374 | static void setformat(char *input) |
| 375 | { |
| 376 | char *formatstr, *category, *modifier; |
| 377 | |
| 378 | formatstr = strdup(input); |
| 379 | while ((category = strsep(&formatstr, ",")) != NULL) { |
| 380 | modifier = strchr(category, ':'); |
| 381 | if (modifier == NULL || modifier[1] == '\0') { |
| 382 | warnx("Skipping invalid format specification: %s\n", |
| 383 | category); |
| 384 | continue; |
| 385 | } |
| 386 | |
| 387 | /* Split the string on the separator, then seek past it */ |
| 388 | modifier[0] = '\0'; |
| 389 | modifier++; |
| 390 | |
| 391 | if (strcmp(category, "addr") == 0) |
| 392 | f_addr = strdup(modifier); |
| 393 | else if (strcmp(category, "ether") == 0) |
| 394 | f_ether = strdup(modifier); |
| 395 | else if (strcmp(category, "inet") == 0) |
| 396 | f_inet = strdup(modifier); |
| 397 | else if (strcmp(category, "inet6") == 0) |
| 398 | f_inet6 = strdup(modifier); |
| 399 | } |
| 400 | free(formatstr); |
| 401 | } |
| 402 | |
| 403 | #undef ORDERS_SIZE |
| 404 | |