summaryrefslogtreecommitdiff
path: root/ext/mysql/libmysql/default.c
diff options
context:
space:
mode:
authorAndi Gutmans <andi@php.net>2000-08-22 17:59:35 +0000
committerAndi Gutmans <andi@php.net>2000-08-22 17:59:35 +0000
commit0222b7ab416d845abcd3925b3da47fa2d7ed238d (patch)
tree38cbb73fda38196612fddffda4d803003a86b568 /ext/mysql/libmysql/default.c
parent60676f19a5f5425c4375d8ba60e8bd07016ba562 (diff)
downloadphp-git-0222b7ab416d845abcd3925b3da47fa2d7ed238d.tar.gz
- Try and revert libmysql for 4.0.2
Diffstat (limited to 'ext/mysql/libmysql/default.c')
-rw-r--r--ext/mysql/libmysql/default.c49
1 files changed, 16 insertions, 33 deletions
diff --git a/ext/mysql/libmysql/default.c b/ext/mysql/libmysql/default.c
index ae4ba5044b..b1e33f3e59 100644
--- a/ext/mysql/libmysql/default.c
+++ b/ext/mysql/libmysql/default.c
@@ -1,19 +1,5 @@
-/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA */
+/* Copyright Abandoned 1998 TCX DataKonsult AB & Monty Program KB & Detron HB
+ This file is public domain and comes with NO WARRANTY of any kind */
/****************************************************************************
** Add all options from files named "group".cnf from the default_directories
@@ -42,7 +28,7 @@
/* Which directories are searched for options (and in which order) */
const char *default_directories[]= {
-#ifdef __WIN__
+#ifdef __WIN32__
"C:/",
#else
"/etc/",
@@ -50,14 +36,14 @@ const char *default_directories[]= {
#ifdef DATADIR
DATADIR,
#endif
-#ifndef __WIN__
+#ifndef __WIN32__
"~/",
#endif
NullS,
};
#define default_ext ".cnf" /* extension for config file */
-#ifdef __WIN__
+#ifdef __WIN32__
#include <winbase.h>
#define windows_ext ".ini"
#endif
@@ -73,7 +59,7 @@ void load_defaults(const char *conf_file, const char **groups,
DYNAMIC_ARRAY args;
const char **dirs, *extra_default_file;
TYPELIB group;
- my_bool found_print_defaults=0;
+ my_bool print_defaults=0;
MEM_ROOT alloc;
char *ptr,**res;
DBUG_ENTER("load_defaults");
@@ -92,7 +78,7 @@ void load_defaults(const char *conf_file, const char **groups,
res[i-1]=argv[0][i];
(*argc)--;
*argv=res;
- *(MEM_ROOT*) ptr= alloc; /* Save alloc root for free */
+ memcpy(ptr,&alloc,sizeof(alloc)); /* Save alloc root for free */
DBUG_VOID_RETURN;
}
@@ -102,8 +88,8 @@ void load_defaults(const char *conf_file, const char **groups,
extra_default_file=strchr(argv[0][1],'=')+1;
group.count=0;
- group.name= "defaults";
- group.type_names= groups;
+ group.name= (char*) "defaults";
+ group.type_names=(char**) groups;
for (; *groups ; groups++)
group.count++;
@@ -123,7 +109,7 @@ void load_defaults(const char *conf_file, const char **groups,
}
else
{
-#ifdef __WIN__
+#ifdef __WIN32__
char system_dir[FN_REFLEN];
GetWindowsDirectory(system_dir,sizeof(system_dir));
if (search_default_file(&args, &alloc, system_dir, conf_file, windows_ext,
@@ -154,7 +140,7 @@ void load_defaults(const char *conf_file, const char **groups,
/* Check if we wan't to see the new argument list */
if (*argc >= 2 && !strcmp(argv[0][1],"--print-defaults"))
{
- found_print_defaults=1;
+ print_defaults=1;
--*argc; ++*argv; /* skipp argument */
}
@@ -164,9 +150,9 @@ void load_defaults(const char *conf_file, const char **groups,
(*argc)+=args.elements;
*argv= (char**) res;
- *(MEM_ROOT*) ptr= alloc; /* Save alloc root for free */
+ memcpy(ptr,&alloc,sizeof(alloc)); /* Save alloc root for free */
delete_dynamic(&args);
- if (found_print_defaults)
+ if (print_defaults)
{
int i;
printf("%s would have been started with the following arguments:\n",
@@ -187,7 +173,7 @@ void load_defaults(const char *conf_file, const char **groups,
void free_defaults(char **argv)
{
MEM_ROOT ptr;
- memcpy_fixed((char*) &ptr,(char *) argv - sizeof(ptr), sizeof(ptr));
+ memcpy((char*) &ptr,(char *) argv - sizeof(ptr),sizeof(ptr));
free_root(&ptr);
}
@@ -322,9 +308,7 @@ static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
void print_defaults(const char *conf_file, const char **groups)
{
-#ifdef __WIN__
bool have_ext=fn_ext(conf_file)[0] != 0;
-#endif
char name[FN_REFLEN];
const char **dirs;
puts("\nDefault options are read from the following files in the given order:");
@@ -333,7 +317,7 @@ void print_defaults(const char *conf_file, const char **groups)
fputs(conf_file,stdout);
else
{
-#ifdef __WIN__
+#ifdef __WIN32__
GetWindowsDirectory(name,sizeof(name));
printf("%s\\%s%s ",name,conf_file,have_ext ? "" : windows_ext);
#endif
@@ -358,5 +342,4 @@ void print_defaults(const char *conf_file, const char **groups)
--print-defaults Print the program argument list and exit\n\
--no-defaults Don't read default options from any options file\n\
--defaults-file=# Only read default options from the given file #");
-}
-
+};