MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:sergeyv Date:August 24 2005 1:56pm
Subject:bk commit into 5.0 tree (SergeyV:1.2000) BUG#12463
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of sergeyv. When sergeyv does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2000 05/08/24 17:56:04 SergeyV@selena. +1 -0
  Fixes bug #12463. Overrides --help command line option processing 
  in the same way as it is done for options expected to be the first
  in command line.

  sql/mysqld.cc
    1.483 05/08/24 17:55:56 SergeyV@selena. +53 -3
    Fixes bug #12463. Overrides --help command line option processing 
    in the same way as it is done for options expected to be the first
    in command line.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	SergeyV
# Host:	selena.
# Root:	H:/MYSQL/src/mysql-5.0-dev3

--- 1.482/sql/mysqld.cc	2005-08-15 23:37:42 +04:00
+++ 1.483/sql/mysqld.cc	2005-08-24 17:55:56 +04:00
@@ -586,6 +586,8 @@
 static void start_signal_handler(void);
 static pthread_handler_decl(signal_hand, arg);
 static void mysql_init_variables(void);
+static void check_help(int argc, char **argv);
+static void usage();
 static void get_options(int argc,char **argv);
 static void set_server_version(void);
 static int init_thread_environment();
@@ -2552,8 +2554,12 @@
   strmake(pidfile_name, glob_hostname, sizeof(pidfile_name)-5);
   strmov(fn_ext(pidfile_name),".pid");		// Add proper extension
 
-  load_defaults(conf_file_name, groups, &argc, &argv);
-  defaults_argv=argv;
+  check_help(argc, argv);
+  if (!opt_help)
+  {
+    load_defaults(conf_file_name, groups, &argc, &argv);
+    defaults_argv=argv;
+  }
   get_options(argc,argv);
   set_server_version();
 
@@ -3472,6 +3478,8 @@
   /* Must be initialized early for comparison of service name */
   system_charset_info= &my_charset_utf8_general_ci;
 
+  check_help(argc, argv);
+
   if (Service.GetOS())	/* true NT family */
   {
     char file_path[FN_REFLEN];
@@ -6776,6 +6784,42 @@
   }
   return 0;
 }
+
+
+/* Overrides default help option processing */
+static void check_help(int argc, char **argv)
+{
+  static int checked= 0;
+  int i, hpos= 0, vpos= 0, err= 0;
+
+  if (checked)
+    return;
+
+  checked= 1;
+
+  for (i= 1; i < argc; i++)
+  {
+    if (!strcmp(argv[i], "--help"))
+      opt_help= (hpos= i) > 0;
+    if (!strcmp(argv[i], "-?"))
+      opt_help= (hpos= i) > 0;
+    if (!strcmp(argv[i], "--verbose"))
+      opt_verbose= (vpos= i) > 0;
+  }
+
+  err= err || (hpos > 2);
+  err= err || (vpos > 2);
+  err= err || ((hpos == 2) && (vpos != 1));
+  err= err || ((vpos == 2) && (hpos != 1));
+  err= err || ((vpos == 1) && (hpos != 2));
+
+  if (err)
+  {
+    puts("ERROR: --help and --verbose options should be the first in the list of arguments");
+    exit(1);
+  }
+}
+
 	/* Initiates DEBUG - but no debugging here ! */
 
 static gptr *
@@ -6826,8 +6870,14 @@
   my_getopt_error_reporter= option_error_reporter;
   if ((ho_error= handle_options(&argc, &argv, my_long_options,
                                 get_one_option)))
+  {
+    if (opt_help)
+    {
+      usage();
+      exit(0);
+    }
     exit(ho_error);
-
+  }
 #ifndef HAVE_NDBCLUSTER_DB
   if (opt_ndbcluster)
     sql_print_warning("this binary does not contain NDBCLUSTER storage engine");
Thread
bk commit into 5.0 tree (SergeyV:1.2000) BUG#12463sergeyv24 Aug