This repository has been archived on 2025-07-20. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
ossp/firewall-rules/readFirewall.c
AKP be3eece61c
Alter 5 files
Add `.clang-format`
Update `checkPacket.c`
Update `parser.c`
Update `readFirewall.c`
Update `types.c`
2023-10-08 19:35:23 +01:00

29 lines
636 B
C

#include "parser.c"
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
if (argc < 2) {
fprintf(stderr, "Usage: %s FILENAME\n", argv[0]);
return 1;
}
size_t num_parsed_rules;
struct Rule **parsed_rules = parse_file(argv[1], &num_parsed_rules);
if (parsed_rules == NULL) {
return 1;
}
qsort(parsed_rules, num_parsed_rules, sizeof(struct Rule *),
&compare_rule_v);
for (int i = 0; i < num_parsed_rules; i += 1) {
struct Rule *r = parsed_rules[i];
print_rule(r);
printf("\n");
free_rule(r);
}
return 0;
}