summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authormonty@narttu.mysql.fi <>2003-08-29 13:44:35 +0300
committermonty@narttu.mysql.fi <>2003-08-29 13:44:35 +0300
commit77a70a0a24ce658a3ee55248cb2e76f84afc1b88 (patch)
treeaeb2314adbd714c7e2b032209bfd7914e3cfda3d /extra
parent6cad89775b4ed78c02c2fa9f3e49181f63b7fb65 (diff)
parent5e04e2370f05bc42437f8be476eba9e204888b65 (diff)
downloadmariadb-git-77a70a0a24ce658a3ee55248cb2e76f84afc1b88.tar.gz
merge with 4.0.15
Diffstat (limited to 'extra')
-rw-r--r--extra/my_print_defaults.c32
-rw-r--r--extra/resolveip.c8
2 files changed, 32 insertions, 8 deletions
diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c
index a5ce489c0fd..e580603bcb8 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}
@@ -54,7 +57,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;
@@ -72,12 +75,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);
@@ -103,7 +112,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]);
@@ -125,13 +134,26 @@ 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)))
+ {
+ if (verbose && opt_defaults_file_used)
+ {
+ if (error == 1)
+ fprintf(stderr, "WARNING: Defaults file '%s' not found!\n",
+ config_file);
+ /* This error is not available now. For the future */
+ if (error == 2)
+ fprintf(stderr, "WARNING: Defaults file '%s' is not a regular file!\n",
+ config_file);
+ }
+ error= 2;
+ }
for (argument= arguments+1 ; *argument ; argument++)
puts(*argument);
my_free((char*) load_default_groups,MYF(0));
free_defaults(arguments);
- exit(0);
+ exit(error);
}
diff --git a/extra/resolveip.c b/extra/resolveip.c
index cef79180720..a9e5f16e576 100644
--- a/extra/resolveip.c
+++ b/extra/resolveip.c
@@ -36,6 +36,10 @@
extern int h_errno;
#endif
+#ifndef HAVE_IN_ADDR_T
+#define in_addr_t u_long
+#endif
+
static my_bool silent;
@@ -91,8 +95,6 @@ static int get_options(int *argc,char ***argv)
{
int ho_error;
- /* load_defaults("my",load_default_groups,argc,argv); */
-
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
@@ -109,7 +111,7 @@ static int get_options(int *argc,char ***argv)
int main(int argc, char **argv)
{
struct hostent *hpaddr;
- u_long taddr;
+ in_addr_t taddr;
char *ip,**q;
int error=0;