* helper function to process a set of flags and set bits in the * appropriate masks. */
| 765 | * appropriate masks. |
| 766 | */ |
| 767 | int |
| 768 | fill_flags(struct _s_x *flags, char *p, char **e, uint32_t *set, |
| 769 | uint32_t *clear) |
| 770 | { |
| 771 | char *q; /* points to the separator */ |
| 772 | int val; |
| 773 | uint32_t *which; /* mask we are working on */ |
| 774 | |
| 775 | while (p && *p) { |
| 776 | if (*p == '!') { |
| 777 | p++; |
| 778 | which = clear; |
| 779 | } else |
| 780 | which = set; |
| 781 | q = strchr(p, ','); |
| 782 | if (q) |
| 783 | *q++ = '\0'; |
| 784 | val = match_token(flags, p); |
| 785 | if (val <= 0) { |
| 786 | if (e != NULL) |
| 787 | *e = p; |
| 788 | return (-1); |
| 789 | } |
| 790 | *which |= (uint32_t)val; |
| 791 | p = q; |
| 792 | } |
| 793 | return (0); |
| 794 | } |
| 795 | |
| 796 | void |
| 797 | print_flags_buffer(char *buf, size_t sz, struct _s_x *list, uint32_t set) |
no test coverage detected