1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +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

@@ -204,8 +204,9 @@ static struct my_option my_long_options[] =
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", &host, &host, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host. Defaults in the following order: "
"$MARIADB_HOST, and then localhost",
&host, &host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"status", 'i', "Shows a lot of extra information about each table.",
&opt_status, &opt_status, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
@@ -363,6 +364,9 @@ get_options(int *argc,char ***argv)
{
int ho_error;
if (host == NULL)
host= getenv("MARIADB_HOST");
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);