Commit 89fe8c2396df2d499b4d92db58e6a175387b8e58
1 parent
2bfe3b60
Exists in
master
and in
3 other branches
Fixing action name issue detected on the main application.
Showing
1 changed file
with
34 additions
and
0 deletions
Show diff stats
src/core/actions/actions.c
@@ -40,6 +40,33 @@ struct lib3270_action_callback | @@ -40,6 +40,33 @@ struct lib3270_action_callback | ||
40 | 40 | ||
41 | /*---[ Implement ]------------------------------------------------------------------------------------------------------------*/ | 41 | /*---[ Implement ]------------------------------------------------------------------------------------------------------------*/ |
42 | 42 | ||
43 | +static int compare_alnum(const char *s1, const char *s2) | ||
44 | +{ | ||
45 | + while(*s1 && *s2) { | ||
46 | + | ||
47 | + char c1 = toupper(*s1); | ||
48 | + if(!isalnum(c1)) { | ||
49 | + s1++; | ||
50 | + continue; | ||
51 | + } | ||
52 | + | ||
53 | + char c2 = toupper(*s2); | ||
54 | + if(!isalnum(c2)) { | ||
55 | + s2++; | ||
56 | + continue; | ||
57 | + } | ||
58 | + | ||
59 | + if(c1 != c2) | ||
60 | + return 1; | ||
61 | + | ||
62 | + s1++; | ||
63 | + s2++; | ||
64 | + | ||
65 | + } | ||
66 | + | ||
67 | + return 0; | ||
68 | +} | ||
69 | + | ||
43 | const LIB3270_ACTION * lib3270_action_get_by_name(const char *name) | 70 | const LIB3270_ACTION * lib3270_action_get_by_name(const char *name) |
44 | { | 71 | { |
45 | const LIB3270_ACTION * actions = lib3270_get_actions(); | 72 | const LIB3270_ACTION * actions = lib3270_get_actions(); |
@@ -51,6 +78,13 @@ const LIB3270_ACTION * lib3270_action_get_by_name(const char *name) | @@ -51,6 +78,13 @@ const LIB3270_ACTION * lib3270_action_get_by_name(const char *name) | ||
51 | return actions+f; | 78 | return actions+f; |
52 | } | 79 | } |
53 | 80 | ||
81 | + // Check only alphabetic and numeric (for compatibility) | ||
82 | + for(f=0; actions[f].name; f++) | ||
83 | + { | ||
84 | + if(!compare_alnum(name,actions[f].name)) | ||
85 | + return actions+f; | ||
86 | + } | ||
87 | + | ||
54 | errno = ENOTSUP; | 88 | errno = ENOTSUP; |
55 | return NULL; | 89 | return NULL; |
56 | } | 90 | } |