Commit c9614944 authored by jani@hynda.(none)'s avatar jani@hynda.(none)

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.
parent 51883b32
......@@ -40,7 +40,7 @@
#include <signal.h>
#include <violite.h>
const char *VER= "12.7";
const char *VER= "12.8";
/* Don't try to make a nice table if the data is too big */
#define MAX_COLUMN_LENGTH 1024
......@@ -739,11 +739,7 @@ static int get_options(int argc, char **argv)
strmov(default_pager, pager);
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 (status.batch) /* disable pager and outfile in this case */
{
......
......@@ -23,7 +23,7 @@
#include <my_pthread.h> /* because of signal() */
#endif
#define ADMIN_VERSION "8.34"
#define ADMIN_VERSION "8.35"
#define MAX_MYSQL_VAR 64
#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */
#define MAX_TRUNC_LENGTH 3
......@@ -247,11 +247,8 @@ int main(int argc,char *argv[])
free_defaults()
*/
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 == 0)
{
usage();
......
......@@ -124,7 +124,7 @@ static void die(const char* fmt, ...)
static void print_version()
{
printf("%s Ver 2.2 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
printf("%s Ver 2.3 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
}
......@@ -223,11 +223,8 @@ static int parse_args(int *argc, char*** argv)
result_file = stdout;
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);
return 0;
}
......
......@@ -16,7 +16,7 @@
/* By Jani Tolonen, 2001-04-20, MySQL Development Team */
#define CHECK_VERSION "2.3"
#define CHECK_VERSION "2.4"
#include "client_priv.h"
#include <m_ctype.h>
......@@ -265,11 +265,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)))
{
printf("%s: handle_options() failed with error %d\n", my_progname,
ho_error);
exit(1);
}
exit(ho_error);
if (!what_to_do)
{
......
......@@ -35,7 +35,7 @@
** and adapted to mysqldump 05/11/01 by Jani Tolonen
*/
#define DUMP_VERSION "9.05"
#define DUMP_VERSION "9.06"
#include <my_global.h>
#include <my_sys.h>
......@@ -360,11 +360,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)))
{
printf("%s: handle_options() failed with error %d\n", my_progname,
ho_error);
exit(1);
}
exit(ho_error);
if (opt_delayed)
opt_lock=0; /* Can't have lock with delayed */
......
......@@ -25,7 +25,7 @@
** * *
** *************************
*/
#define IMPORT_VERSION "3.3"
#define IMPORT_VERSION "3.4"
#include "client_priv.h"
#include "mysql_version.h"
......@@ -204,11 +204,8 @@ static int get_options(int *argc, char ***argv)
int ho_error;
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 (enclosed && opt_enclosed)
{
fprintf(stderr, "You can't use ..enclosed.. and ..optionally-enclosed.. at the same time.\n");
......
......@@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#define MANAGER_PWGEN_VERSION "1.3"
#define MANAGER_PWGEN_VERSION "1.4"
#include <my_global.h>
#include <m_ctype.h>
......@@ -96,11 +96,8 @@ int parse_args(int argc, char** argv)
int ho_error;
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);
return 0;
}
......
......@@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#define MANAGER_CLIENT_VERSION "1.3"
#define MANAGER_CLIENT_VERSION "1.4"
#include <my_global.h>
#include <mysql.h>
......@@ -132,12 +132,10 @@ 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)))
{
printf("%s: handle_options() failed with error %d\n", my_progname,
ho_error);
exit(1);
}
exit(ho_error);
return 0;
}
int main(int argc, char** argv)
......
......@@ -16,7 +16,7 @@
/* Show databases, tables or columns */
#define SHOW_VERSION "9.3"
#define SHOW_VERSION "9.4"
#include <my_global.h>
#include "client_priv.h"
......@@ -241,11 +241,7 @@ get_options(int *argc,char ***argv)
int ho_error;
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 (tty_password)
opt_password=get_tty_password(NullS);
......
......@@ -42,7 +42,7 @@
**********************************************************************/
#define MTEST_VERSION "1.22"
#define MTEST_VERSION "1.23"
#include <my_global.h>
#include <mysql_embed.h>
......@@ -1957,11 +1957,7 @@ int parse_args(int argc, char **argv)
default_argv= argv;
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 > 1)
{
......
......@@ -173,11 +173,7 @@ static void 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)))
{
printf("%s: handle_options() failed with error %d\n", my_progname,
ho_error);
exit(1);
}
exit(ho_error);
free_defaults(argv);
if (tty_password)
......
......@@ -55,7 +55,7 @@ static struct my_option my_long_options[] =
static void usage(my_bool version)
{
printf("%s Ver 1.4 for %s at %s\n",my_progname,SYSTEM_TYPE,
printf("%s Ver 1.5 for %s at %s\n",my_progname,SYSTEM_TYPE,
MACHINE_TYPE);
if (version)
return;
......@@ -92,11 +92,8 @@ static int get_options(int *argc,char ***argv)
int ho_error;
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 < 1)
{
usage(0);
......
......@@ -18,7 +18,7 @@
/* Install or upgrade MySQL server. By Sasha Pachev <sasha@mysql.com>
*/
#define INSTALL_VERSION "1.1"
#define INSTALL_VERSION "1.2"
#define DONT_USE_RAID
#include <my_global.h>
......@@ -219,11 +219,8 @@ static int parse_args(int argc, char **argv)
int ho_error;
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);
return 0;
}
......
......@@ -16,7 +16,7 @@
/* Return error-text for system error messages and nisam messages */
#define PERROR_VERSION "2.8"
#define PERROR_VERSION "2.9"
#include <my_global.h>
#include <my_sys.h>
......@@ -141,11 +141,8 @@ static int get_options(int *argc,char ***argv)
int ho_error;
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 && !print_all_codes)
{
usage();
......
......@@ -30,7 +30,7 @@
#define INIT_SYM_TABLE 4096
#define INC_SYM_TABLE 4096
#define MAX_SYM_SIZE 128
#define DUMP_VERSION "1.3"
#define DUMP_VERSION "1.4"
#define HEX_INVALID (uchar)255
typedef ulong my_long_addr_t ; /* at some point, we need to fix configure
......@@ -121,11 +121,8 @@ static int parse_args(int argc, char **argv)
int ho_error;
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);
/*
The following code is to make the command compatible with the old
version that required one to use the -n and -s options
......
......@@ -16,7 +16,7 @@
/* Resolves IP's to hostname and hostnames to IP's */
#define RESOLVE_VERSION "2.1"
#define RESOLVE_VERSION "2.2"
#include <my_global.h>
#include <m_ctype.h>
......@@ -94,11 +94,8 @@ 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)))
{
printf("%s: handle_options() failed with error %d\n", my_progname,
ho_error);
exit(1);
}
exit(ho_error);
if (*argc == 0)
{
usage();
......
......@@ -39,6 +39,7 @@ struct my_option
};
extern char *disabled_my_option;
extern my_bool my_getopt_print_errors;
extern int handle_options (int *argc, char ***argv,
const struct my_option *longopts,
......
......@@ -54,7 +54,23 @@ extern const char * NEAR globerrs[]; /* my_error_messages is here */
#define EE_CANT_SYMLINK 25
#define EE_REALPATH 26
/* exit codes for all MySQL programs */
#define EXIT_UNSPECIFIED_ERROR 1
#define EXIT_UNKNOWN_OPTION 2
#define EXIT_AMBIGUOUS_OPTION 3
#define EXIT_NO_ARGUMENT_ALLOWED 4
#define EXIT_ARGUMENT_REQUIRED 5
#define EXIT_VAR_PREFIX_NOT_UNIQUE 6
#define EXIT_UNKNOWN_VARIABLE 7
#define EXIT_OUT_OF_MEMORY 8
#define EXIT_UNKNOWN_SUFFIX 9
#define EXIT_NO_PTR_TO_VARIABLE 10
#define EXIT_CANNOT_CONNECT_TO_SERVICE 11
#ifdef __cplusplus
}
#endif
#endif
......@@ -335,7 +335,7 @@ static struct my_option my_long_options[] =
static void print_version(void)
{
printf("%s Ver 6.00 for %s at %s\n", my_progname, SYSTEM_TYPE,
printf("%s Ver 6.01 for %s at %s\n", my_progname, SYSTEM_TYPE,
MACHINE_TYPE);
}
......@@ -665,11 +665,7 @@ static void get_options(register int *argc, register char ***argv)
testflag|=T_WRITE_LOOP;
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 == 0)
{
......
......@@ -278,7 +278,7 @@ static struct my_option my_long_options[] =
static void print_version(void)
{
printf("%s Ver 5.9 for %s on %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
printf("%s Ver 5.10 for %s on %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
}
static void usage(void)
......@@ -353,11 +353,8 @@ static void get_options(int *argc, char ***argv)
int ho_error;
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);
my_progname= argv[0][0];
if (isatty(fileno(stdout)))
write_loop=1;
......
......@@ -245,11 +245,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)))
{
printf("%s: handle_options() failed with error %d\n", my_progname,
ho_error);
exit(1);
}
exit(ho_error);
} /* get options */
......
......@@ -179,11 +179,8 @@ static void get_options(int argc, char *argv[])
int ho_error;
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(!(d_file=argv[optind])) print_error(1,"No d_file");
if(!(df=fopen(d_file,"r")))
print_error(1,"fopen(%s)",d_file);
......
......@@ -284,11 +284,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)))
{
printf("%s: handle_options() failed with error %d\n", my_progname,
ho_error);
exit(1);
}
exit(ho_error);
return;
} /* get options */
......
......@@ -623,7 +623,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
key_cacheing=1;
break;
case 'V':
printf("test1 Ver 1.1 \n");
printf("test1 Ver 1.2 \n");
exit(0);
case '#':
DEBUGGER_ON;
......@@ -644,11 +644,8 @@ static void get_options(int argc, char *argv[])
int ho_error;
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);
return;
} /* get options */
......
......@@ -292,7 +292,7 @@ static struct my_option my_long_options[] =
static void print_version(void)
{
printf("%s Ver 2.5 for %s at %s\n", my_progname, SYSTEM_TYPE,
printf("%s Ver 2.6 for %s at %s\n", my_progname, SYSTEM_TYPE,
MACHINE_TYPE);
}
......@@ -615,13 +615,15 @@ get_one_option(int optid,
static void get_options(register int *argc,register char ***argv)
{
int ho_error;
load_defaults("my", load_default_groups, argc, argv);
default_argv= *argv;
if (isatty(fileno(stdout)))
check_param.testflag|=T_WRITE_LOOP;
if (handle_options(argc, argv, my_long_options, get_one_option))
exit(1);
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
/* If using repair, then update checksum if one uses --update-state */
if ((check_param.testflag & T_UPDATE_STATE) &&
......
......@@ -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();
......
......@@ -20,6 +20,7 @@
#include <my_getopt.h>
#include <assert.h>
#include <my_sys.h>
#include <mysys_err.h>
static int findopt (char *optpat, uint length,
const struct my_option **opt_res,
......@@ -42,17 +43,11 @@ static const char *special_opt_prefix[]=
char *disabled_my_option= (char*) "0";
/* Return error values from handle_options */
/* This is a flag that can be set in client programs. 0 means that
my_getopt will not print error messages, but the client should do
it by itself */
#define ERR_UNKNOWN_OPTION 1
#define ERR_AMBIGUOUS_OPTION 2
#define ERR_NO_ARGUMENT_ALLOWED 3
#define ERR_ARGUMENT_REQUIRED 4
#define ERR_VAR_PREFIX_NOT_UNIQUE 5
#define ERR_UNKNOWN_VARIABLE 6
#define ERR_OUT_OF_MEMORY 7
#define ERR_UNKNOWN_SUFFIX 8
#define ERR_NO_PTR_TO_VARIABLE 9
my_bool my_getopt_print_errors= 1;
/*
......@@ -106,9 +101,10 @@ int handle_options(int *argc, char ***argv,
/* the argument must be in next argv */
if (!*++pos)
{
fprintf(stderr, "%s: Option '-O' requires an argument\n",
progname);
return ERR_ARGUMENT_REQUIRED;
if (my_getopt_print_errors)
fprintf(stderr, "%s: Option '-O' requires an argument\n",
progname);
return EXIT_ARGUMENT_REQUIRED;
}
cur_arg= *pos;
(*argc)--;
......@@ -128,10 +124,11 @@ int handle_options(int *argc, char ***argv,
cur_arg+= 14;
if (!*cur_arg)
{
fprintf(stderr,
"%s: Option '--set-variable' requires an argument\n",
progname);
return ERR_ARGUMENT_REQUIRED;
if (my_getopt_print_errors)
fprintf(stderr,
"%s: Option '--set-variable' requires an argument\n",
progname);
return EXIT_ARGUMENT_REQUIRED;
}
}
else if (cur_arg[14]) /* garbage, or another option. break out */
......@@ -141,10 +138,11 @@ int handle_options(int *argc, char ***argv,
/* the argument must be in next argv */
if (!*++pos)
{
fprintf(stderr,
"%s: Option '--set-variable' requires an argument\n",
progname);
return ERR_ARGUMENT_REQUIRED;
if (my_getopt_print_errors)
fprintf(stderr,
"%s: Option '--set-variable' requires an argument\n",
progname);
return EXIT_ARGUMENT_REQUIRED;
}
cur_arg= *pos;
(*argc)--;
......@@ -200,11 +198,12 @@ int handle_options(int *argc, char ***argv,
{
if (opt_found > 1)
{
fprintf(stderr,
"%s: ambiguous option '--%s-%s' (--%s-%s)\n",
progname, special_opt_prefix[i], cur_arg,
special_opt_prefix[i], prev_found);
return ERR_AMBIGUOUS_OPTION;
if (my_getopt_print_errors)
fprintf(stderr,
"%s: ambiguous option '--%s-%s' (--%s-%s)\n",
progname, special_opt_prefix[i], cur_arg,
special_opt_prefix[i], prev_found);
return EXIT_AMBIGUOUS_OPTION;
}
if (i < DISABLE_OPTION_COUNT)
optend= disabled_my_option;
......@@ -224,19 +223,21 @@ int handle_options(int *argc, char ***argv,
{
if (must_be_var)
{
fprintf(stderr,
"%s: %s: unknown variable '%s'\n", progname,
option_is_loose ? "WARNING" : "ERROR", cur_arg);
if (my_getopt_print_errors)
fprintf(stderr,
"%s: %s: unknown variable '%s'\n", progname,
option_is_loose ? "WARNING" : "ERROR", cur_arg);
if (!option_is_loose)
return ERR_UNKNOWN_VARIABLE;
return EXIT_UNKNOWN_VARIABLE;
}
else
{
fprintf(stderr,
"%s: %s: unknown option '--%s'\n", progname,
option_is_loose ? "WARNING" : "ERROR", cur_arg);
if (my_getopt_print_errors)
fprintf(stderr,
"%s: %s: unknown option '--%s'\n", progname,
option_is_loose ? "WARNING" : "ERROR", cur_arg);
if (!option_is_loose)
return ERR_UNKNOWN_OPTION;
return EXIT_UNKNOWN_OPTION;
}
if (option_is_loose)
{
......@@ -249,30 +250,34 @@ int handle_options(int *argc, char ***argv,
{
if (must_be_var)
{
fprintf(stderr, "%s: variable prefix '%s' is not unique\n",
progname, cur_arg);
return ERR_VAR_PREFIX_NOT_UNIQUE;
if (my_getopt_print_errors)
fprintf(stderr, "%s: variable prefix '%s' is not unique\n",
progname, cur_arg);
return EXIT_VAR_PREFIX_NOT_UNIQUE;
}
else
{
fprintf(stderr, "%s: ambiguous option '--%s' (%s, %s)\n",
progname, cur_arg, prev_found, optp->name);
return ERR_AMBIGUOUS_OPTION;
if (my_getopt_print_errors)
fprintf(stderr, "%s: ambiguous option '--%s' (%s, %s)\n",
progname, cur_arg, prev_found, optp->name);
return EXIT_AMBIGUOUS_OPTION;
}
}
if (must_be_var && (!optp->value || optp->var_type == GET_BOOL))
{
fprintf(stderr, "%s: option '%s' cannot take an argument\n",
progname, optp->name);
return ERR_NO_ARGUMENT_ALLOWED;
if (my_getopt_print_errors)
fprintf(stderr, "%s: option '%s' cannot take an argument\n",
progname, optp->name);
return EXIT_NO_ARGUMENT_ALLOWED;
}
if (optp->arg_type == NO_ARG)
{
if (optend && !special_used)
{
fprintf(stderr, "%s: option '--%s' cannot take an argument\n",
progname, optp->name);
return ERR_NO_ARGUMENT_ALLOWED;
if (my_getopt_print_errors)
fprintf(stderr, "%s: option '--%s' cannot take an argument\n",
progname, optp->name);
return EXIT_NO_ARGUMENT_ALLOWED;
}
if (optp->var_type == GET_BOOL)
{
......@@ -306,9 +311,10 @@ int handle_options(int *argc, char ***argv,
/* Check if there are more arguments after this one */
if (!*++pos)
{
fprintf(stderr, "%s: option '--%s' requires an argument\n",
progname, optp->name);
return ERR_ARGUMENT_REQUIRED;
if (my_getopt_print_errors)
fprintf(stderr, "%s: option '--%s' requires an argument\n",
progname, optp->name);
return EXIT_ARGUMENT_REQUIRED;
}
argument= *pos;
(*argc)--;
......@@ -347,9 +353,11 @@ int handle_options(int *argc, char ***argv,
/* Check if there are more arguments after this one */
if (!*++pos)
{
fprintf(stderr, "%s: option '-%c' requires an argument\n",
progname, optp->id);
return ERR_ARGUMENT_REQUIRED;
if (my_getopt_print_errors)
fprintf(stderr,
"%s: option '-%c' requires an argument\n",
progname, optp->id);
return EXIT_ARGUMENT_REQUIRED;
}
argument= *pos;
(*argc)--;
......@@ -369,9 +377,10 @@ int handle_options(int *argc, char ***argv,
}
if (!opt_found)
{
fprintf(stderr,
"%s: unknown option '-%c'\n", progname, *cur_arg);
return ERR_UNKNOWN_OPTION;
if (my_getopt_print_errors)
fprintf(stderr,
"%s: unknown option '-%c'\n", progname, *cur_arg);
return EXIT_UNKNOWN_OPTION;
}
}
(*argc)--; /* option handled (short), decrease argument count */
......@@ -412,7 +421,7 @@ static int setval (const struct my_option *opts, char *argument,
opts->u_max_value : opts->value;
if (!result_pos)
return ERR_NO_PTR_TO_VARIABLE;
return EXIT_NO_PTR_TO_VARIABLE;
switch (opts->var_type) {
case GET_INT:
......@@ -437,13 +446,13 @@ static int setval (const struct my_option *opts, char *argument,
my_free((*(char**) result_pos),
MYF(MY_WME | MY_FAE));
if (!(*((char**) result_pos)= my_strdup(argument, MYF(MY_WME))))
return ERR_OUT_OF_MEMORY;
return EXIT_OUT_OF_MEMORY;
break;
default: /* dummy default to avoid compiler warnings */
break;
}
if (err)
return ERR_UNKNOWN_SUFFIX;
return EXIT_UNKNOWN_SUFFIX;
}
return 0;
}
......
......@@ -356,7 +356,7 @@ void print_arrays()
static void usage(int version)
{
printf("%s Ver 3.4 Distrib %s, for %s (%s)\n",
printf("%s Ver 3.5 Distrib %s, for %s (%s)\n",
my_progname, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
if (version)
return;
......@@ -394,11 +394,8 @@ static int get_options(int argc, char **argv)
int ho_error;
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 >= 1)
{
usage(0);
......
......@@ -3053,7 +3053,6 @@ static struct my_option my_long_options[] =
*/
{"memlock", OPT_MEMLOCK, "Lock mysqld in memory", (gptr*) &locked_in_memory,
(gptr*) &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifndef DBUG_OFF
{"disconnect-slave-event-count", OPT_DISCONNECT_SLAVE_EVENT_COUNT,
"Undocumented: Meant for debugging and testing of replication",
(gptr*) &disconnect_slave_event_count,
......@@ -3070,7 +3069,6 @@ static struct my_option my_long_options[] =
(gptr*) &opt_sporadic_binlog_dump_fail,
(gptr*) &opt_sporadic_binlog_dump_fail, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
#endif
{"safemalloc-mem-limit", OPT_SAFEMALLOC_MEM_LIMIT,
"Simulate memory shortage when compiled with the --with-debug=full option",
0, 0, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
......@@ -4421,11 +4419,7 @@ static void get_options(int argc,char **argv)
#endif
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);
fix_paths();
default_table_type_name=ha_table_typelib.type_names[default_table_type-1];
......
......@@ -41,8 +41,8 @@
#include <sys/wait.h>
#endif
#define MANAGER_VERSION "1.1"
#define MANAGER_GREETING "MySQL Server Management Daemon v. 1.0"
#define MANAGER_VERSION "1.2"
#define MANAGER_GREETING "MySQL Server Management Daemon v. 1.2"
#define LOG_ERR 1
#define LOG_WARN 2
......@@ -1332,11 +1332,8 @@ static int parse_args(int argc, char **argv)
int ho_error;
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);
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment