Commit 3f694eae authored by rburnett@bk-internal.mysql.com's avatar rburnett@bk-internal.mysql.com

Merge bk-internal.mysql.com:/data0/bk/mysql-5.1-new

into  bk-internal.mysql.com:/data0/bk/mysql-5.1-kt
parents 9f9a76eb d8d222f2
...@@ -95,7 +95,7 @@ functions */ ...@@ -95,7 +95,7 @@ functions */
#define O_SHORT_LIVED 0 #define O_SHORT_LIVED 0
#define SH_DENYNO _SH_DENYNO #define SH_DENYNO _SH_DENYNO
#else #else
#define O_BINARY _O_BINARY /* compability with MSDOS */ #define O_BINARY _O_BINARY /* compability with older style names */
#define FILE_BINARY _O_BINARY /* my_fopen in binary mode */ #define FILE_BINARY _O_BINARY /* my_fopen in binary mode */
#define O_TEMPORARY _O_TEMPORARY #define O_TEMPORARY _O_TEMPORARY
#define O_SHORT_LIVED _O_SHORT_LIVED #define O_SHORT_LIVED _O_SHORT_LIVED
......
...@@ -106,12 +106,6 @@ extern char NEAR _dig_vec_lower[]; ...@@ -106,12 +106,6 @@ extern char NEAR _dig_vec_lower[];
#define memcpy_fixed(A,B,C) memcpy((A),(B),(C)) #define memcpy_fixed(A,B,C) memcpy((A),(B),(C))
#endif #endif
#ifdef MSDOS
#undef bmove_align
#define bmove512(A,B,C) bmove_align(A,B,C)
extern void bmove_align(gptr dst,const gptr src,uint len);
#endif
#if (!defined(USE_BMOVE512) || defined(HAVE_purify)) && !defined(bmove512) #if (!defined(USE_BMOVE512) || defined(HAVE_purify)) && !defined(bmove512)
#define bmove512(A,B,C) memcpy(A,B,C) #define bmove512(A,B,C) memcpy(A,B,C)
#endif #endif
......
...@@ -33,9 +33,6 @@ ...@@ -33,9 +33,6 @@
#define EOVERFLOW 84 #define EOVERFLOW 84
#endif #endif
#ifdef MSDOS
#include <share.h> /* Neaded for sopen() */
#endif
#if !defined(USE_MY_FUNC) && !defined(THREAD) #if !defined(USE_MY_FUNC) && !defined(THREAD)
#include <my_nosys.h> /* For faster code, after test */ #include <my_nosys.h> /* For faster code, after test */
#endif /* USE_MY_FUNC */ #endif /* USE_MY_FUNC */
......
...@@ -44,7 +44,7 @@ C_MODE_START ...@@ -44,7 +44,7 @@ C_MODE_START
#include <sys/ioctl.h> #include <sys/ioctl.h>
#endif #endif
#if !defined(MSDOS) && !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) && !defined(__BEOS__) && !defined(__NETWARE__) #if !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) && !defined(__BEOS__) && !defined(__NETWARE__)
#include <netinet/in_systm.h> #include <netinet/in_systm.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <netinet/ip.h> #include <netinet/ip.h>
...@@ -53,7 +53,7 @@ C_MODE_START ...@@ -53,7 +53,7 @@ C_MODE_START
#endif #endif
#endif #endif
#if defined(MSDOS) || defined(__WIN__) #if defined(__WIN__)
#define O_NONBLOCK 1 /* For emulation of fcntl() */ #define O_NONBLOCK 1 /* For emulation of fcntl() */
#endif #endif
......
...@@ -27,9 +27,6 @@ extern "C" { ...@@ -27,9 +27,6 @@ extern "C" {
#ifndef __MY_NOSYS__ #ifndef __MY_NOSYS__
#define __MY_NOSYS__ #define __MY_NOSYS__
#ifdef MSDOS
#include <io.h> /* Get prototypes for read()... */
#endif
#ifndef HAVE_STDLIB_H #ifndef HAVE_STDLIB_H
#include <malloc.h> #include <malloc.h>
#endif #endif
......
...@@ -196,22 +196,6 @@ extern void my_large_free(gptr ptr, myf my_flags); ...@@ -196,22 +196,6 @@ extern void my_large_free(gptr ptr, myf my_flags);
#define my_afree(PTR) my_free(PTR,MYF(MY_WME)) #define my_afree(PTR) my_free(PTR,MYF(MY_WME))
#endif /* HAVE_ALLOCA */ #endif /* HAVE_ALLOCA */
#ifdef MSDOS
#ifdef __ZTC__
void * __CDECL halloc(long count,size_t length);
void __CDECL hfree(void *ptr);
#endif
#if defined(USE_HALLOC)
#if defined(_VCM_) || defined(M_IC80386)
#undef USE_HALLOC
#endif
#endif
#ifdef USE_HALLOC
#define malloc(a) halloc((long) (a),1)
#define free(a) hfree(a)
#endif
#endif /* MSDOS */
#ifndef errno /* did we already get it? */ #ifndef errno /* did we already get it? */
#ifdef HAVE_ERRNO_AS_DEFINE #ifdef HAVE_ERRNO_AS_DEFINE
#include <errno.h> /* errno is a define */ #include <errno.h> /* errno is a define */
......
...@@ -40,19 +40,11 @@ typedef int (*tree_walk_action)(void *,element_count,void *); ...@@ -40,19 +40,11 @@ typedef int (*tree_walk_action)(void *,element_count,void *);
typedef enum { free_init, free_free, free_end } TREE_FREE; typedef enum { free_init, free_free, free_end } TREE_FREE;
typedef void (*tree_element_free)(void*, TREE_FREE, void *); typedef void (*tree_element_free)(void*, TREE_FREE, void *);
#ifdef MSDOS
typedef struct st_tree_element {
struct st_tree_element *left,*right;
unsigned long count;
uchar colour; /* black is marked as 1 */
} TREE_ELEMENT;
#else
typedef struct st_tree_element { typedef struct st_tree_element {
struct st_tree_element *left,*right; struct st_tree_element *left,*right;
uint32 count:31, uint32 count:31,
colour:1; /* black is marked as 1 */ colour:1; /* black is marked as 1 */
} TREE_ELEMENT; } TREE_ELEMENT;
#endif /* MSDOS */
#define ELEMENT_CHILD(element, offs) (*(TREE_ELEMENT**)((char*)element + offs)) #define ELEMENT_CHILD(element, offs) (*(TREE_ELEMENT**)((char*)element + offs))
......
...@@ -33,7 +33,7 @@ ADD_LIBRARY(mysqldemb emb_qcache.cc libmysqld.c lib_sql.cc ...@@ -33,7 +33,7 @@ ADD_LIBRARY(mysqldemb emb_qcache.cc libmysqld.c lib_sql.cc
../sql/field_conv.cc ../sql/field.cc ../sql/filesort.cc ../sql/field_conv.cc ../sql/field.cc ../sql/filesort.cc
../sql/gstream.cc ../sql/ha_heap.cc ../sql/ha_myisam.cc ../sql/gstream.cc ../sql/ha_heap.cc ../sql/ha_myisam.cc
../sql/ha_myisammrg.cc ${mysql_se_ha_src} ../sql/ha_myisammrg.cc ${mysql_se_ha_src}
../sql/handler.cc ../sql/handlerton-win.cc ../sql/hash_filo.cc ../sql/handler.cc ../sql/hash_filo.cc
../sql/hostname.cc ../sql/init.cc ../sql/item_buff.cc ../sql/hostname.cc ../sql/init.cc ../sql/item_buff.cc
../sql/item_cmpfunc.cc ../sql/item.cc ../sql/item_create.cc ../sql/item_cmpfunc.cc ../sql/item.cc ../sql/item_create.cc
../sql/item_func.cc ../sql/item_geofunc.cc ../sql/item_row.cc ../sql/item_func.cc ../sql/item_geofunc.cc ../sql/item_row.cc
......
drop table if exists t1,t2; drop table if exists t1,t2,t3;
CREATE TABLE t1 ( CREATE TABLE t1 (
Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL, Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
-- source include/have_archive.inc -- source include/have_archive.inc
--disable_warnings --disable_warnings
drop table if exists t1,t2; drop table if exists t1,t2,t3;
--enable_warnings --enable_warnings
CREATE TABLE t1 ( CREATE TABLE t1 (
......
...@@ -84,14 +84,6 @@ ...@@ -84,14 +84,6 @@
#define KEYCACHE_DEBUG_LOG "my_key_cache_debug.log" #define KEYCACHE_DEBUG_LOG "my_key_cache_debug.log"
*/ */
#if defined(MSDOS) && !defined(M_IC80386)
/* we nead much memory */
#undef my_malloc_lock
#undef my_free_lock
#define my_malloc_lock(A,B) halloc((long) (A/IO_SIZE),IO_SIZE)
#define my_free_lock(A,B) hfree(A)
#endif /* defined(MSDOS) && !defined(M_IC80386) */
#define STRUCT_PTR(TYPE, MEMBER, a) \ #define STRUCT_PTR(TYPE, MEMBER, a) \
(TYPE *) ((char *) (a) - offsetof(TYPE, MEMBER)) (TYPE *) ((char *) (a) - offsetof(TYPE, MEMBER))
......
...@@ -73,7 +73,7 @@ my_string my_path(my_string to, const char *progname, ...@@ -73,7 +73,7 @@ my_string my_path(my_string to, const char *progname,
/* test if file without filename is found in path */ /* test if file without filename is found in path */
/* Returns to if found and to has dirpart if found, else NullS */ /* Returns to if found and to has dirpart if found, else NullS */
#if defined(MSDOS) || defined(__WIN__) #if defined(__WIN__)
#define F_OK 0 #define F_OK 0
#define PATH_SEP ';' #define PATH_SEP ';'
#define PROGRAM_EXTENSION ".exe" #define PROGRAM_EXTENSION ".exe"
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#endif #endif
#ifdef HAVE_TEMPNAM #ifdef HAVE_TEMPNAM
#if !defined(MSDOS) && !defined(__NETWARE__) #if !defined(__NETWARE__)
extern char **environ; extern char **environ;
#endif #endif
#endif #endif
......
...@@ -156,7 +156,7 @@ int check_if_legal_tablename(const char *name) ...@@ -156,7 +156,7 @@ int check_if_legal_tablename(const char *name)
} }
#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) #if defined(__WIN__) || defined(__EMX__)
/* /*
...@@ -199,4 +199,4 @@ int check_if_legal_filename(const char *path) ...@@ -199,4 +199,4 @@ int check_if_legal_filename(const char *path)
DBUG_RETURN(0); DBUG_RETURN(0);
} }
#endif /* defined(MSDOS) || defined(__WIN__) || defined(__EMX__) */ #endif /* defined(__WIN__) || defined(__EMX__) */
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
long my_clock(void) long my_clock(void)
{ {
#if !defined(MSDOS) && !defined(__WIN__) && !defined(__NETWARE__) #if !defined(__WIN__) && !defined(__NETWARE__)
struct tms tmsbuf; struct tms tmsbuf;
VOID(times(&tmsbuf)); VOID(times(&tmsbuf));
return (tmsbuf.tms_utime + tmsbuf.tms_stime); return (tmsbuf.tms_utime + tmsbuf.tms_stime);
......
...@@ -95,7 +95,7 @@ int my_copy(const char *from, const char *to, myf MyFlags) ...@@ -95,7 +95,7 @@ int my_copy(const char *from, const char *to, myf MyFlags)
if (MyFlags & MY_HOLD_ORIGINAL_MODES && !new_file_stat) if (MyFlags & MY_HOLD_ORIGINAL_MODES && !new_file_stat)
DBUG_RETURN(0); /* File copyed but not stat */ DBUG_RETURN(0); /* File copyed but not stat */
VOID(chmod(to, stat_buff.st_mode & 07777)); /* Copy modes */ VOID(chmod(to, stat_buff.st_mode & 07777)); /* Copy modes */
#if !defined(MSDOS) && !defined(__WIN__) && !defined(__NETWARE__) #if !defined(__WIN__) && !defined(__NETWARE__)
VOID(chown(to, stat_buff.st_uid,stat_buff.st_gid)); /* Copy ownership */ VOID(chown(to, stat_buff.st_uid,stat_buff.st_gid)); /* Copy ownership */
#endif #endif
#if !defined(VMS) && !defined(__ZTC__) #if !defined(VMS) && !defined(__ZTC__)
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include <my_dir.h> #include <my_dir.h>
#include "mysys_err.h" #include "mysys_err.h"
#include <errno.h> #include <errno.h>
#if defined(MSDOS) || defined(__WIN__) #if defined(__WIN__)
#include <share.h> #include <share.h>
#endif #endif
...@@ -47,13 +47,6 @@ File my_create(const char *FileName, int CreateFlags, int access_flags, ...@@ -47,13 +47,6 @@ File my_create(const char *FileName, int CreateFlags, int access_flags,
#elif defined(VMS) #elif defined(VMS)
fd = open((my_string) FileName, access_flags | O_CREAT, 0, fd = open((my_string) FileName, access_flags | O_CREAT, 0,
"ctx=stm","ctx=bin"); "ctx=stm","ctx=bin");
#elif defined(MSDOS)
if (access_flags & O_SHARE)
fd = sopen((my_string) FileName, access_flags | O_CREAT | O_BINARY,
SH_DENYNO, MY_S_IREAD | MY_S_IWRITE);
else
fd = open((my_string) FileName, access_flags | O_CREAT | O_BINARY,
MY_S_IREAD | MY_S_IWRITE);
#elif defined(__WIN__) #elif defined(__WIN__)
fd= my_sopen((my_string) FileName, access_flags | O_CREAT | O_BINARY, fd= my_sopen((my_string) FileName, access_flags | O_CREAT | O_BINARY,
SH_DENYNO, MY_S_IREAD | MY_S_IWRITE); SH_DENYNO, MY_S_IREAD | MY_S_IWRITE);
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include "mysys_err.h" #include "mysys_err.h"
#include <my_dir.h> #include <my_dir.h>
#include <errno.h> #include <errno.h>
#if defined(MSDOS) || defined(__WIN__) #if defined(__WIN__)
#include <share.h> #include <share.h>
#endif #endif
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
/* Thread safe version of gethostbyname_r() */ /* Thread safe version of gethostbyname_r() */
#include "mysys_priv.h" #include "mysys_priv.h"
#if !defined(MSDOS) && !defined(__WIN__) #if !defined(__WIN__)
#include <netdb.h> #include <netdb.h>
#endif #endif
#include <my_net.h> #include <my_net.h>
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#ifdef HAVE_GETWD #ifdef HAVE_GETWD
#include <sys/param.h> #include <sys/param.h>
#endif #endif
#if defined(MSDOS) || defined(__WIN__) #if defined(__WIN__)
#include <m_ctype.h> #include <m_ctype.h>
#include <dos.h> #include <dos.h>
#include <direct.h> #include <direct.h>
...@@ -39,11 +39,9 @@ int my_getwd(my_string buf, uint size, myf MyFlags) ...@@ -39,11 +39,9 @@ int my_getwd(my_string buf, uint size, myf MyFlags)
DBUG_ENTER("my_getwd"); DBUG_ENTER("my_getwd");
DBUG_PRINT("my",("buf: 0x%lx size: %d MyFlags %d", buf,size,MyFlags)); DBUG_PRINT("my",("buf: 0x%lx size: %d MyFlags %d", buf,size,MyFlags));
#if ! defined(MSDOS)
if (curr_dir[0]) /* Current pos is saved here */ if (curr_dir[0]) /* Current pos is saved here */
VOID(strmake(buf,&curr_dir[0],size-1)); VOID(strmake(buf,&curr_dir[0],size-1));
else else
#endif
{ {
#if defined(HAVE_GETCWD) #if defined(HAVE_GETCWD)
if (!getcwd(buf,size-2) && MyFlags & MY_WME) if (!getcwd(buf,size-2) && MyFlags & MY_WME)
...@@ -87,43 +85,13 @@ int my_setwd(const char *dir, myf MyFlags) ...@@ -87,43 +85,13 @@ int my_setwd(const char *dir, myf MyFlags)
int res; int res;
size_s length; size_s length;
my_string start,pos; my_string start,pos;
#if defined(VMS) || defined(MSDOS) #if defined(VMS)
char buff[FN_REFLEN]; char buff[FN_REFLEN];
#endif #endif
DBUG_ENTER("my_setwd"); DBUG_ENTER("my_setwd");
DBUG_PRINT("my",("dir: '%s' MyFlags %d", dir, MyFlags)); DBUG_PRINT("my",("dir: '%s' MyFlags %d", dir, MyFlags));
start=(my_string) dir; start=(my_string) dir;
#if defined(MSDOS) /* MSDOS chdir can't change drive */
#if !defined(_DDL) && !defined(WIN32)
if ((pos=(char*) strchr(dir,FN_DEVCHAR)) != 0)
{
uint drive,drives;
pos++; /* Skip FN_DEVCHAR */
drive=(uint) (my_toupper(&my_charset_latin1,dir[0])-'A'+1);
drives= (uint) -1;
if ((pos-(byte*) dir) == 2 && drive > 0 && drive < 32)
{
_dos_setdrive(drive,&drives);
_dos_getdrive(&drives);
}
if (drive != drives)
{
*pos='\0'; /* Dir is now only drive */
my_errno=errno;
my_error(EE_SETWD,MYF(ME_BELL+ME_WAITTANG),dir,ENOENT);
DBUG_RETURN(-1);
}
dir=pos; /* drive changed, change now path */
}
#endif
if (*((pos=strend(dir)-1)) == FN_LIBCHAR && pos != dir)
{
strmov(buff,dir)[-1]=0; /* Remove last '/' */
dir=buff;
}
#endif /* MSDOS*/
if (! dir[0] || (dir[0] == FN_LIBCHAR && dir[1] == 0)) if (! dir[0] || (dir[0] == FN_LIBCHAR && dir[1] == 0))
dir=FN_ROOTDIR; dir=FN_ROOTDIR;
#ifdef VMS #ifdef VMS
......
...@@ -181,7 +181,7 @@ Voluntary context switches %ld, Involuntary context switches %ld\n", ...@@ -181,7 +181,7 @@ Voluntary context switches %ld, Involuntary context switches %ld\n",
rus.ru_msgsnd, rus.ru_msgrcv, rus.ru_nsignals, rus.ru_msgsnd, rus.ru_msgrcv, rus.ru_nsignals,
rus.ru_nvcsw, rus.ru_nivcsw); rus.ru_nvcsw, rus.ru_nivcsw);
#endif #endif
#if ( defined(MSDOS) || defined(__NETWARE__) ) && !defined(__WIN__) #if defined(__NETWARE__) && !defined(__WIN__)
fprintf(info_file,"\nRun time: %.1f\n",(double) clock()/CLOCKS_PER_SEC); fprintf(info_file,"\nRun time: %.1f\n",(double) clock()/CLOCKS_PER_SEC);
#endif #endif
#if defined(SAFEMALLOC) #if defined(SAFEMALLOC)
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* TODO: check for overun of memory for names. */ /* TODO: check for overun of memory for names. */
/* Convert MSDOS-TIME to standar time_t */ /* Convert MSDOS-TIME to standar time_t (still needed?) */
#define USES_TYPES /* sys/types is included */ #define USES_TYPES /* sys/types is included */
#include "mysys_priv.h" #include "mysys_priv.h"
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
# if defined(HAVE_NDIR_H) # if defined(HAVE_NDIR_H)
# include <ndir.h> # include <ndir.h>
# endif # endif
# if defined(MSDOS) || defined(__WIN__) # if defined(__WIN__)
# include <dos.h> # include <dos.h>
# ifdef __BORLANDC__ # ifdef __BORLANDC__
# include <dir.h> # include <dir.h>
...@@ -94,7 +94,7 @@ static int comp_names(struct fileinfo *a, struct fileinfo *b) ...@@ -94,7 +94,7 @@ static int comp_names(struct fileinfo *a, struct fileinfo *b)
} /* comp_names */ } /* comp_names */
#if !defined(MSDOS) && !defined(__WIN__) #if !defined(__WIN__)
MY_DIR *my_dir(const char *path, myf MyFlags) MY_DIR *my_dir(const char *path, myf MyFlags)
{ {
...@@ -347,7 +347,7 @@ my_string directory_file_name (my_string dst, const char *src) ...@@ -347,7 +347,7 @@ my_string directory_file_name (my_string dst, const char *src)
#endif /* VMS */ #endif /* VMS */
} /* directory_file_name */ } /* directory_file_name */
#elif defined(WIN32) #else
/* /*
***************************************************************************** *****************************************************************************
...@@ -386,7 +386,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags) ...@@ -386,7 +386,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
*tmp_file++= '.'; /* From current dev-dir */ *tmp_file++= '.'; /* From current dev-dir */
if (tmp_file[-1] != FN_LIBCHAR) if (tmp_file[-1] != FN_LIBCHAR)
*tmp_file++ =FN_LIBCHAR; *tmp_file++ =FN_LIBCHAR;
tmp_file[0]='*'; /* MSDOS needs this !??? */ tmp_file[0]='*'; /* Windows needs this !??? */
tmp_file[1]='.'; tmp_file[1]='.';
tmp_file[2]='*'; tmp_file[2]='*';
tmp_file[3]='\0'; tmp_file[3]='\0';
...@@ -509,109 +509,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags) ...@@ -509,109 +509,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
DBUG_RETURN((MY_DIR *) NULL); DBUG_RETURN((MY_DIR *) NULL);
} /* my_dir */ } /* my_dir */
#else /* MSDOS and not WIN32 */ #endif /* __WIN__ */
/******************************************************************************
** At MSDOS you always get stat of files, but time is in packed MSDOS-format
******************************************************************************/
MY_DIR *my_dir(const char* path, myf MyFlags)
{
char *buffer;
MY_DIR *result= 0;
FILEINFO finfo;
DYNAMIC_ARRAY *dir_entries_storage;
MEM_ROOT *names_storage;
struct find_t find;
ushort mode;
char tmp_path[FN_REFLEN],*tmp_file,attrib;
DBUG_ENTER("my_dir");
DBUG_PRINT("my",("path: '%s' stat: %d MyFlags: %d",path,MyFlags));
/* Put LIB-CHAR as last path-character if not there */
tmp_file=tmp_path;
if (!*path)
*tmp_file++ ='.'; /* From current dir */
tmp_file= strmov(tmp_file,path);
if (tmp_file[-1] == FN_DEVCHAR)
*tmp_file++= '.'; /* From current dev-dir */
if (tmp_file[-1] != FN_LIBCHAR)
*tmp_file++ =FN_LIBCHAR;
tmp_file[0]='*'; /* MSDOS needs this !??? */
tmp_file[1]='.';
tmp_file[2]='*';
tmp_file[3]='\0';
if (_dos_findfirst(tmp_path,_A_NORMAL | _A_SUBDIR, &find))
goto error;
if (!(buffer= my_malloc(ALIGN_SIZE(sizeof(MY_DIR)) +
ALIGN_SIZE(sizeof(DYNAMIC_ARRAY)) +
sizeof(MEM_ROOT), MyFlags)))
goto error;
dir_entries_storage= (DYNAMIC_ARRAY*)(buffer + ALIGN_SIZE(sizeof(MY_DIR)));
names_storage= (MEM_ROOT*)(buffer + ALIGN_SIZE(sizeof(MY_DIR)) +
ALIGN_SIZE(sizeof(DYNAMIC_ARRAY)));
if (my_init_dynamic_array(dir_entries_storage, sizeof(FILEINFO),
ENTRIES_START_SIZE, ENTRIES_INCREMENT))
{
my_free((gptr) buffer,MYF(0));
goto error;
}
init_alloc_root(names_storage, NAMES_START_SIZE, NAMES_START_SIZE);
/* MY_DIR structure is allocated and completly initialized at this point */
result= (MY_DIR*)buffer;
do
{
if (!(finfo.name= strdup_root(names_storage, find.name)))
goto error;
if (MyFlags & MY_WANT_STAT)
{
if (!(finfo.mystat= (MY_STAT*)alloc_root(names_storage,
sizeof(MY_STAT))))
goto error;
bzero(finfo.mystat, sizeof(MY_STAT));
finfo.mystat->st_size= find.size;
mode= MY_S_IREAD; attrib= find.attrib;
if (!(attrib & _A_RDONLY))
mode|= MY_S_IWRITE;
if (attrib & _A_SUBDIR)
mode|= MY_S_IFDIR;
finfo.mystat->st_mode= mode;
finfo.mystat->st_mtime= ((uint32) find.wr_date << 16) + find.wr_time;
}
else
finfo.mystat= NULL;
if (push_dynamic(dir_entries_storage, (gptr)&finfo))
goto error;
} while (_dos_findnext(&find) == 0);
result->dir_entry= (FILEINFO *)dir_entries_storage->buffer;
result->number_off_files= dir_entries_storage->elements;
if (!(MyFlags & MY_DONT_SORT))
qsort((void *) result->dir_entry, result->number_off_files,
sizeof(FILEINFO), (qsort_cmp) comp_names);
DBUG_RETURN(result);
error:
my_dirend(result);
if (MyFlags & MY_FAE+MY_WME)
my_error(EE_DIR,MYF(ME_BELL+ME_WAITTANG),path,errno);
DBUG_RETURN((MY_DIR *) NULL);
} /* my_dir */
#endif /* WIN32 && MSDOS */
/**************************************************************************** /****************************************************************************
** File status ** File status
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <m_string.h> #include <m_string.h>
/* for thread safe my_inet_ntoa */ /* for thread safe my_inet_ntoa */
#if !defined(MSDOS) && !defined(__WIN__) #if !defined(__WIN__)
#include <netdb.h> #include <netdb.h>
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> #include <sys/socket.h>
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#ifdef HAVE_ARPA_INET_H #ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h> #include <arpa/inet.h>
#endif #endif
#endif /* !defined(MSDOS) && !defined(__WIN__) */ #endif /* !defined(__WIN__) */
void my_inet_ntoa(struct in_addr in, char *buf) void my_inet_ntoa(struct in_addr in, char *buf)
{ {
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include "mysys_err.h" #include "mysys_err.h"
#include <my_dir.h> #include <my_dir.h>
#include <errno.h> #include <errno.h>
#if defined(MSDOS) || defined(__WIN__) #if defined(__WIN__)
#include <share.h> #include <share.h>
#endif #endif
...@@ -45,7 +45,7 @@ File my_open(const char *FileName, int Flags, myf MyFlags) ...@@ -45,7 +45,7 @@ File my_open(const char *FileName, int Flags, myf MyFlags)
DBUG_ENTER("my_open"); DBUG_ENTER("my_open");
DBUG_PRINT("my",("Name: '%s' Flags: %d MyFlags: %d", DBUG_PRINT("my",("Name: '%s' Flags: %d MyFlags: %d",
FileName, Flags, MyFlags)); FileName, Flags, MyFlags));
#if defined(MSDOS) || defined(__WIN__) #if defined(__WIN__)
/* /*
Check that we don't try to open or create a file name that may Check that we don't try to open or create a file name that may
cause problems for us in the future (like PRN) cause problems for us in the future (like PRN)
......
...@@ -90,14 +90,14 @@ int my_copystat(const char *from, const char *to, int MyFlags) ...@@ -90,14 +90,14 @@ int my_copystat(const char *from, const char *to, int MyFlags)
return 1; return 1;
VOID(chmod(to, statbuf.st_mode & 07777)); /* Copy modes */ VOID(chmod(to, statbuf.st_mode & 07777)); /* Copy modes */
#if !defined(MSDOS) && !defined(__WIN__) && !defined(__NETWARE__) #if !defined(__WIN__) && !defined(__NETWARE__)
if (statbuf.st_nlink > 1 && MyFlags & MY_LINK_WARNING) if (statbuf.st_nlink > 1 && MyFlags & MY_LINK_WARNING)
{ {
if (MyFlags & MY_LINK_WARNING) if (MyFlags & MY_LINK_WARNING)
my_error(EE_LINK_WARNING,MYF(ME_BELL+ME_WAITTANG),from,statbuf.st_nlink); my_error(EE_LINK_WARNING,MYF(ME_BELL+ME_WAITTANG),from,statbuf.st_nlink);
} }
VOID(chown(to, statbuf.st_uid, statbuf.st_gid)); /* Copy ownership */ VOID(chown(to, statbuf.st_uid, statbuf.st_gid)); /* Copy ownership */
#endif /* MSDOS */ #endif /* !__WIN__ && !__NETWARE__ */
#ifndef VMS #ifndef VMS
#ifndef __ZTC__ #ifndef __ZTC__
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment