From 2b4595b861e5258fa466ae80e88718ecb3865f0c Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 18 Apr 2002 18:24:14 +0300 Subject: SHOW VARIABLES LIKE ... are now case insensitive Fixed stack overflow checking with crash-me with gcc 3.0.4 Using @@unknown_variable doesn't hang client anymore Added @@VERSION variable Docs/manual.texi: Changelog libmysql/libmysql.c: Fixed typo myisam/myisampack.c: Removed not used argument mysql-test/r/show_check.result: Added test of case insensitive SHOW VARIABLES LIKE mysql-test/r/variables.result: test of system variables mysql-test/t/show_check.test: Added test of case insensitive SHOW VARIABLES LIKE mysql-test/t/variables.test: test of system variables sql/item_func.cc: Fixed stack overflow checking with crash-me with gcc 3.0.4 Using @@unknown_variable doesn't hang client anymore Added @@VERSION variable sql/mysql_priv.h: Fixed stack overflow checking with crash-me with gcc 3.0.4 sql/share/czech/errmsg.txt: Fixed wrong error message sql/share/danish/errmsg.txt: Fixed wrong error message sql/share/dutch/errmsg.txt: Fixed wrong error message sql/share/english/errmsg.txt: Fixed wrong error message sql/share/estonian/errmsg.txt: Fixed wrong error message sql/share/french/errmsg.txt: Fixed wrong error message sql/share/german/errmsg.txt: Fixed wrong error message sql/share/greek/errmsg.txt: Fixed wrong error message sql/share/hungarian/errmsg.txt: Fixed wrong error message sql/share/italian/errmsg.txt: Fixed wrong error message sql/share/japanese/errmsg.txt: Fixed wrong error message sql/share/korean/errmsg.txt: Fixed wrong error message sql/share/norwegian-ny/errmsg.txt: Fixed wrong error message sql/share/norwegian/errmsg.txt: Fixed wrong error message sql/share/polish/errmsg.txt: Fixed wrong error message sql/share/portuguese/errmsg.txt: Fixed wrong error message sql/share/romanian/errmsg.txt: Fixed wrong error message sql/share/russian/errmsg.txt: Fixed wrong error message sql/share/slovak/errmsg.txt: Fixed wrong error message BitKeeper/deleted/.del-identity.result~e41453a364242503: not used file BitKeeper/deleted/.del-identity.test~326f469b59105404: not used file sql/share/spanish/errmsg.txt: Fixed wrong error message sql/share/swedish/errmsg.txt: Fixed wrong error message sql/share/ukrainian/errmsg.txt: Fixed wrong error message sql/sql_show.cc: SHOW VARIABLES LIKE ... are now case insensitive --- myisam/myisampack.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'myisam/myisampack.c') diff --git a/myisam/myisampack.c b/myisam/myisampack.c index 81ae77738ea..cd18cebbda0 100644 --- a/myisam/myisampack.c +++ b/myisam/myisampack.c @@ -239,7 +239,6 @@ static struct option long_options[] = {"force", no_argument, 0, 'f'}, {"join", required_argument, 0, 'j'}, {"help", no_argument, 0, '?'}, - {"packlength",required_argument, 0, 'p'}, {"silent", no_argument, 0, 's'}, {"tmpdir", required_argument, 0, 'T'}, {"test", no_argument, 0, 't'}, @@ -251,7 +250,7 @@ static struct option long_options[] = static void print_version(void) { - printf("%s Ver 1.12 for %s on %s\n",my_progname,SYSTEM_TYPE,MACHINE_TYPE); + printf("%s Ver 1.13 for %s on %s\n",my_progname,SYSTEM_TYPE,MACHINE_TYPE); } static void usage(void) -- cgit v1.2.1 From 45f976576a6fb08b575822b85ef4ede8ba2e775d Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 24 May 2002 14:06:58 +0300 Subject: Changed ft_dump, ft_eval, ft_test1, mi_test1, myisampack, gen_lex_hash, mysqlmanager from using GNU getopt to use my_getopt. Changed some files that just included old getopt.h to include my_getopt.h now. Fixed a bug in my_print_help() in my_getopt.c. Made better documentation for option -G in mysql client. client/mysql.cc: Documented --named-commands better. myisam/ft_dump.c: Changed getopt to my_getopt. myisam/ft_eval.c: Changed getopt to my_getopt. myisam/ft_test1.c: Changed getopt to my_getopt. myisam/mi_check.c: getopt.h -> my_getopt.h myisam/mi_test1.c: Changed getopt to my_getopt. myisam/myisampack.c: Changed getopt to my_getopt. mysys/my_getopt.c: Fixed a bug when printing help for option that didn't have a description. sql/gen_lex_hash.cc: Changed getopt to my_getopt. tools/mysqlmanager.c: Changed getopt to my_getopt. vio/test-ssl.c: getopt.h -> my_getopt.h vio/test-sslclient.c: getopt.h -> my_getopt.h vio/test-sslserver.c: getopt.h -> my_getopt.h vio/viotest-ssl.c: getopt.h -> my_getopt.h BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- myisam/myisampack.c | 176 ++++++++++++++++++++++++++-------------------------- 1 file changed, 89 insertions(+), 87 deletions(-) (limited to 'myisam/myisampack.c') diff --git a/myisam/myisampack.c b/myisam/myisampack.c index 0fbbbb0bbf1..2cadeaae72a 100644 --- a/myisam/myisampack.c +++ b/myisam/myisampack.c @@ -30,7 +30,7 @@ #ifndef __GNU_LIBRARY__ #define __GNU_LIBRARY__ /* Skip warnings in getopt.h */ #endif -#include +#include #if INT_MAX > 32767 #define BITS_SAVED 32 @@ -169,9 +169,10 @@ static int mrg_rrnd(PACK_MRG_INFO *info,byte *buf); static void mrg_reset(PACK_MRG_INFO *mrg); -static int backup=0,error_on_write=0,test_only=0,verbose=0,silent=0, - write_loop=0,force_pack=0,opt_wait=0,isamchk_neaded=0; +static int error_on_write=0,test_only=0,verbose=0,silent=0, + write_loop=0,force_pack=0, isamchk_neaded=0; static int tmpfile_createflag=O_RDWR | O_TRUNC | O_EXCL; +static my_bool backup, opt_wait; static uint tree_buff_length=8196-MALLOC_OVERHEAD; static char tmp_dir[FN_REFLEN]={0},*join_table; static my_off_t intervall_length; @@ -232,26 +233,43 @@ int main(int argc, char **argv) enum options_mp {OPT_CHARSETS_DIR_MP=256}; -static struct option long_options[] = +static struct my_option my_long_options[] = { - {"backup", no_argument, 0, 'b'}, - {"character-sets-dir",required_argument,0, OPT_CHARSETS_DIR_MP}, - {"debug", optional_argument, 0, '#'}, - {"force", no_argument, 0, 'f'}, - {"join", required_argument, 0, 'j'}, - {"help", no_argument, 0, '?'}, - {"silent", no_argument, 0, 's'}, - {"tmpdir", required_argument, 0, 'T'}, - {"test", no_argument, 0, 't'}, - {"verbose", no_argument, 0, 'v'}, - {"version", no_argument, 0, 'V'}, - {"wait", no_argument, 0, 'w'}, - {0, 0, 0, 0} + {"backup", 'b', "Make a backup of the table as table_name.OLD", + (gptr*) &backup, (gptr*) &backup, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"character-sets-dir", OPT_CHARSETS_DIR_MP, + "Directory where character sets are.", (gptr*) &charsets_dir, + (gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'", + 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, + {"force", 'f', + "Force packing of table even if it gets bigger or if tempfile exists.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"join", 'j', + "Join all given tables into 'new_table_name'. All tables MUST have identical layouts.", + (gptr*) &join_table, (gptr*) &join_table, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, + 0, 0, 0}, + {"help", '?', "Display this help and exit.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"silent", 's', "Be more silent.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"tmpdir", 'T', "Use temporary directory to store temporary table.", + 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"test", 't', "Don't pack table, only test packing it.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"verbose", 'v', "Write info about progress and packing result.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"version", 'V', "Output version information and exit.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"wait", 'w', "Wait and retry if table is in use.", (gptr*) &opt_wait, + (gptr*) &opt_wait, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; + static void print_version(void) { - printf("%s Ver 1.13 for %s on %s\n",my_progname,SYSTEM_TYPE,MACHINE_TYPE); + printf("%s Ver 1.20 for %s on %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE); } static void usage(void) @@ -267,22 +285,54 @@ static void usage(void) puts("You should give the .MSI file as the filename argument."); printf("\nUsage: %s [OPTIONS] filename...\n", my_progname); - puts("\n\ - -b, --backup Make a backup of the table as table_name.OLD\n\ - -f, --force Force packing of table even if it gets bigger or if\n\ - tempfile exists.\n\ - -j, --join='new_table_name'\n\ - Join all given tables into 'new_table_name'.\n\ - All tables MUST have identical layouts.\n\ - -s, --silent Be more silent.\n\ - -t, --test Don't pack table, only test packing it.\n\ - -v, --verbose Write info about progress and packing result.\n\ - -w, --wait Wait and retry if table is in use.\n\ - -T, --tmpdir=... Use temporary directory to store temporary table.\n\ - -#, --debug=... Output debug log. Often this is 'd:t:o,filename`\n\ - -?, --help Display this help and exit.\n\ - -V, --version Output version information and exit."); - print_defaults("my",load_default_groups); + my_print_help(my_long_options); + print_defaults("my", load_default_groups); + my_print_variables(my_long_options); +} + + +static my_bool +get_one_option(int optid, const struct my_option *opt __attribute__((unused)), + char *argument) +{ + uint length; + + switch(optid) { + case 'f': + force_pack= 1; + tmpfile_createflag= O_RDWR | O_TRUNC; + break; + case 's': + write_loop= verbose= 0; + silent= 1; + break; + case 't': + test_only= verbose= 1; + break; + case 'T': + length= (uint) (strmov(tmp_dir, argument) - tmp_dir); + if (length != dirname_length(tmp_dir)) + { + tmp_dir[length]=FN_LIBCHAR; + tmp_dir[length+1]=0; + } + break; + case 'v': + verbose= 1; + silent= 0; + break; + case '#': + DBUG_PUSH(argument ? argument : "d:t:o"); + break; + case 'V': + print_version(); + exit(0); + case 'I': + case '?': + usage(); + exit(0); + } + return 0; } /* reads options */ @@ -290,66 +340,18 @@ static void usage(void) static void get_options(int *argc,char ***argv) { - int c,option_index=0; - uint length; + int ho_error; my_progname= argv[0][0]; if (isatty(fileno(stdout))) write_loop=1; - while ((c=getopt_long(*argc,*argv,"bfj:stvwT:#::?V",long_options, - &option_index)) != EOF) + if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) { - switch(c) { - case 'b': - backup=1; - break; - case 'f': - force_pack=1; - tmpfile_createflag=O_RDWR | O_TRUNC; - break; - case 'j': - join_table=optarg; - break; - case 's': - write_loop=verbose=0; silent=1; - break; - case 't': - test_only=verbose=1; - break; - case 'T': - length=(uint) (strmov(tmp_dir,optarg)-tmp_dir); - if (length != dirname_length(tmp_dir)) - { - tmp_dir[length]=FN_LIBCHAR; - tmp_dir[length+1]=0; - } - break; - case 'v': - verbose=1; silent=0; - break; - case 'w': - opt_wait=1; - break; - case '#': - DBUG_PUSH(optarg ? optarg : "d:t:o"); - break; - case OPT_CHARSETS_DIR_MP: - charsets_dir = optarg; - break; - case 'V': print_version(); exit(0); - case 'I': - case '?': - usage(); - exit(0); - default: - fprintf(stderr,"%s: Illegal option: -%c\n",my_progname,opterr); - usage(); - exit(1); - } + printf("%s: handle_options() failed with error %d\n", my_progname, + ho_error); + exit(1); } - (*argc)-=optind; - (*argv)+=optind; if (!*argc) { usage(); -- cgit v1.2.1 From 4f725190efb6c0523ce3a898043b00d9078db03c Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 29 May 2002 15:07:30 +0300 Subject: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. Changed some exit code names and corresponding numbers. Fixed a bug in mysqld.cc, in replication related options. Added a global flag in my_getopt, which can be set by any program that is using my_getopt, which tells whether the client should print the error message itself, or whether my_getopt should do it. The default is that my_getopt will print the error messages. client/mysql.cc: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. client/mysqladmin.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. client/mysqlbinlog.cc: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. client/mysqlcheck.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. client/mysqldump.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. client/mysqlimport.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. client/mysqlmanager-pwgen.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. client/mysqlmanagerc.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. client/mysqlshow.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. client/mysqltest.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. client/thread_test.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. extra/my_print_defaults.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. extra/mysql_install.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. extra/perror.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. extra/resolve_stack_dump.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. extra/resolveip.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. include/my_getopt.h: Added global (flag) variable which tells my_getopt whether to print errors or just silently exit with proper error code. include/mysys_err.h: Changed exit code names and corresponding numbers. isam/isamchk.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. isam/pack_isam.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. myisam/ft_dump.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. myisam/ft_eval.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. myisam/ft_test1.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. myisam/mi_test1.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. myisam/myisamchk.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. myisam/myisampack.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. mysys/my_getopt.c: Changed exit code names and corresponding numbers. Added a flag for checking whether my_getopt should print the error message, or whether it should be printed by the client itself. sql/gen_lex_hash.cc: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. sql/mysqld.cc: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. Fixed a bug when compiling in non-debug mode, some replication related options were not enabled while they should be. This made 'make test' to fail in rpl000010 when --with-debug was not used. tools/mysqlmanager.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. --- myisam/myisampack.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'myisam/myisampack.c') diff --git a/myisam/myisampack.c b/myisam/myisampack.c index 2cadeaae72a..0064b50348f 100644 --- a/myisam/myisampack.c +++ b/myisam/myisampack.c @@ -269,7 +269,7 @@ static struct my_option my_long_options[] = static void print_version(void) { - printf("%s Ver 1.20 for %s on %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE); + printf("%s Ver 1.21 for %s on %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE); } static void usage(void) @@ -347,11 +347,8 @@ static void get_options(int *argc,char ***argv) write_loop=1; if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) - { - printf("%s: handle_options() failed with error %d\n", my_progname, - ho_error); - exit(1); - } + exit(ho_error); + if (!*argc) { usage(); -- cgit v1.2.1