1405
1400
if (opt_help || opt_help_extended)
1406
1401
unireg_abort(0);
1408
po::parsed_options parsed= po::command_line_parser(defaults_argc,
1410
options(long_options).extra_parser(parse_size_arg).
1403
po::parsed_options parsed= po::command_line_parser(unknown_options).
1404
options(plugin_options).extra_parser(parse_size_arg).
1411
1405
allow_unregistered().run();
1413
vector<string> unknown_options=
1407
vector<string> final_unknown_options=
1414
1408
po::collect_unrecognized(parsed.options, po::include_positional);
1416
1410
/* we do want to exit if there are any other unknown options */
1417
1411
/** @TODO: We should perhaps remove allowed_unregistered() and catch the
1418
1412
exception here */
1419
if (unknown_options.size() > 0)
1413
if (final_unknown_options.size() > 0)
1421
1415
errmsg_printf(ERRMSG_LVL_ERROR,
1422
_("%s: Unknown options give (first unknown is '%s').\n"
1423
"Use --verbose --help to get a list of available options\n"),
1416
_("%s: Unknown options given (first unknown is '%s').\n"
1417
"Use --help to get a list of available options\n"),
1424
1418
internal::my_progname, unknown_options[0].c_str());
1425
1419
unireg_abort(1);
2118
static void option_error_reporter(enum loglevel level, const char *format, ...)
2121
va_start(args, format);
2123
/* Don't print warnings for --loose options during bootstrap */
2124
if (level == ERROR_LEVEL || global_system_variables.log_warnings)
2126
plugin::ErrorMessage::vprintf(NULL, ERROR_LEVEL, format, args);
2134
2114
- FIXME add EXIT_TOO_MANY_ARGUMENTS to "drizzled/error.h" and return that code?
2136
static void get_options(int *argc,char **argv)
2116
static void get_options()
2140
my_getopt_error_reporter= option_error_reporter;
2119
if (vm.count("base-dir"))
2121
strncpy(drizzle_home,vm["base-dir"].as<string>().c_str(),sizeof(drizzle_home)-1);
2124
if (vm.count("datadir"))
2126
cout << "In datadir" << endl;
2127
strncpy(data_home_real,vm["datadir"].as<string>().c_str(), sizeof(data_home_real)-1);
2128
/* Correct pointer set by my_getopt (for embedded library) */
2129
data_home= data_home_real;
2130
data_home_len= strlen(data_home);
2133
if (vm.count("user"))
2135
if (! drizzled_user || ! strcmp(drizzled_user, vm["user"].as<string>().c_str()))
2136
drizzled_user= (char *)vm["user"].as<string>().c_str();
2139
errmsg_printf(ERRMSG_LVL_WARN, _("Ignoring user change to '%s' because the user was "
2140
"set to '%s' earlier on the command line\n"),
2141
vm["user"].as<string>().c_str(), drizzled_user);
2144
if (vm.count("language"))
2146
strncpy(language, vm["language"].as<string>().c_str(), sizeof(language)-1);
2149
if (vm.count("version"))
2155
if (vm.count("log-warnings"))
2157
if (vm["log-warnings"].as<string>().empty())
2158
global_system_variables.log_warnings++;
2159
else if (vm["log-warnings"].as<string>().compare("0"))
2160
global_system_variables.log_warnings= 0L;
2162
global_system_variables.log_warnings= atoi(vm["log-warnings"].as<string>().c_str());
2165
if (vm.count("exit-info"))
2167
if (vm["exit-info"].as<long>())
2169
test_flags.set((uint32_t) vm["exit-info"].as<long>());
2173
if (vm.count("want-core"))
2175
test_flags.set(TEST_CORE_ON_SIGNAL);
2178
if (vm.count("skip-stack-trace"))
2180
test_flags.set(TEST_NO_STACKTRACE);
2183
if (vm.count("skip-symlinks"))
2185
internal::my_use_symdir=0;
2188
if (vm.count("pid-file"))
2190
strncpy(pidfile_name, vm["pid-file"].as<string>().c_str(), sizeof(pidfile_name)-1);
2193
if (vm.count("transaction-isolation"))
2196
type= find_type_or_exit((char *)vm["transaction-isolation"].as<string>().c_str(), &tx_isolation_typelib, "transaction-isolation");
2197
global_system_variables.tx_isolation= (type-1);
2142
2201
/* Skip unknown options so that they may be processed later by plugins */
2143
2202
my_getopt_skip_unknown= true;
2145
if ((ho_error= handle_options(argc, &argv, my_long_options,
2146
drizzled_get_one_option)))
2148
(*argc)++; /* add back one for the progname handle_options removes */
2149
/* no need to do this for argv as we are discarding it. */
2151
2205
#if defined(HAVE_BROKEN_REALPATH)
2152
2206
internal::my_use_symdir=0;