Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
52a973c5
Commit
52a973c5
authored
Aug 25, 2004
by
rburnett@build.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-4.0
into build.mysql.com:/users/rburnett/mysql-4.0
parents
852181a2
a7c4e100
Changes
32
Hide whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
347 additions
and
81 deletions
+347
-81
BitKeeper/etc/logging_ok
BitKeeper/etc/logging_ok
+1
-0
VC++Files/sql/mysqld.dsp
VC++Files/sql/mysqld.dsp
+83
-0
client/mysql.cc
client/mysql.cc
+1
-1
client/mysqladmin.c
client/mysqladmin.c
+1
-1
client/mysqlbinlog.cc
client/mysqlbinlog.cc
+1
-1
client/mysqlcheck.c
client/mysqlcheck.c
+1
-1
client/mysqldump.c
client/mysqldump.c
+1
-1
client/mysqlimport.c
client/mysqlimport.c
+1
-1
client/mysqlmanager-pwgen.c
client/mysqlmanager-pwgen.c
+1
-1
client/mysqlmanagerc.c
client/mysqlmanagerc.c
+1
-1
client/mysqlshow.c
client/mysqlshow.c
+1
-1
client/mysqltest.c
client/mysqltest.c
+1
-1
extra/my_print_defaults.c
extra/my_print_defaults.c
+1
-1
extra/mysql_install.c
extra/mysql_install.c
+1
-1
extra/mysql_waitpid.c
extra/mysql_waitpid.c
+1
-1
extra/perror.c
extra/perror.c
+1
-1
extra/resolve_stack_dump.c
extra/resolve_stack_dump.c
+1
-1
extra/resolveip.c
extra/resolveip.c
+1
-1
include/my_getopt.h
include/my_getopt.h
+12
-4
include/my_sys.h
include/my_sys.h
+6
-0
isam/isamchk.c
isam/isamchk.c
+1
-1
isam/pack_isam.c
isam/pack_isam.c
+1
-1
myisam/mi_test1.c
myisam/mi_test1.c
+1
-1
myisam/myisam_ftdump.c
myisam/myisam_ftdump.c
+1
-1
myisam/myisamchk.c
myisam/myisamchk.c
+1
-1
myisam/myisampack.c
myisam/myisampack.c
+1
-1
mysys/my_getopt.c
mysys/my_getopt.c
+29
-29
sql/gen_lex_hash.cc
sql/gen_lex_hash.cc
+1
-1
sql/log.cc
sql/log.cc
+174
-21
sql/mysql_priv.h
sql/mysql_priv.h
+9
-2
sql/mysqld.cc
sql/mysqld.cc
+9
-1
tools/mysqlmanager.c
tools/mysqlmanager.c
+1
-1
No files found.
BitKeeper/etc/logging_ok
View file @
52a973c5
...
...
@@ -110,6 +110,7 @@ ram@gw.mysql.r18.ru
ram@mysql.r18.ru
ram@ram.(none)
ranger@regul.home.lan
rburnett@build.mysql.com
root@x3.internalnet
salle@geopard.(none)
salle@geopard.online.bg
...
...
VC++Files/sql/mysqld.dsp
View file @
52a973c5
...
...
@@ -900,6 +900,89 @@ SOURCE=.\log_event.cpp
# End Source File
# Begin Source File
SOURCE=.\message.mc
!IF "$(CFG)" == "mysqld - Win32 Release"
!ELSEIF "$(CFG)" == "mysqld - Win32 Debug"
!ELSEIF "$(CFG)" == "mysqld - Win32 nt"
# Begin Custom Build - Compiling messages
InputDir=.
InputPath=.\message.mc
InputName=message
BuildCmds= \
mc.exe "$(InputDir)\$(InputName).mc"
"$(InputDir)\$(InputName).rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\$(InputName).h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "mysqld - Win32 Max nt"
# Begin Custom Build - Compiling messages
InputDir=.
InputPath=.\message.mc
InputName=message
BuildCmds= \
mc.exe "$(InputDir)\$(InputName).mc"
"$(InputDir)\$(InputName).rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\$(InputName).h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "mysqld - Win32 Max"
!ELSEIF "$(CFG)" == "mysqld - Win32 classic"
!ELSEIF "$(CFG)" == "mysqld - Win32 pro"
!ELSEIF "$(CFG)" == "mysqld - Win32 classic nt"
# Begin Custom Build - Compiling messages
InputDir=.
InputPath=.\message.mc
InputName=message
BuildCmds= \
mc.exe "$(InputDir)\$(InputName).mc"
"$(InputDir)\$(InputName).rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\$(InputName).h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "mysqld - Win32 pro nt"
# Begin Custom Build - Compiling messages
InputDir=.
InputPath=.\message.mc
InputName=message
BuildCmds= \
mc.exe "$(InputDir)\$(InputName).mc"
"$(InputDir)\$(InputName).rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\$(InputName).h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\message.rc
# End Source File
# Begin Source File
SOURCE=.\mf_iocache.cpp
!IF "$(CFG)" == "mysqld - Win32 Release"
...
...
client/mysql.cc
View file @
52a973c5
...
...
@@ -759,7 +759,7 @@ static int get_options(int argc, char **argv)
opt_max_allowed_packet
=
*
mysql_params
->
p_max_allowed_packet
;
opt_net_buffer_length
=
*
mysql_params
->
p_net_buffer_length
;
if
((
ho_error
=
handle_options
(
&
argc
,
&
argv
,
my_long_options
,
get_one_option
)))
if
((
ho_error
=
handle_options
(
&
argc
,
&
argv
,
my_long_options
,
get_one_option
,
0
)))
exit
(
ho_error
);
*
mysql_params
->
p_max_allowed_packet
=
opt_max_allowed_packet
;
...
...
client/mysqladmin.c
View file @
52a973c5
...
...
@@ -254,7 +254,7 @@ int main(int argc,char *argv[])
mysql_init
(
&
mysql
);
load_defaults
(
"my"
,
load_default_groups
,
&
argc
,
&
argv
);
save_argv
=
argv
;
/* Save for free_defaults */
if
((
ho_error
=
handle_options
(
&
argc
,
&
argv
,
my_long_options
,
get_one_option
)))
if
((
ho_error
=
handle_options
(
&
argc
,
&
argv
,
my_long_options
,
get_one_option
,
0
)))
{
free_defaults
(
save_argv
);
exit
(
ho_error
);
...
...
client/mysqlbinlog.cc
View file @
52a973c5
...
...
@@ -559,7 +559,7 @@ static int parse_args(int *argc, char*** argv)
result_file
=
stdout
;
load_defaults
(
"my"
,
load_default_groups
,
argc
,
argv
);
if
((
ho_error
=
handle_options
(
argc
,
argv
,
my_long_options
,
get_one_option
)))
if
((
ho_error
=
handle_options
(
argc
,
argv
,
my_long_options
,
get_one_option
,
NULL
)))
exit
(
ho_error
);
return
0
;
...
...
client/mysqlcheck.c
View file @
52a973c5
...
...
@@ -273,7 +273,7 @@ static int get_options(int *argc, char ***argv)
load_defaults
(
"my"
,
load_default_groups
,
argc
,
argv
);
if
((
ho_error
=
handle_options
(
argc
,
argv
,
my_long_options
,
get_one_option
)))
if
((
ho_error
=
handle_options
(
argc
,
argv
,
my_long_options
,
get_one_option
,
0
)))
exit
(
ho_error
);
if
(
!
what_to_do
)
...
...
client/mysqldump.c
View file @
52a973c5
...
...
@@ -413,7 +413,7 @@ static int get_options(int *argc, char ***argv)
md_result_file
=
stdout
;
load_defaults
(
"my"
,
load_default_groups
,
argc
,
argv
);
if
((
ho_error
=
handle_options
(
argc
,
argv
,
my_long_options
,
get_one_option
)))
if
((
ho_error
=
handle_options
(
argc
,
argv
,
my_long_options
,
get_one_option
,
0
)))
exit
(
ho_error
);
*
mysql_params
->
p_max_allowed_packet
=
opt_max_allowed_packet
;
...
...
client/mysqlimport.c
View file @
52a973c5
...
...
@@ -206,7 +206,7 @@ static int get_options(int *argc, char ***argv)
{
int
ho_error
;
if
((
ho_error
=
handle_options
(
argc
,
argv
,
my_long_options
,
get_one_option
)))
if
((
ho_error
=
handle_options
(
argc
,
argv
,
my_long_options
,
get_one_option
,
0
)))
exit
(
ho_error
);
if
(
enclosed
&&
opt_enclosed
)
...
...
client/mysqlmanager-pwgen.c
View file @
52a973c5
...
...
@@ -95,7 +95,7 @@ int parse_args(int argc, char** argv)
{
int
ho_error
;
if
((
ho_error
=
handle_options
(
&
argc
,
&
argv
,
my_long_options
,
get_one_option
)))
if
((
ho_error
=
handle_options
(
&
argc
,
&
argv
,
my_long_options
,
get_one_option
,
NULL
)))
exit
(
ho_error
);
return
0
;
...
...
client/mysqlmanagerc.c
View file @
52a973c5
...
...
@@ -133,7 +133,7 @@ int parse_args(int argc, char **argv)
load_defaults
(
"my"
,
load_default_groups
,
&
argc
,
&
argv
);
default_argv
=
argv
;
if
((
ho_error
=
handle_options
(
&
argc
,
&
argv
,
my_long_options
,
get_one_option
)))
if
((
ho_error
=
handle_options
(
&
argc
,
&
argv
,
my_long_options
,
get_one_option
,
NULL
)))
exit
(
ho_error
);
return
0
;
...
...
client/mysqlshow.c
View file @
52a973c5
...
...
@@ -261,7 +261,7 @@ get_options(int *argc,char ***argv)
{
int
ho_error
;
if
((
ho_error
=
handle_options
(
argc
,
argv
,
my_long_options
,
get_one_option
)))
if
((
ho_error
=
handle_options
(
argc
,
argv
,
my_long_options
,
get_one_option
,
0
)))
exit
(
ho_error
);
if
(
tty_password
)
...
...
client/mysqltest.c
View file @
52a973c5
...
...
@@ -2062,7 +2062,7 @@ int parse_args(int argc, char **argv)
load_defaults
(
"my"
,
load_default_groups
,
&
argc
,
&
argv
);
default_argv
=
argv
;
if
((
handle_options
(
&
argc
,
&
argv
,
my_long_options
,
get_one_option
)))
if
((
handle_options
(
&
argc
,
&
argv
,
my_long_options
,
get_one_option
,
0
)))
exit
(
1
);
if
(
argc
>
1
)
...
...
extra/my_print_defaults.c
View file @
52a973c5
...
...
@@ -100,7 +100,7 @@ static int get_options(int *argc,char ***argv)
{
int
ho_error
;
if
((
ho_error
=
handle_options
(
argc
,
argv
,
my_long_options
,
get_one_option
)))
if
((
ho_error
=
handle_options
(
argc
,
argv
,
my_long_options
,
get_one_option
,
NULL
)))
exit
(
ho_error
);
if
(
*
argc
<
1
)
...
...
extra/mysql_install.c
View file @
52a973c5
...
...
@@ -218,7 +218,7 @@ static int parse_args(int argc, char **argv)
{
int
ho_error
;
if
((
ho_error
=
handle_options
(
&
argc
,
&
argv
,
my_long_options
,
get_one_option
)))
if
((
ho_error
=
handle_options
(
&
argc
,
&
argv
,
my_long_options
,
get_one_option
,
NULL
)))
exit
(
ho_error
);
return
0
;
...
...
extra/mysql_waitpid.c
View file @
52a973c5
...
...
@@ -66,7 +66,7 @@ int main(int argc, char *argv[])
progname
=
argv
[
0
];
if
(
handle_options
(
&
argc
,
&
argv
,
my_long_options
,
get_one_option
))
if
(
handle_options
(
&
argc
,
&
argv
,
my_long_options
,
get_one_option
,
NULL
))
exit
(
-
1
);
if
(
!
argv
[
0
]
||
!
argv
[
1
]
||
(
pid
=
atoi
(
argv
[
0
]))
<=
0
||
(
t
=
atoi
(
argv
[
1
]))
<=
0
)
...
...
extra/perror.c
View file @
52a973c5
...
...
@@ -145,7 +145,7 @@ static int get_options(int *argc,char ***argv)
{
int
ho_error
;
if
((
ho_error
=
handle_options
(
argc
,
argv
,
my_long_options
,
get_one_option
)))
if
((
ho_error
=
handle_options
(
argc
,
argv
,
my_long_options
,
get_one_option
,
NULL
)))
exit
(
ho_error
);
if
(
!*
argc
&&
!
print_all_codes
)
...
...
extra/resolve_stack_dump.c
View file @
52a973c5
...
...
@@ -121,7 +121,7 @@ static int parse_args(int argc, char **argv)
{
int
ho_error
;
if
((
ho_error
=
handle_options
(
&
argc
,
&
argv
,
my_long_options
,
get_one_option
)))
if
((
ho_error
=
handle_options
(
&
argc
,
&
argv
,
my_long_options
,
get_one_option
,
NULL
)))
exit
(
ho_error
);
/*
...
...
extra/resolveip.c
View file @
52a973c5
...
...
@@ -90,7 +90,7 @@ static int get_options(int *argc,char ***argv)
{
int
ho_error
;
if
((
ho_error
=
handle_options
(
argc
,
argv
,
my_long_options
,
get_one_option
)))
if
((
ho_error
=
handle_options
(
argc
,
argv
,
my_long_options
,
get_one_option
,
NULL
)))
exit
(
ho_error
);
if
(
*
argc
==
0
)
...
...
include/my_getopt.h
View file @
52a973c5
...
...
@@ -14,6 +14,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _my_getopt_h
#define _my_getopt_h
C_MODE_START
#define GET_NO_ARG 1
...
...
@@ -50,14 +53,19 @@ struct my_option
extern
char
*
disabled_my_option
;
extern
my_bool
my_getopt_print_errors
;
typedef
my_bool
(
*
my_get_one_option
)
(
int
,
const
struct
my_option
*
,
char
*
);
typedef
void
(
*
my_error_reporter
)
(
enum
loglevel
level
,
const
char
*
format
,
...
);
extern
int
handle_options
(
int
*
argc
,
char
***
argv
,
const
struct
my_option
*
longopts
,
my_bool
(
*
get_one_option
)(
int
,
const
struct
my_option
*
,
char
*
));
const
struct
my_option
*
longopts
,
my_get_one_option
,
my_error_reporter
);
extern
void
my_print_help
(
const
struct
my_option
*
options
);
extern
void
my_print_variables
(
const
struct
my_option
*
options
);
ulonglong
getopt_ull_limit_value
(
ulonglong
num
,
const
struct
my_option
*
optp
);
my_bool
getopt_compare_strings
(
const
char
*
s
,
const
char
*
t
,
uint
length
);
C_MODE_END
#endif
/* _my_getopt_h */
include/my_sys.h
View file @
52a973c5
...
...
@@ -261,6 +261,12 @@ typedef struct st_typelib { /* Different types saved here */
const
char
**
type_names
;
}
TYPELIB
;
enum
loglevel
{
ERROR_LEVEL
,
WARNING_LEVEL
,
INFORMATION_LEVEL
};
enum
cache_type
{
READ_CACHE
,
WRITE_CACHE
,
...
...
isam/isamchk.c
View file @
52a973c5
...
...
@@ -670,7 +670,7 @@ static void get_options(register int *argc, register char ***argv)
if
(
isatty
(
fileno
(
stdout
)))
testflag
|=
T_WRITE_LOOP
;
if
((
ho_error
=
handle_options
(
argc
,
argv
,
my_long_options
,
get_one_option
)))
if
((
ho_error
=
handle_options
(
argc
,
argv
,
my_long_options
,
get_one_option
,
NULL
)))
exit
(
ho_error
);
if
(
*
argc
==
0
)
...
...
isam/pack_isam.c
View file @
52a973c5
...
...
@@ -353,7 +353,7 @@ static void get_options(int *argc, char ***argv)
{
int
ho_error
;
if
((
ho_error
=
handle_options
(
argc
,
argv
,
my_long_options
,
get_one_option
)))
if
((
ho_error
=
handle_options
(
argc
,
argv
,
my_long_options
,
get_one_option
,
NULL
)))
exit
(
ho_error
);
my_progname
=
argv
[
0
][
0
];
...
...
myisam/mi_test1.c
View file @
52a973c5
...
...
@@ -643,7 +643,7 @@ static void get_options(int argc, char *argv[])
{
int
ho_error
;
if
((
ho_error
=
handle_options
(
&
argc
,
&
argv
,
my_long_options
,
get_one_option
)))
if
((
ho_error
=
handle_options
(
&
argc
,
&
argv
,
my_long_options
,
get_one_option
,
NULL
)))
exit
(
ho_error
);
return
;
...
...
myisam/myisam_ftdump.c
View file @
52a973c5
...
...
@@ -66,7 +66,7 @@ int main(int argc,char *argv[])
struct
{
MI_INFO
*
info
;
}
aio0
,
*
aio
=&
aio0
;
/* for GWS_IN_USE */
MY_INIT
(
argv
[
0
]);
if
(
error
=
handle_options
(
&
argc
,
&
argv
,
my_long_options
,
get_one_option
))
if
(
error
=
handle_options
(
&
argc
,
&
argv
,
my_long_options
,
get_one_option
,
NULL
))
exit
(
error
);
if
(
count
||
dump
)
verbose
=
0
;
...
...
myisam/myisamchk.c
View file @
52a973c5
...
...
@@ -677,7 +677,7 @@ static void get_options(register int *argc,register char ***argv)
if
(
isatty
(
fileno
(
stdout
)))
check_param
.
testflag
|=
T_WRITE_LOOP
;
if
((
ho_error
=
handle_options
(
argc
,
argv
,
my_long_options
,
get_one_option
)))
if
((
ho_error
=
handle_options
(
argc
,
argv
,
my_long_options
,
get_one_option
,
NULL
)))
exit
(
ho_error
);
/* If using repair, then update checksum if one uses --update-state */
...
...
myisam/myisampack.c
View file @
52a973c5
...
...
@@ -350,7 +350,7 @@ static void get_options(int *argc,char ***argv)
if
(
isatty
(
fileno
(
stdout
)))
write_loop
=
1
;
if
((
ho_error
=
handle_options
(
argc
,
argv
,
my_long_options
,
get_one_option
)))
if
((
ho_error
=
handle_options
(
argc
,
argv
,
my_long_options
,
get_one_option
,
NULL
)))
exit
(
ho_error
);
if
(
!*
argc
)
...
...
mysys/my_getopt.c
View file @
52a973c5
...
...
@@ -17,10 +17,10 @@
#include <my_global.h>
#include <m_string.h>
#include <stdlib.h>
#include <my_getopt.h>
#include <assert.h>
#include <my_sys.h>
#include <mysys_err.h>
#include <my_getopt.h>
static
int
findopt
(
char
*
optpat
,
uint
length
,
const
struct
my_option
**
opt_res
,
...
...
@@ -56,6 +56,13 @@ char *disabled_my_option= (char*) "0";
my_bool
my_getopt_print_errors
=
1
;
void
default_reporter
(
enum
loglevel
level
,
const
char
*
format
,
...
)
{
va_list
args
;
va_start
(
args
,
format
);
vfprintf
(
stderr
,
format
,
args
);
va_end
(
args
);
}
/*
function: handle_options
...
...
@@ -68,10 +75,8 @@ my_bool my_getopt_print_errors= 1;
*/
int
handle_options
(
int
*
argc
,
char
***
argv
,
const
struct
my_option
*
longopts
,
my_bool
(
*
get_one_option
)(
int
,
const
struct
my_option
*
,
char
*
))
const
struct
my_option
*
longopts
,
my_get_one_option
get_one_option
,
my_error_reporter
reporter
)
{
uint
opt_found
,
argvpos
=
0
,
length
,
i
;
my_bool
end_of_options
=
0
,
must_be_var
,
set_maximum_value
,
special_used
,
...
...
@@ -85,6 +90,8 @@ int handle_options(int *argc, char ***argv,
(
*
argv
)
++
;
/* --- || ---- */
init_variables
(
longopts
);
if
(
!
reporter
)
reporter
=
&
default_reporter
;
for
(
pos
=
*
argv
,
pos_end
=
pos
+
*
argc
;
pos
!=
pos_end
;
pos
++
)
{
char
*
cur_arg
=
*
pos
;
...
...
@@ -109,8 +116,7 @@ int handle_options(int *argc, char ***argv,
if
(
!*++
pos
)
{
if
(
my_getopt_print_errors
)
fprintf
(
stderr
,
"%s: Option '-O' requires an argument
\n
"
,
progname
);
reporter
(
ERROR_LEVEL
,
"%s: Option '-O' requires an argument
\n
"
,
progname
);
return
EXIT_ARGUMENT_REQUIRED
;
}
cur_arg
=
*
pos
;
...
...
@@ -126,9 +132,7 @@ int handle_options(int *argc, char ***argv,
if
(
!*
cur_arg
)
{
if
(
my_getopt_print_errors
)
fprintf
(
stderr
,
"%s: Option '--set-variable' requires an argument
\n
"
,
progname
);
reporter
(
ERROR_LEVEL
,
"%s: Option '--set-variable' requires an argument
\n
"
,
progname
);
return
EXIT_ARGUMENT_REQUIRED
;
}
}
...
...
@@ -140,9 +144,7 @@ int handle_options(int *argc, char ***argv,
if
(
!*++
pos
)
{
if
(
my_getopt_print_errors
)
fprintf
(
stderr
,
"%s: Option '--set-variable' requires an argument
\n
"
,
progname
);
reporter
(
ERROR_LEVEL
,
"%s: Option '--set-variable' requires an argument
\n
"
,
progname
);
return
EXIT_ARGUMENT_REQUIRED
;
}
cur_arg
=
*
pos
;
...
...
@@ -201,7 +203,7 @@ int handle_options(int *argc, char ***argv,
if
(
opt_found
>
1
)
{
if
(
my_getopt_print_errors
)
fprintf
(
stderr
,
reporter
(
ERROR_LEVEL
,
"%s: ambiguous option '--%s-%s' (--%s-%s)
\n
"
,
progname
,
special_opt_prefix
[
i
],
cur_arg
,
special_opt_prefix
[
i
],
prev_found
);
...
...
@@ -236,18 +238,16 @@ int handle_options(int *argc, char ***argv,
if
(
must_be_var
)
{
if
(
my_getopt_print_errors
)
fprintf
(
stderr
,
"%s: %s: unknown variable '%s'
\n
"
,
progname
,
option_is_loose
?
"WARNING"
:
"ERROR"
,
cur_arg
);
reporter
(
option_is_loose
?
WARNING_LEVEL
:
ERROR_LEVEL
,
"%s: unknown variable '%s'
\n
"
,
progname
,
cur_arg
);
if
(
!
option_is_loose
)
return
EXIT_UNKNOWN_VARIABLE
;
}
else
{
if
(
my_getopt_print_errors
)
fprintf
(
stderr
,
"%s: %s: unknown option '--%s'
\n
"
,
progname
,
option_is_loose
?
"WARNING"
:
"ERROR"
,
cur_arg
);
reporter
(
option_is_loose
?
WARNING_LEVEL
:
ERROR_LEVEL
,
"%s: unknown option '--%s'
\n
"
,
progname
,
cur_arg
);
if
(
!
option_is_loose
)
return
EXIT_UNKNOWN_OPTION
;
}
...
...
@@ -263,14 +263,14 @@ int handle_options(int *argc, char ***argv,
if
(
must_be_var
)
{
if
(
my_getopt_print_errors
)
fprintf
(
stderr
,
"%s: variable prefix '%s' is not unique
\n
"
,
reporter
(
ERROR_LEVEL
,
"%s: variable prefix '%s' is not unique
\n
"
,
progname
,
cur_arg
);
return
EXIT_VAR_PREFIX_NOT_UNIQUE
;
}
else
{
if
(
my_getopt_print_errors
)
fprintf
(
stderr
,
"%s: ambiguous option '--%s' (%s, %s)
\n
"
,
reporter
(
ERROR_LEVEL
,
"%s: ambiguous option '--%s' (%s, %s)
\n
"
,
progname
,
cur_arg
,
prev_found
,
optp
->
name
);
return
EXIT_AMBIGUOUS_OPTION
;
}
...
...
@@ -278,7 +278,7 @@ int handle_options(int *argc, char ***argv,
if
(
must_be_var
&&
optp
->
var_type
==
GET_NO_ARG
)
{
if
(
my_getopt_print_errors
)
fprintf
(
stderr
,
"%s: option '%s' cannot take an argument
\n
"
,
reporter
(
ERROR_LEVEL
,
"%s: option '%s' cannot take an argument
\n
"
,
progname
,
optp
->
name
);
return
EXIT_NO_ARGUMENT_ALLOWED
;
}
...
...
@@ -287,7 +287,7 @@ int handle_options(int *argc, char ***argv,
if
(
optend
&&
optp
->
var_type
!=
GET_BOOL
)
{
if
(
my_getopt_print_errors
)
fprintf
(
stderr
,
"%s: option '--%s' cannot take an argument
\n
"
,
reporter
(
ERROR_LEVEL
,
"%s: option '--%s' cannot take an argument
\n
"
,
progname
,
optp
->
name
);
return
EXIT_NO_ARGUMENT_ALLOWED
;
}
...
...
@@ -325,7 +325,7 @@ int handle_options(int *argc, char ***argv,
if
(
!*++
pos
)
{
if
(
my_getopt_print_errors
)
fprintf
(
stderr
,
"%s: option '--%s' requires an argument
\n
"
,
reporter
(
ERROR_LEVEL
,
"%s: option '--%s' requires an argument
\n
"
,
progname
,
optp
->
name
);
return
EXIT_ARGUMENT_REQUIRED
;
}
...
...
@@ -375,7 +375,7 @@ int handle_options(int *argc, char ***argv,
if
(
!
pos
[
1
])
{
if
(
my_getopt_print_errors
)
fprintf
(
stderr
,
reporter
(
ERROR_LEVEL
,
"%s: option '-%c' requires an argument
\n
"
,
progname
,
optp
->
id
);
return
EXIT_ARGUMENT_REQUIRED
;
...
...
@@ -387,7 +387,7 @@ int handle_options(int *argc, char ***argv,
}
if
((
error
=
setval
(
optp
,
argument
,
set_maximum_value
)))
{
fprintf
(
stderr
,
reporter
(
ERROR_LEVEL
,
"%s: Error while setting value '%s' to '%s'
\n
"
,
progname
,
argument
,
optp
->
name
);
return
error
;
...
...
@@ -399,7 +399,7 @@ int handle_options(int *argc, char ***argv,
if
(
!
opt_found
)
{
if
(
my_getopt_print_errors
)
fprintf
(
stderr
,
reporter
(
ERROR_LEVEL
,
"%s: unknown option '-%c'
\n
"
,
progname
,
*
optend
);
return
EXIT_UNKNOWN_OPTION
;
}
...
...
@@ -409,7 +409,7 @@ int handle_options(int *argc, char ***argv,
}
if
((
error
=
setval
(
optp
,
argument
,
set_maximum_value
)))
{
fprintf
(
stderr
,
reporter
(
ERROR_LEVEL
,
"%s: Error while setting value '%s' to '%s'
\n
"
,
progname
,
argument
,
optp
->
name
);
return
error
;
...
...
sql/gen_lex_hash.cc
View file @
52a973c5
...
...
@@ -384,7 +384,7 @@ static int get_options(int argc, char **argv)
{
int
ho_error
;
if
((
ho_error
=
handle_options
(
&
argc
,
&
argv
,
my_long_options
,
get_one_option
)))
if
((
ho_error
=
handle_options
(
&
argc
,
&
argv
,
my_long_options
,
get_one_option
,
0
)))
exit
(
ho_error
);
if
(
argc
>=
1
)
...
...
sql/log.cc
View file @
52a973c5
...
...
@@ -31,12 +31,51 @@
#include <m_ctype.h> // For test_if_number
#include <assert.h>
#ifdef __NT__
#include "message.h"
#endif
MYSQL_LOG
mysql_log
,
mysql_update_log
,
mysql_slow_log
,
mysql_bin_log
;
extern
I_List
<
i_string
>
binlog_do_db
,
binlog_ignore_db
;
static
bool
test_if_number
(
const
char
*
str
,
long
*
res
,
bool
allow_wildcards
);
#ifdef __NT__
static
int
eventSource
=
0
;
void
setupWindowsEventSource
()
{
if
(
eventSource
)
return
;
eventSource
=
1
;
HKEY
hRegKey
=
NULL
;
DWORD
dwError
=
0
;
TCHAR
szPath
[
MAX_PATH
];
// Create the event source registry key
dwError
=
RegCreateKey
(
HKEY_LOCAL_MACHINE
,
"SYSTEM
\\
CurrentControlSet
\\
Services
\\
EventLog
\\
Application
\\
MySQL"
,
&
hRegKey
);
// Name of the PE module that contains the message resource
GetModuleFileName
(
NULL
,
szPath
,
MAX_PATH
);
// Register EventMessageFile
dwError
=
RegSetValueEx
(
hRegKey
,
"EventMessageFile"
,
0
,
REG_EXPAND_SZ
,
(
PBYTE
)
szPath
,
strlen
(
szPath
)
+
1
);
// Register supported event types
DWORD
dwTypes
=
EVENTLOG_ERROR_TYPE
|
EVENTLOG_WARNING_TYPE
|
EVENTLOG_INFORMATION_TYPE
;
dwError
=
RegSetValueEx
(
hRegKey
,
"TypesSupported"
,
0
,
REG_DWORD
,
(
LPBYTE
)
&
dwTypes
,
sizeof
dwTypes
);
RegCloseKey
(
hRegKey
);
}
#endif
/****************************************************************************
** Find a uniq filename for 'filename.#'.
** Set # to a number as low as possible
...
...
@@ -1693,41 +1732,33 @@ static bool test_if_number(register const char *str,
}
/* test_if_number */
void
sql_print_error
(
const
char
*
format
,...
)
void
print_buffer_to_file
(
enum
loglevel
level
,
const
char
*
buffer
)
{
va_list
args
;
time_t
skr
;
struct
tm
tm_tmp
;
struct
tm
*
start
;
va_start
(
args
,
format
);
DBUG_ENTER
(
"
sql_print_error
"
);
DBUG_ENTER
(
"
print_buffer_to_log
"
);
VOID
(
pthread_mutex_lock
(
&
LOCK_error_log
));
#ifndef DBUG_OFF
{
char
buff
[
1024
];
my_vsnprintf
(
buff
,
sizeof
(
buff
)
-
1
,
format
,
args
);
DBUG_PRINT
(
"error"
,(
"%s"
,
buff
));
va_end
(
args
);
va_start
(
args
,
format
);
}
#endif
skr
=
time
(
NULL
);
localtime_r
(
&
skr
,
&
tm_tmp
);
localtime_r
(
&
skr
,
&
tm_tmp
);
start
=&
tm_tmp
;
fprintf
(
stderr
,
"%02d%02d%02d %2d:%02d:%02d
"
,
start
->
tm_year
%
100
,
start
->
tm_mon
+
1
,
fprintf
(
stderr
,
"%02d%02d%02d %2d:%02d:%02d [%s] %s
\n
"
,
start
->
tm_year
%
100
,
start
->
tm_mon
+
1
,
start
->
tm_mday
,
start
->
tm_hour
,
start
->
tm_min
,
start
->
tm_sec
);
(
void
)
vfprintf
(
stderr
,
format
,
args
);
(
void
)
fputc
(
'\n'
,
stderr
);
start
->
tm_sec
,
level
==
ERROR_LEVEL
?
"ERROR"
:
level
==
WARNING_LEVEL
?
"WARNING"
:
"INFORMATION"
,
buffer
);
fflush
(
stderr
);
va_end
(
args
);
VOID
(
pthread_mutex_unlock
(
&
LOCK_error_log
));
DBUG_VOID_RETURN
;
}
...
...
@@ -1786,3 +1817,125 @@ bool flush_error_log()
}
return
result
;
}
#ifdef __NT__
void
print_buffer_to_nt_eventlog
(
enum
loglevel
level
,
char
*
buff
,
int
buffLen
)
{
HANDLE
event
;
char
*
buffptr
;
LPCSTR
*
buffmsgptr
;
DBUG_ENTER
(
"print_buffer_to_nt_eventlog"
);
buffptr
=
buff
;
if
(
strlen
(
buff
)
>
(
uint
)(
buffLen
-
4
))
{
char
*
newBuff
=
new
char
[
strlen
(
buff
)
+
4
];
strcpy
(
newBuff
,
buff
);
buffptr
=
newBuff
;
}
strcat
(
buffptr
,
"
\r\n\r\n
"
);
buffmsgptr
=
(
LPCSTR
*
)
&
buffptr
;
setupWindowsEventSource
();
if
(
event
=
RegisterEventSource
(
NULL
,
"MySQL"
))
{
switch
(
level
){
case
ERROR_LEVEL
:
ReportEvent
(
event
,
EVENTLOG_ERROR_TYPE
,
0
,
MSG_DEFAULT
,
NULL
,
1
,
0
,
buffmsgptr
,
NULL
);
break
;
case
WARNING_LEVEL
:
ReportEvent
(
event
,
EVENTLOG_WARNING_TYPE
,
0
,
MSG_DEFAULT
,
NULL
,
1
,
0
,
buffmsgptr
,
NULL
);
break
;
case
INFORMATION_LEVEL
:
ReportEvent
(
event
,
EVENTLOG_INFORMATION_TYPE
,
0
,
MSG_DEFAULT
,
NULL
,
1
,
0
,
buffmsgptr
,
NULL
);
break
;
}
DeregisterEventSource
(
event
);
}
// if we created a string buffer, then delete it
if
(
buffptr
!=
buff
)
delete
[]
buffptr
;
DBUG_VOID_RETURN
;
}
#endif
/*
Prints a printf style message to the error log and, under NT, to the Windows event log.
SYNOPSIS
vprint_msg_to_log()
event_type Type of event to write (Error, Warning, or Info)
format Printf style format of message
args va_list list of arguments for the message
NOTE
IMPLEMENTATION
This function prints the message into a buffer and then sends that buffer to other
functions to write that message to other logging sources.
RETURN VALUES
void
*/
void
vprint_msg_to_log
(
enum
loglevel
level
,
const
char
*
format
,
va_list
args
)
{
char
buff
[
1024
];
DBUG_ENTER
(
"vprint_msg_to_log"
);
my_vsnprintf
(
buff
,
sizeof
(
buff
)
-
5
,
format
,
args
);
print_buffer_to_file
(
level
,
buff
);
#ifndef DBUG_OFF
DBUG_PRINT
(
"error"
,(
"%s"
,
buff
));
#endif
#ifdef __NT__
print_buffer_to_nt_eventlog
(
level
,
buff
,
sizeof
(
buff
)
);
#endif
DBUG_VOID_RETURN
;
}
void
sql_print_error
(
const
char
*
format
,
...
)
{
DBUG_ENTER
(
"sql_print_error"
);
va_list
args
;
va_start
(
args
,
format
);
vprint_msg_to_log
(
ERROR_LEVEL
,
format
,
args
);
va_end
(
args
);
DBUG_VOID_RETURN
;
}
void
sql_print_warning
(
const
char
*
format
,
...
)
{
DBUG_ENTER
(
"sql_print_warning"
);
va_list
args
;
va_start
(
args
,
format
);
vprint_msg_to_log
(
WARNING_LEVEL
,
format
,
args
);
va_end
(
args
);
DBUG_VOID_RETURN
;
}
void
sql_print_information
(
const
char
*
format
,
...
)
{
DBUG_ENTER
(
"sql_print_information"
);
va_list
args
;
va_start
(
args
,
format
);
vprint_msg_to_log
(
INFORMATION_LEVEL
,
format
,
args
);
va_end
(
args
);
DBUG_VOID_RETURN
;
}
sql/mysql_priv.h
View file @
52a973c5
...
...
@@ -24,6 +24,7 @@
#include <thr_lock.h>
#include <my_base.h>
/* Needed by field.h */
#include <my_bitmap.h>
#include <my_getopt.h>
#ifdef __EMX__
#undef write
/* remove pthread.h macro definition for EMX */
...
...
@@ -640,8 +641,14 @@ bool check_if_key_used(TABLE *table, uint idx, List<Item> &fields);
void
init_errmessage
(
void
);
void
sql_perror
(
const
char
*
message
);
void
sql_print_error
(
const
char
*
format
,...)
__attribute__
((
format
(
printf
,
1
,
2
)));
void
vprint_msg_to_log
(
enum
loglevel
level
,
const
char
*
format
,
va_list
args
);
void
sql_print_error
(
const
char
*
format
,
...
);
void
sql_print_warning
(
const
char
*
format
,
...);
void
sql_print_information
(
const
char
*
format
,
...);
bool
fn_format_relative_to_data_home
(
my_string
to
,
const
char
*
name
,
const
char
*
dir
,
const
char
*
extension
);
bool
open_log
(
MYSQL_LOG
*
log
,
const
char
*
hostname
,
...
...
sql/mysqld.cc
View file @
52a973c5
...
...
@@ -5102,11 +5102,19 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
}
/* Initiates DEBUG - but no debugging here ! */
void
option_error_reporter
(
enum
loglevel
level
,
const
char
*
format
,
...
)
{
va_list
args
;
va_start
(
args
,
format
);
vprint_msg_to_log
(
level
,
format
,
args
);
va_end
(
args
);
}
static
void
get_options
(
int
argc
,
char
**
argv
)
{
int
ho_error
;
if
((
ho_error
=
handle_options
(
&
argc
,
&
argv
,
my_long_options
,
get_one_option
)))
if
((
ho_error
=
handle_options
(
&
argc
,
&
argv
,
my_long_options
,
get_one_option
,
option_error_reporter
)))
exit
(
ho_error
);
#if defined(HAVE_BROKEN_REALPATH)
...
...
tools/mysqlmanager.c
View file @
52a973c5
...
...
@@ -1333,7 +1333,7 @@ static int parse_args(int argc, char **argv)
{
int
ho_error
;
if
((
ho_error
=
handle_options
(
&
argc
,
&
argv
,
my_long_options
,
get_one_option
)))
if
((
ho_error
=
handle_options
(
&
argc
,
&
argv
,
my_long_options
,
get_one_option
,
NULL
)))
exit
(
ho_error
);
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment