diff options
author | Georgi Kodinov <Georgi.Kodinov@Oracle.com> | 2010-08-03 19:21:13 +0300 |
---|---|---|
committer | Georgi Kodinov <Georgi.Kodinov@Oracle.com> | 2010-08-03 19:21:13 +0300 |
commit | 711b6618c439e89dc70688959721562708a6ee83 (patch) | |
tree | 509aba1afc507247d8e5f7b2bf9ab57088e98d1f /mysys/my_getopt.c | |
parent | 1292851b0d150c6729a6174e4a12a3aba6401f32 (diff) | |
parent | 534e69338a449ce258426264b14f0ce3b658e5aa (diff) | |
download | mariadb-git-711b6618c439e89dc70688959721562708a6ee83.tar.gz |
merge
Diffstat (limited to 'mysys/my_getopt.c')
-rw-r--r-- | mysys/my_getopt.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index e4b199dab84..e9fa6f6bee2 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -603,18 +603,24 @@ static int setval(const struct my_option *opts, void *value, char *argument, }; break; case GET_ENUM: - if (((*(uint*)value)= - find_type(argument, opts->typelib, 2) - 1) == (uint)-1) { - /* Accept an integer representation of the enumerated item */ - char *endptr; - uint arg= (uint) strtol(argument, &endptr, 10); - if (*endptr || arg >= opts->typelib->count) + int type= find_type(argument, opts->typelib, 2); + if (type == 0) { - res= EXIT_ARGUMENT_INVALID; - goto ret; - }; - *(uint*)value= arg; + /* + Accept an integer representation of the enumerated item. + */ + char *endptr; + uint arg= (uint) strtoul(argument, &endptr, 10); + if (*endptr || arg >= opts->typelib->count) + { + res= EXIT_ARGUMENT_INVALID; + goto ret; + } + *(uint*)value= arg; + } + else + *(uint*)value= type - 1; } break; case GET_SET: |