List:Internals« Previous MessageNext Message »
From:Jim Winstead Date:April 7 2005 10:37pm
Subject:bk commit into 5.0 tree (jimw:1.1889) BUG#5354
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of jimw. When jimw 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.1889 05/04/07 15:37:25 jimw@stripped +3 -0
  Add default configuration files to my_print_defaults usage, and
  add handling of configuration file in the Windows shared system
  directory. (Bug #5354)

  mysys/default.c
    1.60 05/04/07 15:37:22 jimw@stripped +21 -16
    Increase MAX_DEFAULT_DIRS to handle shared Windows directory, and
    move the logic for handling the Windows (and OS/2) system directories
    into init_default_directories().

  include/my_sys.h
    1.149 05/04/07 15:37:22 jimw@stripped +1 -0
    Add new function to print out list of default configuration files.

  extra/my_print_defaults.c
    1.20 05/04/07 15:37:22 jimw@stripped +1 -0
    Print out list of configuration files used by default.

# 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:	jimw
# Host:	rama.(none)
# Root:	/home/jimw/my/mysql-5.0-mpd

--- 1.19/extra/my_print_defaults.c	2005-02-22 05:14:12 -08:00
+++ 1.20/extra/my_print_defaults.c	2005-04-07 15:37:22 -07:00
@@ -68,6 +68,7 @@
   puts("Prints all arguments that is give to some program using the default files");
   printf("Usage: %s [OPTIONS] groups\n", my_progname);
   my_print_help(my_long_options);
+  my_print_default_files("my");
   my_print_variables(my_long_options);
   printf("\nExample usage:\n%s --config-file=my client mysql\n", my_progname);
 }

--- 1.148/include/my_sys.h	2005-04-05 04:17:39 -07:00
+++ 1.149/include/my_sys.h	2005-04-07 15:37:22 -07:00
@@ -781,6 +781,7 @@
                                   char ***argv, uint *args_used,
                                   Process_option_func func, void *func_ctx);
 extern void free_defaults(char **argv);
+extern void my_print_default_files(const char *conf_file);
 extern void print_defaults(const char *conf_file, const char **groups);
 extern my_bool my_compress(byte *, ulong *, ulong *);
 extern my_bool my_uncompress(byte *, ulong *, ulong *);

--- 1.59/mysys/default.c	2005-04-06 07:22:16 -07:00
+++ 1.60/mysys/default.c	2005-04-07 15:37:22 -07:00
@@ -45,11 +45,12 @@
 
 /* Which directories are searched for options (and in which order) */
 
-#define MAX_DEFAULT_DIRS 4
+#define MAX_DEFAULT_DIRS 5
 const char *default_directories[MAX_DEFAULT_DIRS + 1];
 
 #ifdef __WIN__
 static const char *f_extensions[]= { ".ini", ".cnf", 0 };
+static char system_dir[FN_REFLEN], shared_system_dir[FN_REFLEN];
 #else
 static const char *f_extensions[]= { ".cnf", 0 };
 #endif
@@ -140,20 +141,6 @@
   }
   else
   {
-#ifdef __WIN__
-    char system_dir[FN_REFLEN];
-    GetWindowsDirectory(system_dir,sizeof(system_dir));
-    if ((search_default_file(func, func_ctx, system_dir, conf_file)))
-      goto err;
-#endif
-#if defined(__EMX__) || defined(OS2)
-    {
-      const char *etc; 
-      if ((etc= getenv("ETC")) &&
-          (search_default_file(func, func_ctx, etc, conf_file)) < 0)
-      goto err;
-    }
-#endif
     for (dirs= default_directories ; *dirs; dirs++)
     {
       if (**dirs)
@@ -725,7 +712,7 @@
 
 #include <help_start.h>
 
-void print_defaults(const char *conf_file, const char **groups)
+void my_print_default_files(const char *conf_file)
 {
 #ifdef __WIN__
   my_bool have_ext= fn_ext(conf_file)[0] != 0;
@@ -782,6 +769,12 @@
     }
     puts("");
   }
+}
+
+void print_defaults(const char *conf_file, const char **groups)
+{
+  my_print_default_files(conf_file);
+
   fputs("The following groups are read:",stdout);
   for ( ; *groups ; groups++)
   {
@@ -803,9 +796,21 @@
 
 #ifdef __WIN__
   *ptr++= "C:/";
+
+  if (GetWindowsDirectory(system_dir,sizeof(system_dir)))
+    *ptr++= &system_dir;
+  /* Only add shared system directory if different from default. */
+  if (GetSystemWindowsDirectory(shared_system_dir,sizeof(shared_system_dir)) &&
+      strcmp(system_dir, shared_system_dir))
+    *ptr++= &shared_system_dir;
+
 #elif defined(__NETWARE__)
   *ptr++= "sys:/etc/";
 #else
+#if defined(__EMX__) || defined(OS2)
+  if ((env= getenv("ETC")))
+    *ptr++= env;
+#endif
   *ptr++= "/etc/";
 #endif
   if ((env= getenv(STRINGIFY_ARG(DEFAULT_HOME_ENV))))
Thread
bk commit into 5.0 tree (jimw:1.1889) BUG#5354Jim Winstead8 Apr