options.cc File Reference

#include "options.h"
#include "priv.h"
#include <my_sys.h>
#include <my_getopt.h>
#include <m_string.h>
#include <mysql_com.h>

Go to the source code of this file.

Defines

#define QUOTE(x)   QUOTE2(x)
#define QUOTE2(x)   #x

Enumerations

enum  options {
  OPT_LOG = 256, OPT_PID_FILE, OPT_SOCKET, OPT_PASSWORD_FILE,
  OPT_MYSQLD_PATH, OPT_RUN_AS_SERVICE, OPT_USER, OPT_MONITORING_INTERVAL,
  OPT_PORT, OPT_BIND_ADDRESS
}

Functions

static C_MODE_START my_bool get_one_option (int optid, const struct my_option *opt __attribute__((unused)), char *argument __attribute__((unused)))
static void passwd ()
static void usage ()
static void version ()

Variables

static const char * default_groups [] = { "manager", 0 }
static struct my_option my_long_options []


Define Documentation

#define QUOTE x   )     QUOTE2(x)
 

Definition at line 31 of file options.cc.

#define QUOTE2 x   )     #x
 

Definition at line 30 of file options.cc.


Enumeration Type Documentation

enum options
 

Enumerator:
OPT_LOG 
OPT_PID_FILE 
OPT_SOCKET 
OPT_PASSWORD_FILE 
OPT_MYSQLD_PATH 
OPT_RUN_AS_SERVICE 
OPT_USER 
OPT_MONITORING_INTERVAL 
OPT_PORT 
OPT_BIND_ADDRESS 

Definition at line 52 of file options.cc.

00052              {
00053   OPT_LOG= 256,
00054   OPT_PID_FILE,
00055   OPT_SOCKET,
00056   OPT_PASSWORD_FILE,
00057   OPT_MYSQLD_PATH,
00058   OPT_RUN_AS_SERVICE,
00059   OPT_USER,
00060   OPT_MONITORING_INTERVAL,
00061   OPT_PORT,
00062   OPT_BIND_ADDRESS
00063 };


Function Documentation

static C_MODE_START my_bool get_one_option int  optid,
const struct my_option *opt   __attribute__((unused)),
char *argument   __attribute__((unused))
[static]
 

Definition at line 185 of file options.cc.

References exit, passwd, usage, and version().

00188 {
00189   switch(optid) {
00190   case 'V':
00191     version();
00192     exit(0);
00193   case 'P':
00194     passwd();
00195     exit(0);
00196   case '?':
00197     usage();
00198     exit(0);
00199   }
00200   return 0;
00201 }

static void passwd  )  [static]
 

Definition at line 151 of file options.cc.

References get_tty_password(), make_scrambled_password(), p, SCRAMBLED_PASSWORD_CHAR_LENGTH, strchr(), and user.

00152 {
00153   char user[1024], *p;
00154   const char *pw1, *pw2;
00155   char pw1msg[]= "Enter password: ";
00156   char pw2msg[]= "Re-type password: ";
00157   char crypted_pw[SCRAMBLED_PASSWORD_CHAR_LENGTH + 1];
00158 
00159   fprintf(stderr, "Creating record for new user.\n");
00160   fprintf(stderr, "Enter user name: ");
00161   if (!fgets(user, sizeof(user), stdin))
00162   {
00163     fprintf(stderr, "Unable to read user.\n");
00164     return;
00165   }
00166   if ((p= strchr(user, '\n'))) *p= 0;
00167 
00168   pw1= get_tty_password(pw1msg);
00169   pw2= get_tty_password(pw2msg);
00170 
00171   if (strcmp(pw1, pw2))
00172   {
00173     fprintf(stderr, "Sorry, passwords do not match.\n");
00174     return;
00175   }
00176 
00177   make_scrambled_password(crypted_pw, pw1);
00178   printf("%s:%s\n", user, crypted_pw);
00179 }

static void usage void   )  [static]
 

Definition at line 136 of file options.cc.

References default_groups, my_print_help(), my_print_variables(), my_progname, print_defaults(), and version().

00137 {
00138   version();
00139 
00140   printf("Copyright (C) 2003, 2004 MySQL AB\n"
00141   "This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n"
00142   "and you are welcome to modify and redistribute it under the GPL license\n");
00143   printf("Usage: %s [OPTIONS] \n", my_progname);
00144 
00145   my_print_help(my_long_options);
00146   print_defaults("my", default_groups);
00147   my_print_variables(my_long_options);
00148 }

static void version  )  [static]
 

Definition at line 126 of file options.cc.

References MACHINE_TYPE, my_progname, mysqlmanager_version, and SYSTEM_TYPE.

Referenced by __db_upgrade(), select_create::abort(), check_master_version(), Load_log_processor::create_unique_file(), dbt_rdump(), dbt_rprint(), com::sleepycat::db::rpcserver::DbServerStub::dispatchOncRpcCall(), com::sleepycat::db::rpcserver::DbServer::dispatchOncRpcCall(), Qmgr::execAPI_REGREQ(), Qmgr::execCM_NODEINFOCONF(), Show_instance_status::execute(), CommandInterpreter::executeStatus(), fil_space_get_version(), MgmApiSession::get_nodeid(), get_one_option(), get_options(), MgmApiSession::getConfig_common(), MgmApiSession::getConfig_old(), load(), main(), mysql_get_server_version(), printNodeStatus(), rheader(), row_vers_build_for_consistent_read(), row_vers_impl_x_locked_off_kernel(), row_vers_old_has_index_entry(), select_create::send_eof(), Filename::set(), yaSSL::SSLeay_version(), static_get_options(), usage(), Backup::verifyNodesAlive(), and yylex().

00127 {
00128   printf("%s Ver %s for %s on %s\n", my_progname, mysqlmanager_version,
00129          SYSTEM_TYPE, MACHINE_TYPE);
00130 }


Variable Documentation

const char* default_groups[] = { "manager", 0 } [static]
 

Definition at line 133 of file options.cc.

Referenced by Options::load(), and usage().

struct my_option my_long_options[] [static]
 

Definition at line 65 of file options.cc.


Generated on Wed Jul 20 21:10:13 2005 for MySQL 5.0.9 Beta by  doxygen 1.4.3