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
2d44d93c
Commit
2d44d93c
authored
May 02, 2005
by
jimw@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/jimw/my/mysql-5.0-5354
into mysql.com:/home/jimw/my/mysql-5.0-clean
parents
7bab94f3
2441da8c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
41 deletions
+61
-41
extra/my_print_defaults.c
extra/my_print_defaults.c
+1
-0
include/my_sys.h
include/my_sys.h
+1
-0
mysys/default.c
mysys/default.c
+59
-41
No files found.
extra/my_print_defaults.c
View file @
2d44d93c
...
...
@@ -76,6 +76,7 @@ static void usage(my_bool version)
puts
(
"Prints all arguments that is give to some program using the default files"
);
printf
(
"Usage: %s [OPTIONS] groups
\n
"
,
my_progname
);
my_print_help
(
my_long_options
);
my_print_default_files
(
config_file
);
my_print_variables
(
my_long_options
);
printf
(
"
\n
Example usage:
\n
%s --config-file=my client mysql
\n
"
,
my_progname
);
}
...
...
include/my_sys.h
View file @
2d44d93c
...
...
@@ -782,6 +782,7 @@ extern int my_search_option_files(const char *conf_file, int *argc,
char
***
argv
,
uint
*
args_used
,
Process_option_func
func
,
void
*
func_ctx
);
extern
void
free_defaults
(
char
**
argv
);
extern
void
my_print_default_files
(
const
char
*
conf_file
);
extern
void
print_defaults
(
const
char
*
conf_file
,
const
char
**
groups
);
extern
my_bool
my_compress
(
byte
*
,
ulong
*
,
ulong
*
);
extern
my_bool
my_uncompress
(
byte
*
,
ulong
*
,
ulong
*
);
...
...
mysys/default.c
View file @
2d44d93c
...
...
@@ -45,11 +45,12 @@ char *defaults_extra_file=0;
/* Which directories are searched for options (and in which order) */
#define MAX_DEFAULT_DIRS
4
#define MAX_DEFAULT_DIRS
5
const
char
*
default_directories
[
MAX_DEFAULT_DIRS
+
1
];
#ifdef __WIN__
static
const
char
*
f_extensions
[]
=
{
".ini"
,
".cnf"
,
0
};
static
char
system_dir
[
FN_REFLEN
],
shared_system_dir
[
FN_REFLEN
];
#else
static
const
char
*
f_extensions
[]
=
{
".cnf"
,
0
};
#endif
...
...
@@ -141,20 +142,6 @@ int my_search_option_files(const char *conf_file, int *argc, char ***argv,
}
else
{
#ifdef __WIN__
char
system_dir
[
FN_REFLEN
];
GetWindowsDirectory
(
system_dir
,
sizeof
(
system_dir
));
if
((
search_default_file
(
func
,
func_ctx
,
system_dir
,
conf_file
)))
goto
err
;
#endif
#if defined(__EMX__) || defined(OS2)
{
const
char
*
etc
;
if
((
etc
=
getenv
(
"ETC"
))
&&
(
search_default_file
(
func
,
func_ctx
,
etc
,
conf_file
))
<
0
)
goto
err
;
}
#endif
for
(
dirs
=
default_directories
;
*
dirs
;
dirs
++
)
{
if
(
**
dirs
)
...
...
@@ -397,8 +384,11 @@ static int search_default_file(Process_option_func opt_handler,
const
char
*
config_file
)
{
char
**
ext
;
const
char
*
empty_list
[]
=
{
""
,
0
};
my_bool
have_ext
=
fn_ext
(
config_file
)[
0
]
!=
0
;
const
char
**
exts_to_use
=
have_ext
?
empty_list
:
f_extensions
;
for
(
ext
=
(
char
**
)
f_extensions
;
*
ext
;
*
ext
++
)
for
(
ext
=
(
char
**
)
exts_to_use
;
*
ext
;
*
ext
++
)
{
int
error
;
if
((
error
=
search_default_file_with_ext
(
opt_handler
,
handler_ctx
,
...
...
@@ -756,11 +746,11 @@ static char *remove_end_comment(char *ptr)
#include <help_start.h>
void
print_defaults
(
const
char
*
conf_file
,
const
char
**
groups
)
void
my_print_default_files
(
const
char
*
conf_file
)
{
#ifdef __WIN__
const
char
*
empty_list
[]
=
{
""
,
0
};
my_bool
have_ext
=
fn_ext
(
conf_file
)[
0
]
!=
0
;
#endif
const
char
**
exts_to_use
=
have_ext
?
empty_list
:
f_extensions
;
char
name
[
FN_REFLEN
],
**
ext
;
const
char
**
dirs
;
...
...
@@ -771,30 +761,9 @@ void print_defaults(const char *conf_file, const char **groups)
fputs
(
conf_file
,
stdout
);
else
{
#ifdef __WIN__
GetWindowsDirectory
(
name
,
sizeof
(
name
));
if
(
!
have_ext
)
{
for
(
ext
=
(
char
**
)
f_extensions
;
*
ext
;
*
ext
++
)
printf
(
"%s
\\
%s%s "
,
name
,
conf_file
,
*
ext
);
}
else
printf
(
"%s
\\
%s "
,
name
,
conf_file
);
#endif
#if defined(__EMX__) || defined(OS2)
{
const
char
*
etc
;
if
((
etc
=
getenv
(
"ETC"
)))
{
for
(
ext
=
(
char
**
)
f_extensions
;
*
ext
;
*
ext
++
)
printf
(
"%s
\\
%s%s "
,
etc
,
conf_file
,
*
ext
);
}
}
#endif
for
(
dirs
=
default_directories
;
*
dirs
;
dirs
++
)
{
for
(
ext
=
(
char
**
)
f_extensions
;
*
ext
;
*
ext
++
)
for
(
ext
=
(
char
**
)
exts_to_use
;
*
ext
;
*
ext
++
)
{
const
char
*
pos
;
char
*
end
;
...
...
@@ -813,6 +782,12 @@ void print_defaults(const char *conf_file, const char **groups)
}
puts
(
""
);
}
}
void
print_defaults
(
const
char
*
conf_file
,
const
char
**
groups
)
{
my_print_default_files
(
conf_file
);
fputs
(
"The following groups are read:"
,
stdout
);
for
(
;
*
groups
;
groups
++
)
{
...
...
@@ -828,15 +803,58 @@ void print_defaults(const char *conf_file, const char **groups)
#include <help_end.h>
/*
Create the list of default directories.
On Microsoft Windows, this is:
1. C:/
2. GetWindowsDirectory()
3. GetSystemWindowsDirectory()
4. getenv(DEFAULT_HOME_ENV)
5. ""
On Novell NetWare, this is:
1. sys:/etc/
2. getenv(DEFAULT_HOME_ENV)
3. ""
On OS/2, this is:
1. getenv(ETC)
2. /etc/
3. getenv(DEFAULT_HOME_ENV)
4. ""
5. "~/"
Everywhere else, this is:
1. /etc/
2. getenv(DEFAULT_HOME_ENV)
3. ""
4. "~/"
*/
static
void
init_default_directories
()
{
const
char
*
env
,
**
ptr
=
default_directories
;
#ifdef __WIN__
*
ptr
++=
"C:/"
;
if
(
GetWindowsDirectory
(
system_dir
,
sizeof
(
system_dir
)))
*
ptr
++=
&
system_dir
;
/* Only add shared system directory if different from default. */
if
(
GetSystemWindowsDirectory
(
shared_system_dir
,
sizeof
(
shared_system_dir
))
&&
strcmp
(
system_dir
,
shared_system_dir
))
*
ptr
++=
&
shared_system_dir
;
#elif defined(__NETWARE__)
*
ptr
++=
"sys:/etc/"
;
#else
#if defined(__EMX__) || defined(OS2)
if
((
env
=
getenv
(
"ETC"
)))
*
ptr
++=
env
;
#endif
*
ptr
++=
"/etc/"
;
#endif
if
((
env
=
getenv
(
STRINGIFY_ARG
(
DEFAULT_HOME_ENV
))))
...
...
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