diff --git a/src/core/actions/actions.c b/src/core/actions/actions.c index 56d9fc6..66a4666 100644 --- a/src/core/actions/actions.c +++ b/src/core/actions/actions.c @@ -40,6 +40,33 @@ struct lib3270_action_callback /*---[ Implement ]------------------------------------------------------------------------------------------------------------*/ +static int compare_alnum(const char *s1, const char *s2) +{ + while(*s1 && *s2) { + + char c1 = toupper(*s1); + if(!isalnum(c1)) { + s1++; + continue; + } + + char c2 = toupper(*s2); + if(!isalnum(c2)) { + s2++; + continue; + } + + if(c1 != c2) + return 1; + + s1++; + s2++; + + } + + return 0; +} + const LIB3270_ACTION * lib3270_action_get_by_name(const char *name) { const LIB3270_ACTION * actions = lib3270_get_actions(); @@ -51,6 +78,13 @@ const LIB3270_ACTION * lib3270_action_get_by_name(const char *name) return actions+f; } + // Check only alphabetic and numeric (for compatibility) + for(f=0; actions[f].name; f++) + { + if(!compare_alnum(name,actions[f].name)) + return actions+f; + } + errno = ENOTSUP; return NULL; } -- libgit2 0.21.2