summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2003-08-27 22:13:26 +0300
committerunknown <monty@narttu.mysql.fi>2003-08-27 22:13:26 +0300
commitad4fdb79cd4c6f06a1a09e0ded07cb7e8c76f07c (patch)
treec9fde96b759a6ffda7cc40b971132c4a94f66f7b /extra
parentc637296ceaf315d66011d0eeeae4765294fff060 (diff)
parent9d64b924c992ba06209350d4837ff3b7c2bc136e (diff)
downloadmariadb-git-ad4fdb79cd4c6f06a1a09e0ded07cb7e8c76f07c.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-4.0
into narttu.mysql.fi:/my/mysql-4.0
Diffstat (limited to 'extra')
-rw-r--r--extra/my_print_defaults.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c
index c0f8a54f432..549b2124b55 100644
--- a/extra/my_print_defaults.c
+++ b/extra/my_print_defaults.c
@@ -26,6 +26,7 @@
#include <my_getopt.h>
const char *config_file="my"; /* Default config file */
+uint verbose= 0, opt_defaults_file_used= 0;
static struct my_option my_long_options[] =
{
@@ -47,6 +48,8 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help message and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"verbose", 'v', "Increase the output level",
+ 0, 0, GET_NO_ARG, 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},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
@@ -55,7 +58,7 @@ static struct my_option my_long_options[] =
static void usage(my_bool version)
{
- printf("%s Ver 1.5 for %s at %s\n",my_progname,SYSTEM_TYPE,
+ printf("%s Ver 1.6 for %s at %s\n",my_progname,SYSTEM_TYPE,
MACHINE_TYPE);
if (version)
return;
@@ -73,12 +76,18 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument __attribute__((unused)))
{
switch (optid) {
+ case 'c':
+ opt_defaults_file_used= 1;
+ break;
case 'n':
exit(0);
case 'I':
case '?':
usage(0);
exit(0);
+ case 'v':
+ verbose++;
+ break;
case 'V':
usage(1);
exit(0);
@@ -104,7 +113,7 @@ static int get_options(int *argc,char ***argv)
int main(int argc, char **argv)
{
- int count;
+ int count, error;
char **load_default_groups, *tmp_arguments[2],
**argument, **arguments;
MY_INIT(argv[0]);
@@ -126,8 +135,20 @@ int main(int argc, char **argv)
arguments=tmp_arguments;
arguments[0]=my_progname;
arguments[1]=0;
- load_defaults(config_file, (const char **) load_default_groups,
- &count, &arguments);
+ if ((error= load_defaults(config_file, (const char **) load_default_groups,
+ &count, &arguments)) > 1)
+ {
+ if (verbose && opt_defaults_file_used)
+ {
+ if (error == 2)
+ fprintf(stderr, "WARNING: Defaults file (%s) not found!\n",
+ config_file);
+ if (error == 3)
+ fprintf(stderr, "WARNING: Defaults file (%s) is not a regular file!\n",
+ config_file);
+ }
+ exit(2); // Non-fatal error
+ }
for (argument= arguments+1 ; *argument ; argument++)
puts(*argument);