blob: 1d68b78d9c2e3bc7c3c5d1b296c348e90486e70e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
/**** POSIX *******************************************************************/
#include <string.h>
/**** RELABSD *****************************************************************/
#include <relabsd/debug.h>
#include <relabsd/util/string.h>
#include <relabsd/device/axis.h>
/******************************************************************************/
/**** LOCAL FUNCTIONS *********************************************************/
/******************************************************************************/
/******************************************************************************/
/**** EXPORTED FUNCTIONS ******************************************************/
/******************************************************************************/
/*
* Returns -1 if the option was discarded (an error has been reported),
* 0 if the option was successfully parsed.
*/
int relabsd_axis_enable_option_from_name
(
const char option_name [const restrict static 1],
const char axis_name [const restrict static 1],
struct relabsd_axis axis [const restrict static 1]
)
{
if (RELABSD_IS_PREFIX("direct", option_name))
{
axis->flags[RELABSD_DIRECT] = 1;
if (axis->flags[RELABSD_FRAMED])
{
RELABSD_WARNING
(
"Option 'direct' on axis '%s' supersedes its 'framed' option.",
axis_name
);
}
}
else if (RELABSD_IS_PREFIX("real_fuzz", option_name))
{
axis->flags[RELABSD_REAL_FUZZ] = 1;
}
else if (RELABSD_IS_PREFIX("framed", option_name))
{
axis->flags[RELABSD_FRAMED] = 1;
if (axis->flags[RELABSD_DIRECT])
{
RELABSD_WARNING
(
"Option 'direct' on axis '%s' supersedes its 'framed' option.",
axis_name
);
}
}
else
{
RELABSD_ERROR
(
"Unknown option '%s' for axis '%s'.",
option_name,
axis_name
);
return -1;
}
return 0;
}
|