| 472 | } |
| 473 | |
| 474 | static int |
| 475 | parse_portmask(const char *portmask) |
| 476 | { |
| 477 | char *end = NULL; |
| 478 | unsigned long pm; |
| 479 | |
| 480 | /* parse hexadecimal string */ |
| 481 | pm = strtoul(portmask, &end, 16); |
| 482 | if ((portmask[0] == '\0') || (end == NULL) || (*end != '\0')) |
| 483 | return 0; |
| 484 | |
| 485 | return pm; |
| 486 | } |
| 487 | |
| 488 | static int |
| 489 | parse_config(const char *q_arg) |