diff options
Diffstat (limited to '')
-rw-r--r-- | libgamepad_get_relative_axis_by_name.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libgamepad_get_relative_axis_by_name.c b/libgamepad_get_relative_axis_by_name.c index f7f2a72..34b9827 100644 --- a/libgamepad_get_relative_axis_by_name.c +++ b/libgamepad_get_relative_axis_by_name.c @@ -11,6 +11,7 @@ libgamepad_get_relative_axis_by_name(const char *name) if (!name || !*name) return -1; if (isdigit(*name)) { + numerical: saved_errno = errno; errno = 0; code = (size_t)strtoul(name, &end, 0); @@ -21,6 +22,12 @@ libgamepad_get_relative_axis_by_name(const char *name) errno = saved_errno; return (int16_t)code; } else { + if (!strncasecmp(name, "REL_#", 5)) { + if (isdigit(name[5])) { + name = &name[5]; + goto numerical; + } + } for (code = 0; code < ELEMSOF(libgamepad_relative_axis_names__); code++) if (!strcasecmp(name, libgamepad_relative_axis_names__[code])) return (int16_t)code; |