Commit d3143ef8 authored by Monty's avatar Monty

Improve --help and remove not-free warnings for mysql_tzinfo_to_sql

parent 9d4c0a6c
...@@ -2630,24 +2630,33 @@ static struct my_option my_long_options[] = ...@@ -2630,24 +2630,33 @@ static struct my_option my_long_options[] =
{"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0}, 0, 0, 0, 0, 0, 0},
#ifdef DBUG_OFF #ifdef DBUG_OFF
{"debug", '#', "This is a non-debug version. Catch this and exit", {"debug", '#', "This is a non-debug version. Catch this and exit.",
0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0}, 0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
#else #else
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif #endif
{"leap", 'l', "Print the leap second information from the given time zone file. By convention, when --leap is used the next argument is the timezonefile", {"leap", 'l', "Print the leap second information from the given time zone file. By convention, when --leap is used the next argument is the timezonefile.",
&opt_leap, &opt_leap, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, &opt_leap, &opt_leap, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Write non critical warnings", {"verbose", 'v', "Write non critical warnings.",
&opt_verbose, &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, &opt_verbose, &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.", {"version", 'V', "Output version information and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-write-binlog", 'S', "Do not replicate changes to time zone tables to other nodes in a Galera cluster", {"skip-write-binlog", 'S', "Do not replicate changes to time zone tables to other nodes in a Galera cluster.",
&opt_skip_write_binlog,&opt_skip_write_binlog, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, &opt_skip_write_binlog,&opt_skip_write_binlog, 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} { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
}; };
static char **default_argv;
static void free_allocated_data()
{
free_defaults(default_argv);
my_end(0);
}
C_MODE_START C_MODE_START
static my_bool get_one_option(int optid, const struct my_option *, static my_bool get_one_option(int optid, const struct my_option *,
char *argument); char *argument);
...@@ -2659,11 +2668,21 @@ static void print_version(void) ...@@ -2659,11 +2668,21 @@ static void print_version(void)
MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE); MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
} }
static const char *default_timezone_dir= "/usr/share/zoneinfo/";
static void print_usage(void) static void print_usage(void)
{ {
fprintf(stderr, "Usage:\n"); fprintf(stdout, "Create SQL commands for loading system timezeone data for "
fprintf(stderr, " %s [options] timezonedir\n", my_progname); "MariaDB\n\n");
fprintf(stderr, " %s [options] timezonefile timezonename\n", my_progname); fprintf(stdout, "Usage:\n");
fprintf(stdout, " %s [options] timezonedir\n", my_progname);
fprintf(stdout, "or\n");
fprintf(stdout, " %s [options] timezonefile timezonename\n", my_progname);
fprintf(stdout, "\nA typical place for the system timezone directory is "
"\"%s\"\n", default_timezone_dir);
print_defaults("my",load_default_groups); print_defaults("my",load_default_groups);
puts(""); puts("");
my_print_help(my_long_options); my_print_help(my_long_options);
...@@ -2684,9 +2703,11 @@ get_one_option(int optid, const struct my_option *opt, char *argument) ...@@ -2684,9 +2703,11 @@ get_one_option(int optid, const struct my_option *opt, char *argument)
print_version(); print_version();
puts(""); puts("");
print_usage(); print_usage();
free_allocated_data();
exit(0); exit(0);
case 'V': case 'V':
print_version(); print_version();
free_allocated_data();
exit(0); exit(0);
} }
return 0; return 0;
...@@ -2696,7 +2717,6 @@ get_one_option(int optid, const struct my_option *opt, char *argument) ...@@ -2696,7 +2717,6 @@ get_one_option(int optid, const struct my_option *opt, char *argument)
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
char **default_argv;
MY_INIT(argv[0]); MY_INIT(argv[0]);
load_defaults_or_exit("my", load_default_groups, &argc, &argv); load_defaults_or_exit("my", load_default_groups, &argc, &argv);
...@@ -2708,7 +2728,7 @@ main(int argc, char **argv) ...@@ -2708,7 +2728,7 @@ main(int argc, char **argv)
if ((argc != 1 && argc != 2) || (opt_leap && argc != 1)) if ((argc != 1 && argc != 2) || (opt_leap && argc != 1))
{ {
print_usage(); print_usage();
free_defaults(default_argv); free_allocated_data();
return 1; return 1;
} }
......
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