From 0f88392dae045cbc355808469de12301e66afef5 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 10 Mar 2003 18:32:38 -0500 Subject: novell40c.patch netware/mysqld_safe.c: Import patch novell40c.patch --- netware/mysqld_safe.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) (limited to 'netware') diff --git a/netware/mysqld_safe.c b/netware/mysqld_safe.c index 59c40eb61e6..1ab90775e02 100644 --- a/netware/mysqld_safe.c +++ b/netware/mysqld_safe.c @@ -36,6 +36,7 @@ ******************************************************************************/ char autoclose; char basedir[PATH_MAX]; +char checktables; char datadir[PATH_MAX]; char pid_file[PATH_MAX]; char address[PATH_MAX]; @@ -54,6 +55,7 @@ FILE *log_fd = NULL; ******************************************************************************/ +void usage(void); void vlog(char *, va_list); void log(char *, ...); void start_defaults(int, char*[]); @@ -74,6 +76,42 @@ void mysql_start(int, char*[]); /****************************************************************************** + usage() + + Show usage. + +******************************************************************************/ +void usage(void) +{ + // keep the screen up + setscreenmode(SCR_NO_MODE); + + puts("\ +\n\ +usage: mysqld_safe [options]\n\ +\n\ +Program to start the MySQL daemon and restart it if it dies unexpectedly.\n\ +All options, besides those listed below, are passed on to the MySQL daemon.\n\ +\n\ +options:\n\ +\n\ +--autoclose Automatically close the mysqld_safe screen.\n\ +\n\ +--check-tables Check the tables before starting the MySQL daemon.\n\ +\n\ +--err-log= Send the MySQL daemon error output to .\n\ +\n\ +--help Show this help information.\n\ +\n\ +--mysqld= Use the MySQL daemon.\n\ +\n\ + "); + + exit(-1); +} + +/****************************************************************************** + vlog() Log the message. @@ -136,6 +174,9 @@ void start_defaults(int argc, char *argv[]) // basedir get_basedir(argv[0], basedir); + // check-tables + checktables = FALSE; + // hostname if (gethostname(hostname,PATH_MAX) < 0) { @@ -279,13 +320,15 @@ void parse_args(int argc, char *argv[]) OPT_PORT, OPT_ERR_LOG, OPT_SAFE_LOG, - OPT_MYSQLD + OPT_MYSQLD, + OPT_HELP }; static struct option options[] = { {"autoclose", no_argument, &autoclose, TRUE}, {"basedir", required_argument, 0, OPT_BASEDIR}, + {"check-tables", no_argument, &checktables, TRUE}, {"datadir", required_argument, 0, OPT_DATADIR}, {"pid-file", required_argument, 0, OPT_PID_FILE}, {"bind-address", required_argument, 0, OPT_BIND_ADDRESS}, @@ -293,6 +336,7 @@ void parse_args(int argc, char *argv[]) {"err-log", required_argument, 0, OPT_ERR_LOG}, {"safe-log", required_argument, 0, OPT_SAFE_LOG}, {"mysqld", required_argument, 0, OPT_MYSQLD}, + {"help", no_argument, 0, OPT_HELP}, {0, 0, 0, 0} }; @@ -341,6 +385,10 @@ void parse_args(int argc, char *argv[]) strcpy(mysqld, optarg); break; + case OPT_HELP: + usage(); + break; + default: // ignore break; @@ -563,6 +611,8 @@ void mysql_start(int argc, char *argv[]) static char *private_options[] = { "--autoclose", + "--check-tables", + "--help", "--err-log=", "--mysqld=", NULL @@ -594,7 +644,7 @@ void mysql_start(int argc, char *argv[]) do { // check the database tables - check_tables(); + if (checktables) check_tables(); // status time(&cal); -- cgit v1.2.1