Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
5e4ce743
Commit
5e4ce743
authored
Jun 13, 2005
by
joreland@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/jonas/src/wl1882
into mysql.com:/home/jonas/src/mysql-5.0-ndb
parents
920755dc
5be3eecc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
1 deletion
+60
-1
include/my_sys.h
include/my_sys.h
+1
-0
mysys/default.c
mysys/default.c
+59
-1
No files found.
include/my_sys.h
View file @
5e4ce743
...
...
@@ -263,6 +263,7 @@ extern my_bool NEAR my_disable_locking,NEAR my_disable_async_io,
extern
char
wild_many
,
wild_one
,
wild_prefix
;
extern
const
char
*
charsets_dir
;
extern
char
*
defaults_extra_file
;
extern
const
char
*
defaults_instance
;
extern
my_bool
timed_mutexes
;
...
...
mysys/default.c
View file @
5e4ce743
...
...
@@ -31,6 +31,7 @@
--defaults-file=full-path-to-default-file ; Only this file will be read.
--defaults-extra-file=full-path-to-default-file ; Read this file before ~/
--print-defaults ; Print the modified command line and exit
--instance ; also read groups with concat(group, instance)
****************************************************************************/
#include "mysys_priv.h"
...
...
@@ -41,6 +42,8 @@
#include <winbase.h>
#endif
const
char
*
defaults_instance
=
0
;
static
const
char
instance_option
[]
=
"--instance="
;
char
*
defaults_extra_file
=
0
;
/* Which directories are searched for options (and in which order) */
...
...
@@ -115,7 +118,7 @@ int my_search_option_files(const char *conf_file, int *argc, char ***argv,
DBUG_ENTER
(
"my_search_option_files"
);
/* Check if we want to force the use a specific default file */
get_defaults_files
(
*
argc
,
*
argv
,
get_defaults_files
(
*
argc
-
*
args_used
,
*
argv
+
*
args_used
,
(
char
**
)
&
forced_default_file
,
(
char
**
)
&
forced_extra_defaults
);
if
(
forced_default_file
)
...
...
@@ -325,6 +328,49 @@ int load_defaults(const char *conf_file, const char **groups,
ctx
.
args
=
&
args
;
ctx
.
group
=
&
group
;
if
(
*
argc
>=
2
+
args_used
&&
is_prefix
(
argv
[
0
][
1
+
args_used
],
instance_option
))
{
args_used
++
;
defaults_instance
=
argv
[
0
][
args_used
]
+
sizeof
(
instance_option
)
-
1
;
}
else
{
defaults_instance
=
getenv
(
"MYSQL_INSTANCE"
);
}
if
(
defaults_instance
)
{
/** Handle --instance= */
uint
i
,
len
;
const
char
**
extra_groups
;
const
uint
instance_len
=
strlen
(
defaults_instance
);
if
(
!
(
extra_groups
=
(
const
char
**
)
alloc_root
(
&
alloc
,
(
2
*
group
.
count
+
1
)
*
sizeof
(
char
*
))))
goto
err
;
for
(
i
=
0
;
i
<
group
.
count
;
i
++
)
{
extra_groups
[
i
]
=
group
.
type_names
[
i
];
/** copy group */
len
=
strlen
(
extra_groups
[
i
]);
if
(
!
(
ptr
=
alloc_root
(
&
alloc
,
len
+
instance_len
+
1
)))
goto
err
;
extra_groups
[
i
+
group
.
count
]
=
ptr
;
/** Construct new group */
memcpy
(
ptr
,
extra_groups
[
i
],
len
);
ptr
+=
len
;
memcpy
(
ptr
,
defaults_instance
,
instance_len
+
1
);
}
group
.
count
*=
2
;
group
.
type_names
=
extra_groups
;
group
.
type_names
[
group
.
count
]
=
0
;
}
error
=
my_search_option_files
(
conf_file
,
argc
,
argv
,
&
args_used
,
handle_default_option
,
(
void
*
)
&
ctx
);
/*
...
...
@@ -794,6 +840,7 @@ void my_print_default_files(const char *conf_file)
void
print_defaults
(
const
char
*
conf_file
,
const
char
**
groups
)
{
const
char
**
groups_save
=
groups
;
my_print_default_files
(
conf_file
);
fputs
(
"The following groups are read:"
,
stdout
);
...
...
@@ -802,6 +849,17 @@ void print_defaults(const char *conf_file, const char **groups)
fputc
(
' '
,
stdout
);
fputs
(
*
groups
,
stdout
);
}
if
(
defaults_instance
)
{
groups
=
groups_save
;
for
(
;
*
groups
;
groups
++
)
{
fputc
(
' '
,
stdout
);
fputs
(
*
groups
,
stdout
);
fputs
(
defaults_instance
,
stdout
);
}
}
puts
(
"
\n
The following options may be given as the first argument:
\n
\
--print-defaults Print the program argument list and exit
\n
\
--no-defaults Don't read default options from any options file
\n
\
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment