33
33
--print-defaults ; Print the modified command line and exit
34
34
****************************************************************************/
38
#include "drizzled/internal/my_sys.h"
39
#include "drizzled/internal/m_string.h"
40
#include "drizzled/charset_info.h"
36
#include "mysys/mysys_priv.h"
37
#include <mystrings/m_string.h>
38
#include <mystrings/m_ctype.h>
41
39
#include <drizzled/configmake.h>
42
40
#include <drizzled/gettext.h>
44
#include "drizzled/cached_directory.h"
46
#ifdef HAVE_SYS_STAT_H
47
# include <sys/stat.h>
42
#include <mysys/cached_directory.h>
51
45
#include <algorithm>
53
47
using namespace std;
60
49
const char *my_defaults_file=0;
61
50
const char *my_defaults_group_suffix=0;
62
51
char *my_defaults_extra_file=0;
324
313
int org_argc= argc, prev_argc= 0;
325
314
*defaults= *extra_defaults= *group_suffix= 0;
327
const std::string DEFAULTS_FILE("--defaults-file=");
328
const std::string DEFAULTS_EXTRA_FILE("--defaults-extra-file=");
329
const std::string DEFAULTS_GROUP_SUFFIX("--defaults-group-suffix=");
331
316
while (argc >= 2 && argc != prev_argc)
333
318
/* Skip program name or previously handled argument */
335
320
prev_argc= argc; /* To check if we found */
336
if (!*defaults && (strncmp(*argv,
337
DEFAULTS_FILE.c_str(),
338
DEFAULTS_FILE.size()) == 0))
321
if (!*defaults && is_prefix(*argv,"--defaults-file="))
340
*defaults= *argv + DEFAULTS_FILE.size();
323
*defaults= *argv + sizeof("--defaults-file=")-1;
344
if (!*extra_defaults && (strncmp(*argv,
345
DEFAULTS_EXTRA_FILE.c_str(),
346
DEFAULTS_EXTRA_FILE.size()) == 0))
327
if (!*extra_defaults && is_prefix(*argv,"--defaults-extra-file="))
348
*extra_defaults= *argv + DEFAULTS_EXTRA_FILE.size();
329
*extra_defaults= *argv + sizeof("--defaults-extra-file=")-1;
352
if (!*group_suffix && (strncmp(*argv,
353
DEFAULTS_GROUP_SUFFIX.c_str(),
354
DEFAULTS_GROUP_SUFFIX.size()) == 0))
333
if (!*group_suffix && is_prefix(*argv, "--defaults-group-suffix="))
357
*group_suffix= *argv + DEFAULTS_GROUP_SUFFIX.size();
335
*group_suffix= *argv + sizeof("--defaults-group-suffix=")-1;
402
380
bool found_print_defaults= 0;
403
381
uint32_t args_used= 0;
407
385
struct handle_option_ctx ctx;
409
387
init_default_directories();
410
init_alloc_root(&alloc,512);
388
init_alloc_root(&alloc,512,0);
412
390
Check if the user doesn't want any default option processing
413
391
--no-defaults is always the first option
480
458
(*argc)+=int(args.elements);
481
459
*argv= static_cast<char**>(res);
482
*(memory::Root*) ptr= alloc; /* Save alloc root for free */
460
*(MEM_ROOT*) ptr= alloc; /* Save alloc root for free */
483
461
delete_dynamic(&args);
484
462
if (found_print_defaults)
957
935
puts("\nThe following options may be given as the first argument:\n\
958
--print-defaults Print the program argument list and exit\n\
959
--no-defaults Don't read default options from any options file\n\
960
--defaults-file=# Only read default options from the given file #\n\
961
--defaults-extra-file=# Read this file after the global files are read");
936
--print-defaults Print the program argument list and exit\n\
937
--no-defaults Don't read default options from any options file\n\
938
--defaults-file=# Only read default options from the given file #\n\
939
--defaults-extra-file=# Read this file after the global files are read");