MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / get_defaults_options

Function get_defaults_options

mysys_ssl/my_default.cc:498–550  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

496*/
497
498int get_defaults_options(int argc, char **argv,
499 char **defaults,
500 char **extra_defaults,
501 char **group_suffix,
502 char **login_path)
503{
504 int org_argc= argc, prev_argc= 0, default_option_count= 0;
505 *defaults= *extra_defaults= *group_suffix= *login_path= 0;
506
507 while (argc >= 2 && argc != prev_argc)
508 {
509 /* Skip program name or previously handled argument */
510 argv++;
511 prev_argc= argc; /* To check if we found */
512 /* --no-defaults is always the first option. */
513 if (is_prefix(*argv,"--no-defaults") && ! default_option_count)
514 {
515 argc--;
516 default_option_count ++;
517 continue;
518 }
519 if (!*defaults && is_prefix(*argv, "--defaults-file=") && ! found_no_defaults)
520 {
521 *defaults= *argv + sizeof("--defaults-file=")-1;
522 argc--;
523 default_option_count ++;
524 continue;
525 }
526 if (!*extra_defaults && is_prefix(*argv, "--defaults-extra-file=")
527 && ! found_no_defaults)
528 {
529 *extra_defaults= *argv + sizeof("--defaults-extra-file=")-1;
530 argc--;
531 default_option_count ++;
532 continue;
533 }
534 if (!*group_suffix && is_prefix(*argv, "--defaults-group-suffix="))
535 {
536 *group_suffix= *argv + sizeof("--defaults-group-suffix=")-1;
537 argc--;
538 default_option_count ++;
539 continue;
540 }
541 if (!*login_path && is_prefix(*argv, "--login-path="))
542 {
543 *login_path= *argv + sizeof("--login-path=")-1;
544 argc--;
545 default_option_count ++;
546 continue;
547 }
548 }
549 return org_argc - argc;
550}
551
552/*
553 Wrapper around my_load_defaults() for interface compatibility.

Callers 2

my_search_option_filesFunction · 0.85
mainFunction · 0.85

Calls 1

is_prefixFunction · 0.85

Tested by

no test coverage detected