~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/drizzled.cc

RemovedĀ get_one_option.

Show diffs side-by-side

added added

removed removed

Lines of Context:
174
174
extern "C" int gethostname(char *name, int namelen);
175
175
#endif
176
176
 
177
 
/* Constants */
178
 
static const char *tc_heuristic_recover_names[]=
179
 
{
180
 
  "COMMIT", "ROLLBACK", NULL
181
 
};
182
 
static TYPELIB tc_heuristic_recover_typelib=
183
 
{
184
 
  array_elements(tc_heuristic_recover_names)-1,"",
185
 
  tc_heuristic_recover_names, NULL
186
 
};
187
 
 
188
177
const char *first_keyword= "first";
189
178
const char * const DRIZZLE_CONFIG_NAME= "drizzled";
190
179
#define GET_HA_ROWS GET_ULL
366
355
 
367
356
static void drizzle_init_variables(void);
368
357
static void get_options();
369
 
int drizzled_get_one_option(int, const struct option *, char *);
370
358
static const char *get_relative_path(const char *path);
371
359
static void fix_paths(string progname);
372
360
 
2006
1994
}
2007
1995
 
2008
1996
 
2009
 
int drizzled_get_one_option(int optid, const struct option *opt,
2010
 
                             char *argument)
2011
 
{
2012
 
  switch(optid) {
2013
 
  case 'a':
2014
 
    global_system_variables.tx_isolation= ISO_SERIALIZABLE;
2015
 
    break;
2016
 
  case 'b':
2017
 
    strncpy(drizzle_home,argument,sizeof(drizzle_home)-1);
2018
 
    break;
2019
 
  case 'C':
2020
 
    if (default_collation_name == compiled_default_collation_name)
2021
 
      default_collation_name= 0;
2022
 
    break;
2023
 
  case 'h':
2024
 
    strncpy(data_home_real,argument, sizeof(data_home_real)-1);
2025
 
    /* Correct pointer set by my_getopt (for embedded library) */
2026
 
    data_home= data_home_real;
2027
 
    data_home_len= strlen(data_home);
2028
 
    break;
2029
 
  case 'u':
2030
 
    if (!drizzled_user || !strcmp(drizzled_user, argument))
2031
 
      drizzled_user= argument;
2032
 
    else
2033
 
      errmsg_printf(ERRMSG_LVL_WARN, _("Ignoring user change to '%s' because the user was "
2034
 
                          "set to '%s' earlier on the command line\n"),
2035
 
                        argument, drizzled_user);
2036
 
    break;
2037
 
  case 'L':
2038
 
    strncpy(language, argument, sizeof(language)-1);
2039
 
    break;
2040
 
  case 'V':
2041
 
    print_version();
2042
 
    exit(0);
2043
 
  case 'W':
2044
 
    if (!argument)
2045
 
      global_system_variables.log_warnings++;
2046
 
    else if (argument == disabled_my_option)
2047
 
      global_system_variables.log_warnings= 0L;
2048
 
    else
2049
 
      global_system_variables.log_warnings= atoi(argument);
2050
 
    break;
2051
 
  case 'T':
2052
 
    if (argument)
2053
 
    {
2054
 
      test_flags.set((uint32_t) atoi(argument));
2055
 
    }
2056
 
    break;
2057
 
  case (int) OPT_WANT_CORE:
2058
 
    test_flags.set(TEST_CORE_ON_SIGNAL);
2059
 
    break;
2060
 
  case (int) OPT_SKIP_STACK_TRACE:
2061
 
    test_flags.set(TEST_NO_STACKTRACE);
2062
 
    break;
2063
 
  case (int) OPT_SKIP_SYMLINKS:
2064
 
    internal::my_use_symdir=0;
2065
 
    break;
2066
 
  case (int) OPT_BIND_ADDRESS:
2067
 
    {
2068
 
      struct addrinfo *res_lst, hints;
2069
 
 
2070
 
      memset(&hints, 0, sizeof(struct addrinfo));
2071
 
      hints.ai_socktype= SOCK_STREAM;
2072
 
      hints.ai_protocol= IPPROTO_TCP;
2073
 
 
2074
 
      if (getaddrinfo(argument, NULL, &hints, &res_lst) != 0)
2075
 
      {
2076
 
          errmsg_printf(ERRMSG_LVL_ERROR, _("Can't start server: cannot resolve hostname!"));
2077
 
        return EXIT_ARGUMENT_INVALID;
2078
 
      }
2079
 
 
2080
 
      if (res_lst->ai_next)
2081
 
      {
2082
 
          errmsg_printf(ERRMSG_LVL_ERROR, _("Can't start server: bind-address refers to "
2083
 
                          "multiple interfaces!"));
2084
 
        return EXIT_ARGUMENT_INVALID;
2085
 
      }
2086
 
      freeaddrinfo(res_lst);
2087
 
    }
2088
 
    break;
2089
 
  case (int) OPT_PID_FILE:
2090
 
    strncpy(pidfile_name, argument, sizeof(pidfile_name)-1);
2091
 
    break;
2092
 
  case OPT_SERVER_ID:
2093
 
    break;
2094
 
  case OPT_TX_ISOLATION:
2095
 
    {
2096
 
      int type;
2097
 
      type= find_type_or_exit(argument, &tx_isolation_typelib, opt->name);
2098
 
      global_system_variables.tx_isolation= (type-1);
2099
 
      break;
2100
 
    }
2101
 
  case OPT_TC_HEURISTIC_RECOVER:
2102
 
    tc_heuristic_recover= find_type_or_exit(argument,
2103
 
                                            &tc_heuristic_recover_typelib,
2104
 
                                            opt->name);
2105
 
    break;
2106
 
  }
2107
 
 
2108
 
  return 0;
2109
 
}
2110
 
 
2111
 
 
2112
1997
/**
2113
1998
  @todo
2114
1999
  - FIXME add EXIT_TOO_MANY_ARGUMENTS to "drizzled/error.h" and return that code?