1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

[MDEV-14978] Client programs to use $MARIADB_HOST consistently

Only `mysql` client program was using $MYSQL_HOST as the default host.
Add the same feature in most other client programs but using
$MARIADB_HOST instead.

All new code of the whole pull request, including one or several files that are
either new files or modified ones, are contributed under the BSD-new license. I
am contributing on behalf of my employer Amazon Web Services, Inc.
This commit is contained in:
Ocean Li
2024-07-15 18:54:55 +00:00
committed by Andrew Hutchings
parent 383d1f90dd
commit eedbb901e5
11 changed files with 152 additions and 17 deletions

View File

@@ -1485,8 +1485,9 @@ static struct my_option my_options[] =
{"hexdump", 'H', "Augment output with hexadecimal and ASCII event dump.",
&opt_hexdump, &opt_hexdump, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"host", 'h', "Get the binlog from server.", &host, &host,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Get the binlog from server. Defaults in the following order: "
"$MARIADB_HOST, and then localhost",
&host, &host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"local-load", 'l', "Prepare local temporary files for LOAD DATA INFILE in the specified directory.",
&dirname_for_local_load, &dirname_for_local_load, 0,
GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -2265,6 +2266,11 @@ get_one_option(const struct my_option *opt, const char *argument,
static int parse_args(int *argc, char*** argv)
{
int ho_error;
char *tmp;
tmp= getenv("MARIADB_HOST");
if (tmp && host == NULL)
host= my_strdup(PSI_NOT_INSTRUMENTED, tmp, MYF(MY_WME));
if ((ho_error=handle_options(argc, argv, my_options, get_one_option)))
{