* Parse the portmask provided at run time. */
| 592 | * Parse the portmask provided at run time. |
| 593 | */ |
| 594 | static int |
| 595 | parse_portmask(const char *portmask) |
| 596 | { |
| 597 | char *end = NULL; |
| 598 | unsigned long pm; |
| 599 | |
| 600 | errno = 0; |
| 601 | |
| 602 | /* parse hexadecimal string */ |
| 603 | pm = strtoul(portmask, &end, 16); |
| 604 | if ((portmask[0] == '\0') || (end == NULL) || (*end != '\0') || (errno != 0)) |
| 605 | return 0; |
| 606 | |
| 607 | return pm; |
| 608 | |
| 609 | } |
| 610 | |
| 611 | /* |
| 612 | * Parse num options at run time. |
no test coverage detected