1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

- Added new type GET_STRALC to my_getopt.

- Fixed some bugs, wrongly freed pointers, in some clients.
- Removed unneccessary code.
- Fixed some other minor bugs and added some options into
  variables category, which had accidently been left out earlier.


client/mysql.cc:
  Fixed some wrong freed pointers. Removed unneccessary code.
  Changed some types from GET_STR to GET_STRALC.
client/mysqladmin.c:
  Fixed some wrong freed pointers. Removed unneccessary code.
  Changed some types from GET_STR to GET_STRALC.
client/mysqlcheck.c:
  Fixed some wrong freed pointers. Removed unneccessary code.
  Changed some types from GET_STR to GET_STRALC.
client/mysqldump.c:
  Fixed some wrong freed pointers. Removed unneccessary code.
  Changed some types from GET_STR to GET_STRALC.
client/mysqlimport.c:
  Removed unneccessary code.
  Fixed a bug in option --ignore-lines
client/mysqlshow.c:
  Removed unneccessary code.
include/my_getopt.h:
  Added new type, GET_STRALC. The name stands for GET STRING ALLOC,
  which means that the struct member value and u_max_value are
  strings that must be alloced and freed when used.
  The normal GET_STR works similarly otherwise, except that it's
  arguments are just pointers to strings, not alloced ones.
mysys/my_getopt.c:
  Added support for GET_STRALC
This commit is contained in:
unknown
2002-05-14 21:41:55 +03:00
parent f20dda3ea9
commit 21c1e5be44
8 changed files with 44 additions and 206 deletions

View File

@ -16,7 +16,7 @@
/* By Jani Tolonen, 2001-04-20, MySQL Development Team */
#define CHECK_VERSION "2.1"
#define CHECK_VERSION "2.2"
#include "client_priv.h"
#include <my_getopt.h>
@ -94,7 +94,7 @@ static struct my_option my_long_options[] =
{"help", '?', "Display this help message and exit.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"host",'h', "Connect to host.", (gptr*) &current_host,
(gptr*) &current_host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
(gptr*) &current_host, 0, GET_STRALC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"medium-check", 'm',
"Faster than extended-check, but only finds 99.99 percent of all errors. Should be good enough for most cases.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@ -199,12 +199,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case 'a':
what_to_do = DO_ANALYZE;
break;
case OPT_DEFAULT_CHARSET:
default_charset = argument;
break;
case OPT_CHARSETS_DIR:
charsets_dir = argument;
break;
case 'c':
what_to_do = DO_CHECK;
break;
@ -216,10 +210,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case '?':
usage();
exit(0);
case 'h':
my_free(current_host, MYF(MY_ALLOW_ZERO_PTR));
current_host = my_strdup(argument, MYF(MY_WME));
break;
case 'm':
what_to_do = DO_CHECK;
opt_medium_check = 1;
@ -227,11 +217,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case 'o':
what_to_do = DO_OPTIMIZE;
break;
#ifndef DONT_ALLOW_USER_CHANGE
case 'u':
current_user = argument;
break;
#endif
case 'p':
if (argument)
{
@ -245,15 +230,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
else
tty_password = 1;
break;
case 'P':
opt_mysql_port = (unsigned int) atoi(argument);
break;
case 'r':
what_to_do = DO_REPAIR;
break;
case 'S':
opt_mysql_unix_port = argument;
break;
case 'W':
#ifdef __WIN__
opt_mysql_unix_port = MYSQL_NAMEDPIPE;