2002-01-25 22:34:37 +01:00
|
|
|
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
|
|
|
2004-08-18 22:31:01 +02:00
|
|
|
#ifndef _my_getopt_h
|
|
|
|
#define _my_getopt_h
|
|
|
|
|
2002-04-02 19:29:53 +02:00
|
|
|
C_MODE_START
|
2002-01-25 22:34:37 +01:00
|
|
|
|
2004-07-08 16:12:42 +02:00
|
|
|
#define GET_NO_ARG 1
|
|
|
|
#define GET_BOOL 2
|
|
|
|
#define GET_INT 3
|
|
|
|
#define GET_UINT 4
|
|
|
|
#define GET_LONG 5
|
|
|
|
#define GET_ULONG 6
|
|
|
|
#define GET_LL 7
|
|
|
|
#define GET_ULL 8
|
|
|
|
#define GET_STR 9
|
|
|
|
#define GET_STR_ALLOC 10
|
2004-07-09 01:29:28 +02:00
|
|
|
#define GET_DISABLED 11
|
2003-06-27 17:51:39 +02:00
|
|
|
|
2004-01-14 03:58:37 +01:00
|
|
|
#define GET_ASK_ADDR 128
|
|
|
|
#define GET_TYPE_MASK 127
|
2003-06-27 17:51:39 +02:00
|
|
|
|
2002-01-25 22:34:37 +01:00
|
|
|
enum get_opt_arg_type { NO_ARG, OPT_ARG, REQUIRED_ARG };
|
|
|
|
|
|
|
|
struct my_option
|
|
|
|
{
|
|
|
|
const char *name; /* Name of the option */
|
2002-04-02 19:29:53 +02:00
|
|
|
int id; /* unique id or short option */
|
2002-01-25 22:34:37 +01:00
|
|
|
const char *comment; /* option comment, for autom. --help */
|
2002-01-30 04:08:17 +01:00
|
|
|
gptr *value; /* The variable value */
|
|
|
|
gptr *u_max_value; /* The user def. max variable value */
|
2002-01-25 22:34:37 +01:00
|
|
|
const char **str_values; /* Pointer to possible values */
|
2004-07-08 16:12:42 +02:00
|
|
|
ulong var_type;
|
2002-01-25 22:34:37 +01:00
|
|
|
enum get_opt_arg_type arg_type;
|
2002-01-29 17:32:16 +01:00
|
|
|
longlong def_value; /* Default value */
|
|
|
|
longlong min_value; /* Min allowed value */
|
|
|
|
longlong max_value; /* Max allowed value */
|
|
|
|
longlong sub_size; /* Subtract this from given value */
|
2002-01-25 22:34:37 +01:00
|
|
|
long block_size; /* Value should be a mult. of this */
|
|
|
|
int app_type; /* To be used by an application */
|
|
|
|
};
|
|
|
|
|
2004-08-18 22:31:01 +02:00
|
|
|
typedef my_bool (* my_get_one_option) (int, const struct my_option *, char * );
|
2004-08-19 17:56:32 +02:00
|
|
|
typedef void (* my_error_reporter) (enum loglevel level, const char *format, ... );
|
mysql_priv.h:
Added declarations for print_msg_to_log and vprint_msg_to_log. sql_print_error are simple functions that wrap calls to print_msg_to_log. Define the different error types with MY_ERROR_TYPE, MY_WARNING_TYPE, and MY_INFORMATION_TYPE
gen_lex_hash.cc:
Added NULL error reporting parameter to handle_options
log.cc:
Add print_msg_to_log, print_buffer_to_log, and vprint_msg_to_log. Print_msg_to_log will write the message to the windows event log if on NT. We now have error, warning, and information versions of sql_print_xxxx. T his is a variation of a similar changeset WAX did.
mysqld.cc:
Added option_error_reporter callback function and pass that into handle_options
mysql.cc:
Added NULL as error reporter arg to the end of handle_options
Many files:
Added NULL error reporter parameter as the last paramter to handle_options
my_getopt.c:
Added second function pointer to server as an error reporting callback. Added local function report_option_error that will either write the error to stderr or to the error reporting callback. changed all calls in handle_options from fprintf(stderr, ... ) to report_option_error
my_getopt.h:
Changed declaration of handle_options to use typedefs for the two function pointers. added second function pointer to server as an error reporting callback
mysqld.dsp:
Added custom build step for compiling message file and added message resource file (output of mc)
VC++Files/sql/mysqld.dsp:
Added custom build step for compiling message file and added message resource file (output of mc)
client/mysqladmin.c:
Added NULL error reporter parameter as the last paramter to handle_options
client/mysqlcheck.c:
Added NULL error reporter parameter as the last paramter to handle_options
client/mysqldump.c:
Added NULL error reporter parameter as the last paramter to handle_options
client/mysqlimport.c:
Added NULL error reporter parameter as the last paramter to handle_options
client/mysqlmanager-pwgen.c:
Added NULL error reporter parameter as the last paramter to handle_options
client/mysqlmanagerc.c:
Added NULL error reporter parameter as the last paramter to handle_options
client/mysqlbinlog.cc:
Added NULL error reporter parameter as the last paramter to handle_options
client/mysqlshow.c:
Added NULL error reporter parameter as the last paramter to handle_options
client/mysqltest.c:
Added NULL error reporter parameter as the last paramter to handle_options
extra/my_print_defaults.c:
Added NULL error reporter parameter as the last paramter to handle_options
extra/mysql_install.c:
Added NULL error reporter parameter as the last paramter to handle_options
extra/mysql_waitpid.c:
Added NULL error reporter parameter as the last paramter to handle_options
extra/perror.c:
Added NULL error reporter parameter as the last paramter to handle_options
extra/resolve_stack_dump.c:
Added NULL error reporter parameter as the last paramter to handle_options
extra/resolveip.c:
Added NULL error reporter parameter as the last paramter to handle_options
isam/isamchk.c:
Added NULL error reporter parameter as the last paramter to handle_options
isam/pack_isam.c:
Added NULL error reporter parameter as the last paramter to handle_options
myisam/mi_test1.c:
Added NULL error reporter parameter as the last paramter to handle_options
myisam/myisam_ftdump.c:
Added NULL error reporter parameter as the last paramter to handle_options
myisam/myisamchk.c:
Added NULL error reporter parameter as the last paramter to handle_options
myisam/myisampack.c:
Added NULL error reporter parameter as the last paramter to handle_options
include/my_getopt.h:
Changed declaration of handle_options to use typedefs for the two function pointers. added second function pointer to server as an error reporting callback
mysys/my_getopt.c:
Added second function pointer to server as an error reporting callback. Added local function report_option_error that will either write the error to stderr or to the error reporting callback. changed all calls in handle_options from fprintf(stderr, ... ) to report_option_error
tools/mysqlmanager.c:
Added NULL error reporter parameter as the last paramter to handle_options
client/mysql.cc:
Added NULL as error reporter arg to the end of handle_options
sql/mysqld.cc:
Added option_error_reporter callback function and pass that into handle_options
sql/log.cc:
Add print_msg_to_log, print_buffer_to_log, and vprint_msg_to_log. Print_msg_to_log will write the message to the windows event log if on NT. We now have error, warning, and information versions of sql_print_xxxx. T his is a variation of a similar changeset WAX did.
sql/gen_lex_hash.cc:
Added NULL error reporting parameter to handle_options
sql/mysql_priv.h:
Added declarations for print_msg_to_log and vprint_msg_to_log. sql_print_error are simple functions that wrap calls to print_msg_to_log. Define the different error types with MY_ERROR_TYPE, MY_WARNING_TYPE, and MY_INFORMATION_TYPE
BitKeeper/etc/logging_ok:
Logging to logging@openlogging.org accepted
2004-08-14 03:38:37 +02:00
|
|
|
|
2004-08-31 18:27:58 +02:00
|
|
|
extern char *disabled_my_option;
|
|
|
|
extern my_bool my_getopt_print_errors;
|
|
|
|
extern my_error_reporter my_getopt_error_reporter;
|
|
|
|
|
2002-01-31 03:36:58 +01:00
|
|
|
extern int handle_options (int *argc, char ***argv,
|
2004-08-31 18:27:58 +02:00
|
|
|
const struct my_option *longopts, my_get_one_option);
|
2002-02-06 16:22:43 +01:00
|
|
|
extern void my_print_help(const struct my_option *options);
|
|
|
|
extern void my_print_variables(const struct my_option *options);
|
2003-07-06 18:09:57 +02:00
|
|
|
extern void my_getopt_register_get_addr(gptr* (*func_addr)(const char *, uint,
|
2003-06-27 17:51:39 +02:00
|
|
|
const struct my_option *));
|
2002-04-02 19:29:53 +02:00
|
|
|
|
2002-07-23 17:31:22 +02:00
|
|
|
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);
|
2004-08-18 22:31:01 +02:00
|
|
|
|
2002-04-02 19:29:53 +02:00
|
|
|
C_MODE_END
|
2004-08-18 22:31:01 +02:00
|
|
|
|
|
|
|
#endif /* _my_getopt_h */
|
|
|
|
|