diff options
author | unknown <monty@mysql.com> | 2004-05-05 21:24:45 +0300 |
---|---|---|
committer | unknown <monty@mysql.com> | 2004-05-05 21:24:45 +0300 |
commit | e5d43578fdcd87e1f774782ceed811b6f2b0a044 (patch) | |
tree | 3af8fd1bdc7cb6e35635b31747103660afaae663 /mysys | |
parent | b30d0883b1e87df5a476a9e48542321de4384aa4 (diff) | |
parent | 000f76cfb844eeda1c1c0092d4ab97f3f3acb6cb (diff) | |
download | mariadb-git-e5d43578fdcd87e1f774782ceed811b6f2b0a044.tar.gz |
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/my/mysql-4.1
sql/item_strfunc.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_union.cc:
Auto merged
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/mf_soundex.c | 4 | ||||
-rw-r--r-- | mysys/my_getopt.c | 30 |
2 files changed, 22 insertions, 12 deletions
diff --git a/mysys/mf_soundex.c b/mysys/mf_soundex.c index 75d9270c5af..27ab4892c57 100644 --- a/mysys/mf_soundex.c +++ b/mysys/mf_soundex.c @@ -52,7 +52,7 @@ void soundex(CHARSET_INFO * cs,register my_string out_pntr, my_string in_pntr, if (remove_garbage) { - while (*in_pntr && my_isspace(cs,*in_pntr)) /* Skipp pre-space */ + while (*in_pntr && !my_isalpha(cs,*in_pntr)) /* Skipp pre-space */ in_pntr++; } *out_pntr++ = map[(uchar)*in_pntr]; /* Copy first letter */ @@ -98,7 +98,7 @@ static char get_scode(CHARSET_INFO * cs,char **ptr, pbool remove_garbage) ch=my_toupper(cs,**ptr); if (ch < 'A' || ch > 'Z') { - if (my_isalpha(cs,ch)) /* If exetended alfa (country spec) */ + if (my_isalpha(cs,ch)) /* If extended alfa (country spec) */ return '0'; /* threat as vokal */ return 0; /* Can't map */ } diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index 8a1f6db6f8a..efd5789968c 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -342,8 +342,8 @@ int handle_options(int *argc, char ***argv, { if (!optend) /* No argument -> enable option */ *((my_bool*) value)= (my_bool) 1; - else /* If argument differs from 0, enable option, else disable */ - *((my_bool*) value)= (my_bool) atoi(optend) != 0; + else + argument= optend; } } else if (optp->arg_type == REQUIRED_ARG && !optend) @@ -398,18 +398,25 @@ int handle_options(int *argc, char ***argv, /* This is in effect a jump out of the outer loop */ optend= (char*) " "; } - else if (optp->arg_type == REQUIRED_ARG) + else { + if (optp->arg_type == OPT_ARG) + { + if (optp->var_type == GET_BOOL) + *((my_bool*) optp->value)= (my_bool) 1; + get_one_option(optp->id, optp, argument); + continue; + } /* Check if there are more arguments after this one */ - if (!*++pos) + if (!pos[1]) { - if (my_getopt_print_errors) - fprintf(stderr, - "%s: option '-%c' requires an argument\n", - my_progname, optp->id); - return EXIT_ARGUMENT_REQUIRED; + if (my_getopt_print_errors) + fprintf(stderr, + "%s: option '-%c' requires an argument\n", + my_progname, optp->id); + return EXIT_ARGUMENT_REQUIRED; } - argument= *pos; + argument= *++pos; (*argc)--; /* the other loop will break, because *optend + 1 == 0 */ } @@ -525,6 +532,9 @@ static int setval(const struct my_option *opts, gptr *value, char *argument, return EXIT_NO_PTR_TO_VARIABLE; switch ((opts->var_type & GET_TYPE_MASK)) { + case GET_BOOL: /* If argument differs from 0, enable option, else disable */ + *((my_bool*) result_pos)= (my_bool) atoi(argument) != 0; + break; case GET_INT: case GET_UINT: /* fall through */ *((int*) result_pos)= (int) getopt_ll(argument, opts, &err); |