| summaryrefslogtreecommitdiff | 
diff options
| author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2020-01-03 03:50:24 +0100 | 
|---|---|---|
| committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2020-01-03 03:50:24 +0100 | 
| commit | a4841776b6e1751232d46482731836a7c17b896f (patch) | |
| tree | bd818e08f2c145dc1629d0d568feb7106ff274d8 /src/device/axis/axis_option.c | |
| parent | 63016ce5c71019de315434de3e91adbf535d4986 (diff) | |
Still working on it...
Diffstat (limited to 'src/device/axis/axis_option.c')
| -rw-r--r-- | src/device/axis/axis_option.c | 71 | 
1 files changed, 71 insertions, 0 deletions
| diff --git a/src/device/axis/axis_option.c b/src/device/axis/axis_option.c new file mode 100644 index 0000000..fd1cb9c --- /dev/null +++ b/src/device/axis/axis_option.c @@ -0,0 +1,71 @@ +/**** POSIX *******************************************************************/ +#include <string.h> + +/**** RELABSD *****************************************************************/ +#include <relabsd/debug.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 (strcmp(option_name, "direct") == 0) +   { +      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 (strcmp(option_name, "real_fuzz") == 0) +   { +      axis->flags[RELABSD_REAL_FUZZ] = 1; +   } +   else if (strcmp(option_name, "framed") == 0) +   { +      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; +} | 


