diff options
author | Monty <monty@mariadb.org> | 2022-01-11 14:41:37 +0200 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2022-01-20 15:14:59 +0200 |
commit | d3143ef8a8655975a00d6333823a820cb72c195d (patch) | |
tree | 6ec734ec8fbf7636023f0f64afae16059863c158 /sql | |
parent | 9d4c0a6cabc67dca6a5044ef7ae82e4198a8aab4 (diff) | |
download | mariadb-git-d3143ef8a8655975a00d6333823a820cb72c195d.tar.gz |
Improve --help and remove not-free warnings for mysql_tzinfo_to_sql
Diffstat (limited to 'sql')
-rw-r--r-- | sql/tztime.cc | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/sql/tztime.cc b/sql/tztime.cc index 067348dccab..47bc44f3386 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -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, 0, 0, 0, 0, 0, 0}, #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}, #else {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #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}, - {"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}, {"version", 'V', "Output version information and exit.", 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}, { 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 static my_bool get_one_option(int optid, const struct my_option *, char *argument); @@ -2659,11 +2668,21 @@ static void print_version(void) MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE); } +static const char *default_timezone_dir= "/usr/share/zoneinfo/"; + + static void print_usage(void) { - fprintf(stderr, "Usage:\n"); - fprintf(stderr, " %s [options] timezonedir\n", my_progname); - fprintf(stderr, " %s [options] timezonefile timezonename\n", my_progname); + fprintf(stdout, "Create SQL commands for loading system timezeone data for " + "MariaDB\n\n"); + 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); puts(""); my_print_help(my_long_options); @@ -2684,9 +2703,11 @@ get_one_option(int optid, const struct my_option *opt, char *argument) print_version(); puts(""); print_usage(); + free_allocated_data(); exit(0); case 'V': print_version(); + free_allocated_data(); exit(0); } return 0; @@ -2696,7 +2717,6 @@ get_one_option(int optid, const struct my_option *opt, char *argument) int main(int argc, char **argv) { - char **default_argv; MY_INIT(argv[0]); load_defaults_or_exit("my", load_default_groups, &argc, &argv); @@ -2708,7 +2728,7 @@ main(int argc, char **argv) if ((argc != 1 && argc != 2) || (opt_leap && argc != 1)) { print_usage(); - free_defaults(default_argv); + free_allocated_data(); return 1; } |