Commit 297be710 authored by monty@mysql.com's avatar monty@mysql.com

Merge mysql.com:/home/my/mysql-4.0 into mysql.com:/home/my/mysql-4.1

parents b32fd186 6cd8de36
...@@ -67,6 +67,7 @@ void check_data_vol(); ...@@ -67,6 +67,7 @@ void check_data_vol();
void check_setup(); void check_setup();
void check_tables(); void check_tables();
void mysql_start(int, char*[]); void mysql_start(int, char*[]);
void parse_setvar(char *arg);
/****************************************************************************** /******************************************************************************
...@@ -321,7 +322,8 @@ void parse_args(int argc, char *argv[]) ...@@ -321,7 +322,8 @@ void parse_args(int argc, char *argv[])
OPT_ERR_LOG, OPT_ERR_LOG,
OPT_SAFE_LOG, OPT_SAFE_LOG,
OPT_MYSQLD, OPT_MYSQLD,
OPT_HELP OPT_HELP,
OPT_SETVAR
}; };
static struct option options[] = static struct option options[] =
...@@ -337,6 +339,7 @@ void parse_args(int argc, char *argv[]) ...@@ -337,6 +339,7 @@ void parse_args(int argc, char *argv[])
{"safe-log", required_argument, 0, OPT_SAFE_LOG}, {"safe-log", required_argument, 0, OPT_SAFE_LOG},
{"mysqld", required_argument, 0, OPT_MYSQLD}, {"mysqld", required_argument, 0, OPT_MYSQLD},
{"help", no_argument, 0, OPT_HELP}, {"help", no_argument, 0, OPT_HELP},
{"set-variable", required_argument, 0, OPT_SETVAR},
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
...@@ -384,7 +387,11 @@ void parse_args(int argc, char *argv[]) ...@@ -384,7 +387,11 @@ void parse_args(int argc, char *argv[])
case OPT_MYSQLD: case OPT_MYSQLD:
strcpy(mysqld, optarg); strcpy(mysqld, optarg);
break; break;
case OPT_SETVAR:
parse_setvar(optarg);
break;
case OPT_HELP: case OPT_HELP:
usage(); usage();
break; break;
...@@ -396,6 +403,25 @@ void parse_args(int argc, char *argv[]) ...@@ -396,6 +403,25 @@ void parse_args(int argc, char *argv[])
} }
} }
/*
parse_setvar(char *arg)
Pasrsing for port just to display the port num on the mysqld_safe screen
*/
void parse_setvar(char *arg)
{
char *pos;
if ((pos= strindex(arg, "port")))
{
for (; *pos && *pos != '='; pos++) ;
if (*pos)
strcpy(port, pos + 1);
}
}
/******************************************************************************
/****************************************************************************** /******************************************************************************
get_options() get_options()
...@@ -599,32 +625,32 @@ void check_tables() ...@@ -599,32 +625,32 @@ void check_tables()
******************************************************************************/ ******************************************************************************/
void mysql_start(int argc, char *argv[]) void mysql_start(int argc, char *argv[])
{ {
arg_list_t al; arg_list_t al;
int i, j, err; int i, j, err;
struct stat info; struct stat info;
time_t cal; time_t cal;
struct tm lt; struct tm lt;
char stamp[PATH_MAX]; char stamp[PATH_MAX];
char skip; char skip;
// private options // private options
static char *private_options[] = static char *private_options[] =
{ {
"--autoclose", "--autoclose",
"--check-tables", "--check-tables",
"--help", "--help",
"--err-log=", "--err-log=",
"--mysqld=", "--mysqld=",
NULL NULL
}; };
// args // args
init_args(&al); init_args(&al);
add_arg(&al, "%s", mysqld); add_arg(&al, "%s", mysqld);
// parent args // parent args
for(i = 1; i < argc; i++) for(i = 1; i < argc; i++)
{ {
skip = FALSE; skip = FALSE;
// skip private arguments // skip private arguments
...@@ -633,38 +659,42 @@ void mysql_start(int argc, char *argv[]) ...@@ -633,38 +659,42 @@ void mysql_start(int argc, char *argv[])
if(!strnicmp(argv[i], private_options[j], strlen(private_options[j]))) if(!strnicmp(argv[i], private_options[j], strlen(private_options[j])))
{ {
skip = TRUE; skip = TRUE;
consoleprintf("The argument skipped is %s\n",argv[i]);
break; break;
} }
} }
if (!skip) add_arg(&al, "%s", argv[i]); if (!skip)
} {
add_arg(&al, "%s", argv[i]);
consoleprintf("The final argument is %s\n",argv[i]);
}
}
// spawn // spawn
do do
{ {
// check the database tables // check the database tables
if (checktables) check_tables(); if (checktables) check_tables();
// status // status
time(&cal); time(&cal);
localtime_r(&cal, &lt); localtime_r(&cal, &lt);
strftime(stamp, PATH_MAX, "%d %b %Y %H:%M:%S", &lt); strftime(stamp, PATH_MAX, "%d %b %Y %H:%M:%S", &lt);
log("mysql started : %s\n", stamp); log("mysql started : %s\n", stamp);
// spawn mysqld // spawn mysqld
spawn(mysqld, &al, TRUE, NULL, NULL, err_log); spawn(mysqld, &al, TRUE, NULL, NULL, err_log);
} }
while (!stat(pid_file, &info)); while (!stat(pid_file, &info));
// status // status
time(&cal); time(&cal);
localtime_r(&cal, &lt); localtime_r(&cal, &lt);
strftime(stamp, PATH_MAX, "%d %b %Y %H:%M:%S", &lt); strftime(stamp, PATH_MAX, "%d %b %Y %H:%M:%S", &lt);
log("mysql stopped : %s\n\n", stamp); log("mysql stopped : %s\n\n", stamp);
// free args // free args
free_args(&al); free_args(&al);
} }
/****************************************************************************** /******************************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment