MCPcopy Create free account
hub / github.com/F-Stack/f-stack / fill_flags

Function fill_flags

tools/ipfw/ipfw2.c:767–794  ·  view source on GitHub ↗

* helper function to process a set of flags and set bits in the * appropriate masks. */

Source from the content-addressed store, hash-verified

765 * appropriate masks.
766 */
767int
768fill_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
796void
797print_flags_buffer(char *buf, size_t sz, struct _s_x *list, uint32_t set)

Callers 4

table_parse_typeFunction · 0.85
table_createFunction · 0.85
fill_flags_cmdFunction · 0.85
compile_ruleFunction · 0.85

Calls 2

strchrFunction · 0.85
match_tokenFunction · 0.85

Tested by

no test coverage detected