| 238 | } |
| 239 | |
| 240 | static int |
| 241 | parse_rules(char *string, struct rulehead *head) |
| 242 | { |
| 243 | struct rule *new; |
| 244 | char *element; |
| 245 | int error; |
| 246 | |
| 247 | error = 0; |
| 248 | while ((element = strsep(&string, ",")) != NULL) { |
| 249 | if (strlen(element) == 0) |
| 250 | continue; |
| 251 | error = parse_rule_element(element, &new); |
| 252 | if (error) |
| 253 | goto out; |
| 254 | TAILQ_INSERT_TAIL(head, new, r_entries); |
| 255 | } |
| 256 | out: |
| 257 | if (error != 0) |
| 258 | toast_rules(head); |
| 259 | return (error); |
| 260 | } |
| 261 | |
| 262 | /* |
| 263 | * rule_printf() and rules_to_string() are unused currently because they rely |
no test coverage detected