diff options
Diffstat (limited to 'src/fseccomp/main.c')
-rw-r--r-- | src/fseccomp/main.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/fseccomp/main.c b/src/fseccomp/main.c new file mode 100644 index 000000000..59d426a78 --- /dev/null +++ b/src/fseccomp/main.c | |||
@@ -0,0 +1,42 @@ | |||
1 | #include "fseccomp.h" | ||
2 | |||
3 | static void usage(void) { | ||
4 | printf("Usage:\n"); | ||
5 | printf("\tfseccomp debug-syscalls\n"); | ||
6 | printf("\tfseccomp debug-errnos\n"); | ||
7 | printf("\tfseccomp debug-protocols\n"); | ||
8 | printf("\tfseccomp protocol build list file\n"); | ||
9 | } | ||
10 | |||
11 | int main(int argc, char **argv) { | ||
12 | //#if 0 | ||
13 | { | ||
14 | //system("cat /proc/self/status"); | ||
15 | int i; | ||
16 | for (i = 0; i < argc; i++) | ||
17 | printf("*%s* ", argv[i]); | ||
18 | printf("\n"); | ||
19 | } | ||
20 | //#endif | ||
21 | if (argc < 2) | ||
22 | return 1; | ||
23 | |||
24 | if (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") ==0) { | ||
25 | usage(); | ||
26 | return 0; | ||
27 | } | ||
28 | else if (argc == 2 && strcmp(argv[1], "debug-syscalls") == 0) | ||
29 | syscall_print(); | ||
30 | else if (argc == 2 && strcmp(argv[1], "debug-errnos") == 0) | ||
31 | errno_print(); | ||
32 | else if (argc == 2 && strcmp(argv[1], "debug-protocols") == 0) | ||
33 | protocol_print(); | ||
34 | else if (argc == 5 && strcmp(argv[1], "protocol") == 0 && strcmp(argv[2], "build") == 0) | ||
35 | protocol_build_filter(argv[3], argv[4]); | ||
36 | else { | ||
37 | fprintf(stderr, "Error fseccomp: invalid arguments\n"); | ||
38 | return 1; | ||
39 | } | ||
40 | |||
41 | return 0; | ||
42 | } \ No newline at end of file | ||