diff options
author | David Härdeman <david@hardeman.nu> | 2015-08-15 22:43:32 +0200 |
---|---|---|
committer | David Härdeman <david@hardeman.nu> | 2015-08-15 22:43:32 +0200 |
commit | c420b38a5a4bac32b1086e0359e5f5646880d9f4 (patch) | |
tree | ffcf65dcc3d2e905665f82f57fcc48bccefa4a58 /rcm-server-keymap.c | |
parent | 6d12cb6b9e9d7b67521f6ca999c933e1555a3226 (diff) |
Add basic transmit support (WIP)
Diffstat (limited to 'rcm-server-keymap.c')
-rw-r--r-- | rcm-server-keymap.c | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/rcm-server-keymap.c b/rcm-server-keymap.c index 15b7fe8..56e17f6 100644 --- a/rcm-server-keymap.c +++ b/rcm-server-keymap.c @@ -11,7 +11,6 @@ #include <unistd.h> #include <ctype.h> #include <errno.h> -#include <limits.h> #include "utils.h" #include "shared.h" @@ -37,60 +36,6 @@ struct inis iniss[] = { { .name = NULL, .value = INI_SECTION_UNDEFINED }, }; -static int strtol_strict(const char *str, int *result) -{ - char *end; - long val; - - errno = 0; - val = strtol(str, &end, 10); - - if (errno == ERANGE && (val == LONG_MAX || val == LONG_MIN)) - return -EINVAL; - - if (errno != 0 && val == 0) - return -EINVAL; - - if (end == str) - return -EINVAL; - - if (*end != '\0') - return -EINVAL; - - if (val < 1 || val > UINT16_MAX) - return -EINVAL; - - *result = val; - return 0; -} - -static int strtoull_strict(const char *str, uint64_t *result) -{ - char *end; - unsigned long long val; - - errno = 0; - val = strtoull(str, &end, 16); - - if (errno == ERANGE && (val == ULLONG_MAX || val == 0)) - return -EINVAL; - - if (errno != 0 && val == 0) - return -EINVAL; - - if (end == str) - return -EINVAL; - - if (*end != '\0') - return -EINVAL; - - if (val > UINT64_MAX) - return -EINVAL; - - *result = val; - return 0; -} - static int keymap_parse(FILE *fp, char **line, size_t *buf_size, struct keymap *keymap, uint16_t *rows_return, uint16_t *cols_return, |