Debian Codegraph @

src/OVAL/probes/probe/option.c

raw symbols SCIP
1 #ifdef HAVE_CONFIG_H
2 #include <config.h>
3 #endif
4
5 #include <stdarg.h>
6 #include "option.h"
7
8 size_t OSCAP_GSYM(probe_optdef_count) = 0;
9 probe_option_t *OSCAP_GSYM(probe_optdef) = NULL;
10
11 static int __probe_option_op(int option, int op, va_list ap)
12 {
13 probe_option_t* optdef = OSCAP_GSYM(probe_optdef);
14 size_t i, optdef_count = OSCAP_GSYM(probe_optdef_count);
15 int ret = -1;
16
17 for (i = 0; i < optdef_count; ++i) {
18 if (option == optdef[i].option) {
19 ret = optdef[i].handler(option, op, ap);
20 }
21 }
22
23 return ret;
24 }
25
26 int probe_setoption(int option, ...)
27 {
28 int ret;
29 va_list ap;
30 va_start(ap, option);
31 ret = __probe_option_op(option, PROBE_OPTION_SET, ap);
32 va_end(ap);
33 return ret;
34 }
35
36 int probe_getoption(int option, ...)
37 {
38 int ret;
39 va_list ap;
40 va_start(ap, option);
41 ret = __probe_option_op(option, PROBE_OPTION_GET, ap);
42 va_end(ap);
43 return ret;
44 }