Cleaned up mysql.cc a bit.
This commit is contained in:
parent
f40f19301f
commit
acc123282e
@ -495,8 +495,10 @@ static void usage(int version)
|
|||||||
my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
|
my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
|
||||||
if (version)
|
if (version)
|
||||||
return;
|
return;
|
||||||
puts("Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB");
|
printf("\
|
||||||
puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n");
|
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB\n\
|
||||||
|
This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\
|
||||||
|
and you are welcome to modify and redistribute it under the GPL license\n");
|
||||||
printf("Usage: %s [OPTIONS] [database]\n", my_progname);
|
printf("Usage: %s [OPTIONS] [database]\n", my_progname);
|
||||||
printf("\n\
|
printf("\n\
|
||||||
-?, --help Display this help and exit.\n\
|
-?, --help Display this help and exit.\n\
|
||||||
@ -511,7 +513,7 @@ static void usage(int version)
|
|||||||
-C, --compress Use compression in server/client protocol.\n");
|
-C, --compress Use compression in server/client protocol.\n");
|
||||||
#ifndef DBUG_OFF
|
#ifndef DBUG_OFF
|
||||||
printf("\
|
printf("\
|
||||||
-#, --debug[=...] Debug log. Default is '%s'.\n",default_dbug_option);
|
-#, --debug[=...] Debug log. Default is '%s'.\n", default_dbug_option);
|
||||||
#endif
|
#endif
|
||||||
printf("\
|
printf("\
|
||||||
-D, --database=.. Database to use.\n\
|
-D, --database=.. Database to use.\n\
|
||||||
@ -558,14 +560,16 @@ static void usage(int version)
|
|||||||
variable PAGER (%s).\n\
|
variable PAGER (%s).\n\
|
||||||
Valid pagers are less, more, cat [> filename], etc.\n\
|
Valid pagers are less, more, cat [> filename], etc.\n\
|
||||||
See interactive help (\\h) also. This option does\n\
|
See interactive help (\\h) also. This option does\n\
|
||||||
not work in batch mode.\n", getenv("PAGER") ? getenv("PAGER") : "");
|
not work in batch mode.\n",
|
||||||
|
getenv("PAGER") ? getenv("PAGER") : "");
|
||||||
#endif
|
#endif
|
||||||
printf("\
|
printf("\
|
||||||
-p[password], --password[=...]\n\
|
-p[password], --password[=...]\n\
|
||||||
Password to use when connecting to server\n\
|
Password to use when connecting to server\n\
|
||||||
If password is not given it's asked from the tty.\n");
|
If password is not given it's asked from the tty.\n");
|
||||||
#ifdef __WIN__
|
#ifdef __WIN__
|
||||||
puts(" -W, --pipe Use named pipes to connect to server");
|
printf("\
|
||||||
|
-W, --pipe Use named pipes to connect to server");
|
||||||
#endif
|
#endif
|
||||||
printf("\n\
|
printf("\n\
|
||||||
-P, --port=... Port number to use for connection.\n\
|
-P, --port=... Port number to use for connection.\n\
|
||||||
@ -591,6 +595,7 @@ static void usage(int version)
|
|||||||
-v, --verbose Write more. (-v -v -v gives the table output format)\n\
|
-v, --verbose Write more. (-v -v -v gives the table output format)\n\
|
||||||
-V, --version Output version information and exit.\n\
|
-V, --version Output version information and exit.\n\
|
||||||
-w, --wait Wait and retry if connection is down.\n");
|
-w, --wait Wait and retry if connection is down.\n");
|
||||||
|
|
||||||
print_defaults("my",load_default_groups);
|
print_defaults("my",load_default_groups);
|
||||||
|
|
||||||
printf("\nPossible variables for option --set-variable (-O) are:\n");
|
printf("\nPossible variables for option --set-variable (-O) are:\n");
|
||||||
@ -612,15 +617,16 @@ static int get_options(int argc, char **argv)
|
|||||||
long_options, &option_index)) != EOF)
|
long_options, &option_index)) != EOF)
|
||||||
{
|
{
|
||||||
switch(c) {
|
switch(c) {
|
||||||
case OPT_DEFAULT_CHARSET:
|
|
||||||
default_charset= optarg;
|
|
||||||
break;
|
|
||||||
case OPT_CHARSETS_DIR:
|
case OPT_CHARSETS_DIR:
|
||||||
strmov(mysql_charsets_dir, optarg);
|
strmov(mysql_charsets_dir, optarg);
|
||||||
charsets_dir = mysql_charsets_dir;
|
charsets_dir = mysql_charsets_dir;
|
||||||
break;
|
break;
|
||||||
case 'b':
|
case OPT_DEFAULT_CHARSET:
|
||||||
opt_nobeep = 1;
|
default_charset= optarg;
|
||||||
|
break;
|
||||||
|
case OPT_LOCAL_INFILE:
|
||||||
|
using_opt_local_infile=1;
|
||||||
|
opt_local_infile= test(!optarg || atoi(optarg)>0);
|
||||||
break;
|
break;
|
||||||
case OPT_TEE:
|
case OPT_TEE:
|
||||||
if (!opt_outfile && strlen(optarg))
|
if (!opt_outfile && strlen(optarg))
|
||||||
@ -655,6 +661,9 @@ static int get_options(int argc, char **argv)
|
|||||||
case OPT_NOPAGER:
|
case OPT_NOPAGER:
|
||||||
opt_nopager=1;
|
opt_nopager=1;
|
||||||
break;
|
break;
|
||||||
|
case 'b':
|
||||||
|
opt_nobeep = 1;
|
||||||
|
break;
|
||||||
case 'D':
|
case 'D':
|
||||||
my_free(current_db,MYF(MY_ALLOW_ZERO_PTR));
|
my_free(current_db,MYF(MY_ALLOW_ZERO_PTR));
|
||||||
current_db=my_strdup(optarg,MYF(MY_WME));
|
current_db=my_strdup(optarg,MYF(MY_WME));
|
||||||
@ -709,32 +718,27 @@ static int get_options(int argc, char **argv)
|
|||||||
else
|
else
|
||||||
tty_password=1;
|
tty_password=1;
|
||||||
break;
|
break;
|
||||||
case 't':
|
case 't': output_tables=1; break;
|
||||||
output_tables=1;
|
case 'r': opt_raw_data=1; break;
|
||||||
break;
|
|
||||||
case 'r':
|
|
||||||
opt_raw_data=1;
|
|
||||||
break;
|
|
||||||
case '#':
|
|
||||||
DBUG_PUSH(optarg ? optarg : default_dbug_option);
|
|
||||||
info_flag=1;
|
|
||||||
break;
|
|
||||||
case 'q': quick=1; break;
|
case 'q': quick=1; break;
|
||||||
case 's': opt_silent++; break;
|
case 's': opt_silent++; break;
|
||||||
case 'T': info_flag=1; break;
|
case 'T': info_flag=1; break;
|
||||||
case 'n': unbuffered=1; break;
|
case 'n': unbuffered=1; break;
|
||||||
case 'v': verbose++; break;
|
case 'v': verbose++; break;
|
||||||
case 'E': vertical=1; break;
|
case 'E': vertical=1; break;
|
||||||
case 'w':
|
|
||||||
wait_flag=1;
|
|
||||||
if(optarg) wait_time = atoi(optarg) ;
|
|
||||||
break;
|
|
||||||
case 'A': no_rehash=1; break;
|
case 'A': no_rehash=1; break;
|
||||||
case 'G': no_named_cmds=0; break;
|
case 'G': no_named_cmds=0; break;
|
||||||
case 'g': no_named_cmds=1; break;
|
case 'g': no_named_cmds=1; break;
|
||||||
case 'H': opt_html=1; break;
|
case 'H': opt_html=1; break;
|
||||||
case 'X': opt_xml=1; break;
|
case 'X': opt_xml=1; break;
|
||||||
case 'i': connect_flag|= CLIENT_IGNORE_SPACE; break;
|
case 'i': connect_flag|= CLIENT_IGNORE_SPACE; break;
|
||||||
|
case 'C': opt_compress=1; break;
|
||||||
|
case 'L': skip_line_numbers=1; break;
|
||||||
|
case 'N': skip_column_names=1; break;
|
||||||
|
case 'w':
|
||||||
|
wait_flag=1;
|
||||||
|
if(optarg) wait_time = atoi(optarg) ;
|
||||||
|
break;
|
||||||
case 'B':
|
case 'B':
|
||||||
if (!status.batch)
|
if (!status.batch)
|
||||||
{
|
{
|
||||||
@ -743,19 +747,6 @@ static int get_options(int argc, char **argv)
|
|||||||
opt_silent++; // more silent
|
opt_silent++; // more silent
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'C':
|
|
||||||
opt_compress=1;
|
|
||||||
break;
|
|
||||||
case OPT_LOCAL_INFILE:
|
|
||||||
using_opt_local_infile=1;
|
|
||||||
opt_local_infile= test(!optarg || atoi(optarg)>0);
|
|
||||||
break;
|
|
||||||
case 'L':
|
|
||||||
skip_line_numbers=1;
|
|
||||||
break;
|
|
||||||
case 'N':
|
|
||||||
skip_column_names=1;
|
|
||||||
break;
|
|
||||||
case 'P':
|
case 'P':
|
||||||
opt_mysql_port= (unsigned int) atoi(optarg);
|
opt_mysql_port= (unsigned int) atoi(optarg);
|
||||||
break;
|
break;
|
||||||
@ -773,6 +764,10 @@ static int get_options(int argc, char **argv)
|
|||||||
case '?':
|
case '?':
|
||||||
usage(0);
|
usage(0);
|
||||||
exit(0);
|
exit(0);
|
||||||
|
case '#':
|
||||||
|
DBUG_PUSH(optarg ? optarg : default_dbug_option);
|
||||||
|
info_flag=1;
|
||||||
|
break;
|
||||||
#include "sslopt-case.h"
|
#include "sslopt-case.h"
|
||||||
default:
|
default:
|
||||||
tee_fprintf(stderr,"illegal option: -%c\n",opterr);
|
tee_fprintf(stderr,"illegal option: -%c\n",opterr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user