Index: trunk/src/crtdll/asmhlp.asm
===================================================================
--- trunk/src/crtdll/asmhlp.asm	(revision 9655)
+++ 	(revision )
@@ -1,24 +1,0 @@
-; $Id: asmhlp.asm,v 1.2 2000-04-13 18:46:15 sandervl Exp $
-
-.586P
-               NAME    asmhlp
-
-CODE32         SEGMENT DWORD PUBLIC USE32 'CODE'
-               align 4
-
-PUBLIC 		_POP_FPU
-_POP_FPU proc near
-	mov	eax, [esp+4]
-	fstp	qword ptr [eax]
-	ret
-_POP_FPU endp
-
-public		_SetEDX
-_SetEDX proc near
-	mov	edx, [esp+4];
-	ret
-_SetEDX endp
-
-CODE32          ENDS
-
-                END
Index: trunk/src/crtdll/asmhlp.h
===================================================================
--- trunk/src/crtdll/asmhlp.h	(revision 9655)
+++ 	(revision )
@@ -1,9 +1,0 @@
-// $Id: asmhlp.h,v 1.2 2000-04-13 18:46:15 sandervl Exp $
-#ifndef __ASMHLP_H__
-#define __ASMHLP_H__
-
-void CDECL POP_FPU(double &fpval);
-
-void CDECL SetEDX(ULONG edx);
-
-#endif
Index: trunk/src/crtdll/crt_memory.cpp
===================================================================
--- trunk/src/crtdll/crt_memory.cpp	(revision 9655)
+++ 	(revision )
@@ -1,111 +1,0 @@
-/* $Id: crt_memory.cpp,v 1.1 2000-02-03 21:37:48 sandervl Exp $ */
-
-/*
- * The C RunTime DLL
- * 
- * Implements C run-time functionality as known from UNIX.
- *
- * Partialy based on Wine
- *
- * Copyright 1996,1998 Marcus Meissner
- * Copyright 1996 Jukka Iivonen
- * Copyright 1997 Uwe Bonnes
- * Copyright 1999-2000 Jens Wiessner
- *
- * CRTDLL - memory functions
- *
- */
-
-#include <odin.h>
-#include <os2win.h>
-#include <ctype.h>
-#include <memory.h>
-
-
-/*********************************************************************
- *	_memccpy				(CRTDLL.230)
- */
-void * CDECL CRTDLL__memccpy (void *s1, const void *s2, int c, size_t n)
-{
-  dprintf2(("CRTDLL: _memccpy\n"));
-  size_t i;
-  
-  for (i = 0; i < n; ++i)
-    {
-      if ((((char *)s1)[i] = ((char *)s2)[i]) == (char)c)
-        return (char *)s1+i+1;
-    }
-  return NULL;
-}
-
-
-/*********************************************************************
- *	_memicmp				(CRTDLL.231)
- */
-INT CDECL CRTDLL__memicmp(
-	LPCSTR s1,	/* [in] first string */
-	LPCSTR s2,	/* [in] second string */
-	DWORD len	/* [in] length to compare */ )
-{
-	dprintf2(("CRTDLL: _memicmp(%08xh, %08xh, %08xh)\n",s1,s2,len));
-	int	i;
-
-	for (i=0;i<len;i++) {
-		if (tolower(s1[i])<tolower(s2[i]))
-			return -1;
-		if (tolower(s1[i])>tolower(s2[i]))
-			return  1;
-	}
-	return 0;
-}
-
-
-
-/*********************************************************************
- *	memchr				(CRTDLL.428)
- */
-void * CDECL CRTDLL_memchr( const void *s, int c, size_t n )
-{
-    dprintf2(("CRTDLL: memchr(%08xh, %08xh, %08xh)\n", s, c, n));
-    return memchr( s, c, n );
-}
-
-
-/*********************************************************************
- *	memcmp				(CRTDLL.429)
- */
-int CDECL CRTDLL_memcmp( const void * c1, const void * c2, size_t n )
-{
-    dprintf2(("CRTDLL: memcmp(%08xh, %08xh, %08xh)\n", c1, c2, n));
-    return memcmp( c1, c2, n );
-}
-
-
-/*********************************************************************
- *	memcpy				(CRTDLL.430)
- */
-void * CDECL CRTDLL_memcpy( void *s1, const void *s2, size_t n )
-{
-    dprintf2(("CRTDLL: memcpy(%08xh, %08xh, %08xh)\n", s1, s2, n));
-    return memcpy( s1, s2, n );
-}
-
-
-/*********************************************************************
- *	memmove				(CRTDLL.431)
- */
-VOID CDECL CRTDLL_memmove(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, DWORD Length)
-{
-  dprintf2(("CRTDLL: memmove"));
-  memmove(Destination, Source, Length);
-}
-
-
-/*********************************************************************
- *	memset				(CRTDLL.432)
- */
-void * CDECL CRTDLL_memset( void *s, int i, size_t n )
-{
-    dprintf2(("CRTDLL: memset(%08xh, %08xh, %08xh)\n", s, i, n));
-    return memset( s, i, n );
-}
Index: trunk/src/crtdll/crt_wc.cpp
===================================================================
--- trunk/src/crtdll/crt_wc.cpp	(revision 9655)
+++ 	(revision )
@@ -1,727 +1,0 @@
-/* $Id: crt_wc.cpp,v 1.5 2001-08-04 15:29:39 sandervl Exp $ */
-
-/*
- * The C RunTime DLL
- * 
- * Implements C run-time functionality as known from UNIX.
- *
- * Partialy based on Wine
- *
- * Copyright 1996,1998 Marcus Meissner
- * Copyright 1996 Jukka Iivonen
- * Copyright 1997 Uwe Bonnes
- * Copyright 1999-2000 Jens Wiessner
- * Copyright 2000 Przemyslaw Dobrowolski
- *
- * CRTDLL - widechar functions
- *
- */
-
-#include <odin.h>
-#include <os2win.h>
-#include <stdio.h>
-#include <wchar.h>
-#include <wctype.h>
-#include <heapstring.h>
-#include <string.h>
-#include "crtimps.h"
-
-
-/*********************************************************************
- *           _fgetwchar  (CRTDLL.93)
- */
-wint_t CDECL CRTDLL__fgetwchar( void *i )
-{
-  // TODO: Check if really ok.
-  dprintf2(("CRTDLL: _fgetwchar -> _getch\n"));
-  return CRTDLL__getch();
-}
-
-
-/*********************************************************************
- *           CRTDLL__wcsdup	 (CRTDLL.317)
- */
-LPWSTR CDECL CRTDLL__wcsdup( LPCWSTR str )
-{
-  dprintf2(("CRTDLL: _wcsdup\n"));
-  LPWSTR ret = NULL;
-  if (str)
-  {
-      int size = (wcslen((const wchar_t*)str) + 1) * sizeof(WCHAR);
-      ret = (WCHAR*)CRTDLL_malloc( size );
-      if (ret) memcpy( ret, str, size );
-  }
-  return ret;
-}
-
-
-/*********************************************************************
- *           CRTDLL__wcsicmp	 (CRTDLL.318)
- */
-int CDECL CRTDLL__wcsicmp(LPWSTR str1, LPWSTR str2)
-{
-  dprintf2(("CRTDLL: _wcsicmp(%08xh,%08xh)\n",
-           str1,
-           str2));
-
-  return (CRTDLL__wcsnicmp(str1,
-                       str2,
-                       wcslen((wchar_t*) str1)));
-}
-
-
-/*********************************************************************
- *           CRTDLL__wcsicoll	 (CRTDLL.319)
- */
-int CDECL CRTDLL__wcsicoll( LPCWSTR str1, LPCWSTR str2 )
-{
-  dprintf2(("CRTDLL: _wcsicoll\n"));
-  return CRTDLL__wcsicmp( (LPWSTR)str1, (LPWSTR)str2 );
-}
-
-
-/*********************************************************************
- *           CRTDLL__wcslwr	 (CRTDLL.320)
- */
-LPWSTR CDECL CRTDLL__wcslwr(LPWSTR str)
-{
-  DWORD dwIndex;
-
-  dprintf2(("CRTDLL: _wcslwr(%08xh)\n",
-           str));
-
-  for (dwIndex = wcslen((const wchar_t*)str);
-       dwIndex;
-       dwIndex--)
-  {
-    towlower(str[dwIndex]);
-  }
-
-  return (str);
-}
-
-
-/*********************************************************************
- *           CRTDLL__wcsnicmp	 (CRTDLL.321)
- */
-int CDECL CRTDLL__wcsnicmp(LPCWSTR str1, LPCWSTR str2, int n)
-{
-  dprintf2(("CRTDLL: _wcsnicmp(%08xh,%08xh,%08xh)\n",
-           str1,
-           str2,
-           l));
-
-    if (!n) return 0;
-    while ((--n > 0) && *str1 && (toupperW(*str1) == toupperW(*str2)))
-    {
-        str1++;
-        str2++;
-    }
-    return toupperW(*str1) - toupperW(*str2);
-}
-
-
-/*********************************************************************
- *           CRTDLL__wcsnset    (CRTDLL.322)
- */
-LPWSTR CDECL CRTDLL__wcsnset( LPWSTR str, WCHAR c, INT n )
-{
-    dprintf2(("CRTDLL: _wcsnset\n"));
-    LPWSTR ret = str;
-    while ((n-- > 0) && *str) *str++ = c;
-    return ret;
-}
-
-
-/*********************************************************************
- *           CRTDLL__wcsrev	 (CRTDLL.323)
- */
-LPWSTR CDECL CRTDLL__wcsrev( LPWSTR str )
-{
-  dprintf2(("CRTDLL: _wcsrev\n"));
-  LPWSTR ret = str;
-  LPWSTR end = str + wcslen((const wchar_t*)str) - 1;
-  while (end > str)
-  {
-      WCHAR t = *end;
-      *end--  = *str;
-      *str++  = t;
-  }
-  return ret;
-}
-
-
-/*********************************************************************
- *           CRTDLL__wcsset    (CRTDLL.324)
- */
-LPWSTR CDECL CRTDLL__wcsset( LPWSTR str, WCHAR c )
-{
-    dprintf2(("CRTDLL: _wcsset\n"));
-    LPWSTR ret = str;
-    while (*str) *str++ = c;
-    return ret;
-}
-
-
-/*********************************************************************
- *           CRTDLL__wcsupr    (CRTDLL.325)
- */
-LPWSTR CDECL CRTDLL__wcsupr(LPWSTR str)
-{
-  DWORD dwIndex;
-
-  dprintf2(("CRTDLL: _wcsupr(%08xh)\n",
-           str));
-
-  for (dwIndex = wcslen((const wchar_t*)str);
-       dwIndex;
-       dwIndex--)
-  {
-    toupperW(str[dwIndex]);
-  }
-
-  return (str);
-}
-
-
-/*********************************************************************
- *      _wtoi			 		(CRTDLL.330)
- */
-int CDECL CRTDLL__wtoi( const wchar_t *s )
-{
-  // int -32768-32768 = size 6 + null-terminatedstr
-  char tempstr[7];
-
-  WideCharToMultiByte(0, // = CP_ACP
-                      0,
-                      (LPCWSTR)s,
-                      -1,
-                      tempstr,
-                      7,
-                      NULL,
-                      NULL);
-
-  return (atoi(tempstr));
-}
-
-
-/*********************************************************************
- *	_wtol			 		(CRTDLL.331)
- */
-long int CDECL CRTDLL__wtol( const wchar_t *s )
-{
-  // long int -2147483647-2147483647 = size 10 + null-terminatedstr
-  char tempstr[11];
-  WideCharToMultiByte(0, // = CP_ACP
-                      0,
-                      (LPCWSTR)s,
-                      -1,
-                      tempstr,
-                      11,
-                      NULL,
-                      NULL);
-
-  return (atol(tempstr));
-
-  return 0;
-}
-
-
-/*********************************************************************
- *                  fgetwc	(CRTDLL.366)
- */
-wint_t CDECL CRTDLL_fgetwc( FILE *f )
-{
-  dprintf2(("CRTDLL: fgetwc\n"));
-  return (fgetwc(f));
-}
-
-
-/*********************************************************************
- *                  fputwc  (CRTDLL.373)
- */
-wint_t CDECL CRTDLL_fputwc( wint_t wc, FILE *strm )
-{
-  dprintf2(("CRTDLL: fputwc\n"));
-  return (fputwc(wc, strm));
-}
-
-
-/*********************************************************************
- *                  iswalnum    (CRTDLL.402)
- */
-int CDECL CRTDLL_iswalnum(wint_t i)
-{
-  dprintf2(("CRTDLL: iswalnum(%08xh)\n", i));
-  //return get_char_typeW(wc) & (C1_ALPHA|C1_DIGIT|C1_LOWER|C1_UPPER);
-  return (iswalnum(i));
-}
-
-
-/*********************************************************************
- *                  iswalpha    (CRTDLL.403)
- */
-int CDECL CRTDLL_iswalpha(wint_t i)
-{
-  dprintf2(("CRTDLL: iswalpha(%08xh)\n", i));
-  return (iswalpha(i));
-  //return get_char_typeW(wc) & (C1_ALPHA|C1_LOWER|C1_UPPER);
-}
-
-
-/*********************************************************************
- *                  iswcntrl    (CRTDLL.405)
- */
-int CDECL CRTDLL_iswcntrl(wint_t i)
-{
-  dprintf2(("CRTDLL: iswcntrl(%08xh)\n", i));
-  //return get_char_typeW(wc) & C1_CNTRL;
-  return (iswcntrl(i));
-}
-
-
-/*********************************************************************
- *                  iswctype    (CRTDLL.406)
- */
-int CDECL CRTDLL_iswctype(wint_t i, wctype_t wct)
-{
-  dprintf2(("CRTDLL: iswctype(%08xh, %08xh)\n", i, wct));
-  return (iswctype(i, wct));
-}
-
-
-/*********************************************************************
- *                  iswdigit    (CRTDLL.407)
- */
-int CDECL CRTDLL_iswdigit(wint_t i)
-{
-  dprintf2(("CRTDLL: iswdigit(%08xh)\n", i));
-  //return get_char_typeW(wc) & C1_DIGIT;
-  return (iswdigit(i));
-}
-
-
-/*********************************************************************
- *                  iswgraph    (CRTDLL.408)
- */
-int CDECL CRTDLL_iswgraph(wint_t i)
-{
-  dprintf2(("CRTDLL: iswgraph(%08xh)\n", i));
-  //return get_char_typeW(wc) & (C1_ALPHA|C1_PUNCT|C1_DIGIT|C1_LOWER|C1_UPPER);
-  return (iswgraph(i));
-}
-
-
-/*********************************************************************
- *                  iswlower    (CRTDLL.409)
- */
-int CDECL CRTDLL_iswlower(wint_t i)
-{
-  dprintf2(("CRTDLL: iswlower(%08xh)\n", i));
-  //return get_char_typeW(wc) & C1_LOWER;
-  return (iswlower(i));
-}
-
-
-/*********************************************************************
- *                  iswprint    (CRTDLL.410)
- */
-int CDECL CRTDLL_iswprint(wint_t i)
-{
-  dprintf2(("CRTDLL: iswprint(%08xh)\n", i));
-  //return get_char_typeW(wc) & (C1_ALPHA|C1_BLANK|C1_PUNCT|C1_DIGIT|C1_LOWER|C1_UPPER);
-  return (iswprint(i));
-}
-
-
-/*********************************************************************
- *                  iswpunct    (CRTDLL.411)
- */
-int CDECL CRTDLL_iswpunct(wint_t i)
-{
-  dprintf2(("CRTDLL: iswpunct(%08xh)\n", i));
-  //return get_char_typeW(wc) & C1_PUNCT;
-  return (iswpunct(i));
-}
-
-
-/*********************************************************************
- *                  iswspace    (CRTDLL.412)
- */
-int CDECL CRTDLL_iswspace(wint_t i)
-{
-  dprintf2(("CRTDLL: iswspace(%08xh)\n", i));
-  //return get_char_typeW(wc) & C1_SPACE;
-  return (iswspace(i));
-}
-
-
-/*********************************************************************
- *                  iswupper    (CRTDLL.413)
- */
-int CDECL CRTDLL_iswupper(wint_t i)
-{
-  dprintf2(("CRTDLL: iswupper(%08xh)\n", i));
-  //return get_char_typeW(wc) & C1_UPPER;
-  return (iswupper(i));
-}
-
-
-/*********************************************************************
- *                  iswxdigit    (CRTDLL.414)
- */
-int CDECL CRTDLL_iswxdigit(wint_t i)
-{
-  dprintf2(("CRTDLL: iswxdigit(%08xh)\n", i));
-  //return get_char_typeW(wc) & C1_XDIGIT;
-  return (iswxdigit(i));
-}
-
-
-/*********************************************************************
- *                  swprintf         (CRTDLL.480)
- */
-int CDECL CRTDLL_swprintf(const LPWSTR str,
-                      int   i,
-                      const LPWSTR format,
-                      ...)
-{
-  va_list valist;
-  int     rc;
-
-  dprintf2(("CRTDLL: swprintf(%s,%d,%s)\n",
-           str,
-           i,
-           format));
-
-  va_start( valist, format );
-  rc = vswprintf( (wchar_t*)str,
-                  i,
-                  (wchar_t*)format,
-                  valist );
-  va_end( valist );
-  return rc;
-}
-
-
-/*********************************************************************
- *	swscanf				   	(CRTDLL.481)
- */
-int CDECL CRTDLL_swscanf( const wchar_t *s1, const wchar_t *s2, va_list arg )
-{
-  dprintf(("CRTDLL: swscanf\n"));
-  return (swscanf(s1, s2, arg));
-}
-
-
-/*********************************************************************
- *                  towlower       (CRTDLL.490)
- */
-WCHAR CDECL CRTDLL_towlower(WCHAR c)
-{
-  dprintf2(("CRTDLL: towlower(%c)\n",
-           c));
-
-  return (towlower(c));
-}
-
-
-/*********************************************************************
- *                  toupperW       (CRTDLL.491)
- */
-WCHAR CDECL CRTDLL_towupper(WCHAR c)
-{
-  dprintf2(("CRTDLL: towupper(%c)\n",
-           c));
-
-  return (toupperW(c));
-}
-
-
-/*********************************************************************
- *                  ungetwc           (CRTDLL.493)
- */
-wint_t CDECL CRTDLL_ungetwc( wint_t wc, FILE *strm )
-{
-  dprintf2(("CRTDLL: ungetwc\n"));
-  return (ungetwc(wc, strm));
-}
-
-
-/*********************************************************************
- *                  wcscat            (CRTDLL.500)
- */
-wchar_t* CDECL CRTDLL_wcscat(      wchar_t* str1,
-                       const wchar_t* str2)
-{
-  dprintf2(("CRTDLL: wcscat(%08xh,%08xh)\n",
-           str1,
-           str2));
-
-  return (wcscat(str1, str2));
-}
-
-
-/*********************************************************************
- *                  wcschr            (CRTDLL.501)
- */
-wchar_t* CDECL CRTDLL_wcschr(const wchar_t* str,
-                       int          i)
-{
-  dprintf2(("CRTDLL: wcschr(%08xh,%08xh)\n",
-           str,
-           i));
-
-  return (wcschr(str, i));
-}
-
-
-/*********************************************************************
- *                  wcscmp            (CRTDLL.502)
- */
-int CDECL CRTDLL_wcscmp(const wchar_t* str1,
-                    const wchar_t* str2)
-{
-  dprintf2(("CRTDLL: wcscmp(%08xh,%08xh)\n",
-           str1,
-           str2));
-
-  return (wcscmp(str1, str2));
-}
-
-
-/*********************************************************************
- *                  wcscoll    (CRTDLL.503)
- */
-DWORD CDECL CRTDLL_wcscoll(LPCWSTR str1, LPCWSTR str2)
-{
-  dprintf2(("CRTDLL: wcscoll\n"));
-  return (wcscoll((const wchar_t*)str1, (const wchar_t*)str2));
-}
-
-
-/*********************************************************************
- *                  wcscpy            (CRTDLL.504)
- */
-wchar_t* CDECL CRTDLL_wcscpy(      wchar_t* str1,
-                       const wchar_t* str2)
-{
-  dprintf2(("CRTDLL: wcscpy(%08xh,%08xh)\n",
-           str1,
-           str2));
-
-  return (wcscpy(str1, str2));
-}
-
-
-/*********************************************************************
- *                  wcscspn            (CRTDLL.505)
- */
-size_t CDECL CRTDLL_wcscspn(const wchar_t* str1,
-                              wchar_t* str2)
-{
-  dprintf2(("CRTDLL: wcscspn(%08xh,%08xh)\n",
-           str1,
-           str2));
-
-  return (wcscspn(str1, str2));
-}
-
-
-/*********************************************************************
- *                  wcsftime   (CRTDLL.506)
- */
-size_t CDECL CRTDLL_wcsftime( wchar_t *s, size_t maxsize, 
-		const wchar_t *format, const struct tm *timeptr )
-{
-  dprintf2(("CRTDLL: wcsftime\n"));
-  return (wcsftime(s, maxsize, format, timeptr));
-}
-
-
-/*********************************************************************
- *                  wcslen            (CRTDLL.507)
- */
-size_t CDECL CRTDLL_wcslen(const wchar_t* str)
-{
-  dprintf2(("CRTDLL: wcslen(%08xh)\n",
-           str));
-
-  return (wcslen(str));
-}
-
-
-/*********************************************************************
- *                  wcsncat            (CRTDLL.508)
- */
-wchar_t* CDECL CRTDLL_wcsncat(      wchar_t* str1,
-                        const wchar_t* str2,
-                        size_t      i)
-{
-  dprintf2(("CRTDLL: wcsncat(%08xh,%08xh,%08xh)\n",
-           str1,
-           str2,
-           i));
-
-  return (wcsncat(str1, str2, i));
-}
-
-
-
-/*********************************************************************
- *                  wcsncmp            (CRTDLL.509)
- */
-int CDECL CRTDLL_wcsncmp(const wchar_t* str1,
-                     const wchar_t* str2,
-                     size_t      i)
-{
-  dprintf2(("CRTDLL: wcsncmp(%08xh,%08xh,%08xh)\n",
-           str1,
-           str2,
-           i));
-
-  return (wcsncmp(str1, str2, i));
-}
-
-
-/*********************************************************************
- *                  wcsncmp            (CRTDLL.510)
- */
-wchar_t* CDECL CRTDLL_wcsncpy(      wchar_t* str1,
-                          const wchar_t* str2,
-                          size_t       i)
-{
-  dprintf2(("CRTDLL: wcsncpy(%s,%s,%08xh)\n",
-           str1,
-           str2,
-           i));
-
-  return (wcsncpy(str1, str2, i));
-}
-
-
-/*********************************************************************
- *                  wcspbrk            (CRTDLL.511)
- */
-wchar_t* CDECL CRTDLL_wcspbrk(const wchar_t* str1,
-                        const wchar_t* str2)
-{
-  dprintf2(("CRTDLL: wcspbrk(%08xh,%08xh)\n",
-           str1,
-           str2));
-
-  return (wcspbrk(str1, str2));
-}
-
-
-/*********************************************************************
- *                  wcsrchr            (CRTDLL.512)
- */
-wchar_t* CDECL CRTDLL_wcsrchr(const wchar_t* str,
-                        size_t       i)
-{
-  dprintf2(("CRTDLL: wcsrchr(%08xh,%08xh)\n",
-           str,
-           i));
-
-  return (wcsrchr(str, i));
-}
-
-
-/*********************************************************************
- *                  wcsspn             (CRTDLL.513)
- */
-size_t CDECL CRTDLL_wcsspn(const wchar_t* str1,
-                       const wchar_t* str2)
-{
-  dprintf2(("CRTDLL: wcsspn(%08xh,%08xh)\n",
-           str1,
-           str2));
-
-  return (wcsspn(str1, str2));
-}
-
-
-/*********************************************************************
- *                  wcsstr   (CRTDLL.514)
- */
-wchar_t* CDECL CRTDLL_wcsstr(const wchar_t* str1,
-                         const wchar_t* str2)
-{
-  dprintf2(("CRTDLL: wcsstr(%s,%s)\n",
-           str1,
-           str2));
-
-  return (wcsstr(str1, str2));
-}
-
-
-/*********************************************************************
- *                  wcstod   (CRTDLL.515)
- */
-double CDECL CRTDLL_wcstod( const wchar_t *nptr, wchar_t **endptr )
-{
-  dprintf2(("CRTDLL: wcstod\n"));
-  return (wcstod(nptr, endptr));
-}
-
-
-/*********************************************************************
- *                  wcstok   (CRTDLL.516)
- */
-wchar_t * CDECL CRTDLL_wcstok( wchar_t *s1, const wchar_t *s2, wchar_t **ptr )
-{
-  dprintf2(("CRTDLL: wcstok(%08xh, %08xh, %08xh)\n",s1,s2,ptr));
-  return (wcstok(s1, s2, ptr));
-}
-
-
-/*********************************************************************
- *                  wcstol   (CRTDLL.517)
- */
-long int CDECL CRTDLL_wcstol( const wchar_t *s1, wchar_t **s2, int i )
-{
-  dprintf2(("CRTDLL: wcstol(%08xh, %08xh, %08xh)\n",s1,s2,i));
-  return (wcstol(s1, s2, i));
-}
-
-
-/*********************************************************************
- *                  wcstombs   (CRTDLL.518)
- */
-size_t CDECL CRTDLL_wcstombs( char *s, const wchar_t *pwcs, size_t n )
-{
-  dprintf2(("CRTDLL: wcstombs(%08xh, %08xh, %08xh)\n",s,pwcs,n));
-  return (wcstombs(s, pwcs, n));
-}
-
-
-/*********************************************************************
- *                  wcstoul   (CRTDLL.519)
- */
-unsigned long int CDECL CRTDLL_wcstoul( const wchar_t *s1, wchar_t **s2, int i )
-{
-  dprintf2(("CRTDLL: wcstoul(%08xh, %08xh, %08xh)\n",s1,s2,i));
-  return (wcstoul(s1, s2, i));
-}
-
-
-/*********************************************************************
- *                  wcsxfrm   (CRTDLL.520)
- */
-size_t CDECL CRTDLL_wcsxfrm( wchar_t *s1, const wchar_t *s2, size_t n )
-{
-  dprintf2(("CRTDLL: wcsxfrm\n"));
-  return (wcsxfrm(s1, s2, n));
-}
-
-
-/*********************************************************************
- *                  wctomb   (CRTDLL.521)
- */
-int CDECL CRTDLL_wctomb( LPSTR dst, WCHAR ch )
-{
-  dprintf2(("CRTDLL: wctomb\n"));
-  //return WideCharToMultiByte( CP_ACP, 0, &ch, 1, dst, 6, NULL, NULL );
-  return (wctomb((char*)dst,ch));
-}
Index: trunk/src/crtdll/crtdll.cpp
===================================================================
--- trunk/src/crtdll/crtdll.cpp	(revision 9655)
+++ 	(revision )
@@ -1,1821 +1,0 @@
-/*
- * The C RunTime DLL
- * 
- * Implements C run-time functionality as known from UNIX.
- *
- * TODO: 
- *   - Check setjmp(3)
- *   - fix *ALL* functions for the FS: wrapper problem
- *
- * Partialy based on Wine
- *
- * Copyright 1996,1998 Marcus Meissner
- * Copyright 1996 Jukka Iivonen
- * Copyright 1997 Uwe Bonnes
- * Copyright 1999-2000 Jens Wiessner
- * Copyright 2000 Przemyslaw Dobrowolski
- */
-
-
-#include <odin.h>
-#include <odinwrap.h>
-#include <os2sel.h>
-
-
-
-#include <os2win.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <misc.h>
-#include <unicode.h>
-#include <heapstring.h>
-#include <ctype.h>
-#include <setjmp.h>
-#include <ntddk.h>
-#include <debugtools.h>
-
-#include <math.h>
-#include <libc\locale.h>
-#include <signal.h>
-#include <io.h>
-#include <assert.h>
-#include <process.h>
-#include <float.h>
-#include <conio.h>
-#include <direct.h>
-#include <malloc.h>
-#include <drive.h>
-#include <fcntl.h>
-#include <search.h>
-#include <heap.h>
-#include <errno.h>
-#include <sys\utime.h>
-#include <sys\timeb.h>
-#include <sys\stat.h>
-#include "signal.h"
-#include <time.h>
-
-#include <crtdll.h>
-// #include <ieee.h>
-#include <asmhlp.h>
-#include "crtinc.h"
-
-
-ODINDEBUGCHANNEL(CRTDLL)
-
-#undef dprintf2
-#define dprintf2 dprintf
-
-
-//
-// Definitions for internal functions
-//
-void 		qsort1 (char*, char*, size_t,
-                    int (* CDECL)(const void*, const void*));
-
-
-
-/*********************************************************************
- *                  _CIacos    (CRTDLL.004)
- */
-double CDECL CRTDLL__CIacos()
-{
-  double x;
-  dprintf2(("CRTDLL: _CIacos\n"));
-  POP_FPU(x);
-  return acos(x);
-}
-
-
-/*********************************************************************
- *                  _CIasin    (CRTDLL.005)
- */
-double CDECL CRTDLL__CIasin()
-{
-  double x;
-  dprintf2(("CRTDLL: _CIasin\n"));
-  POP_FPU(x);
-  return asin(x);
-}
-
-
-/*********************************************************************
- *                  _CIatan    (CRTDLL.006)
- */
-double CDECL CRTDLL__CIatan()
-{
-  double x;
-  dprintf2(("CRTDLL: _CIatan\n"));
-  POP_FPU(x);
-  return atan(x);
-}
-
-
-/*********************************************************************
- *                  _CIatan2    (CRTDLL.007)
- */
-double CDECL CRTDLL__CIatan2()
-{
-  double x, y;
-  dprintf2(("CRTDLL: _CIatan2\n"));
-  POP_FPU(y);
-  POP_FPU(x);
-  return atan2(x,y);
-}
-
-
-/*********************************************************************
- *                  _CIcos    (CRTDLL.008)
- */
-double CDECL CRTDLL__CIcos()
-{
-  double x;
-  dprintf2(("CRTDLL: _CIcos\n"));
-  POP_FPU(x);
-  return cos(x);
-}
-
-
-/*********************************************************************
- *                  _CIcosh    (CRTDLL.009)
- */
-double CDECL CRTDLL__CIcosh()
-{
-  double x;
-  dprintf2(("CRTDLL: _CIcosh\n"));
-  POP_FPU(x);
-  return cosh(x);
-}
-
-
-/*********************************************************************
- *                  _CIexp    (CRTDLL.010)
- */
-double CDECL CRTDLL__CIexp()
-{
-  double x;
-  dprintf2(("CRTDLL: _CIexp\n"));
-  POP_FPU(x);
-  return exp(x);
-}
-
-
-/*********************************************************************
- *                  _CIfmod     (CRTDLL.011)
- */
-double CDECL CRTDLL__CIfmod( )
-{
-  double x, y;
-  dprintf2(("CRTDLL: _CIfmod\n"));
-  POP_FPU(y);
-  POP_FPU(x);
-  return fmod(x,y);
-}
-
-
-/*********************************************************************
- *                  _CIlog    (CRTDLL.012)
- */
-double CDECL CRTDLL__CIlog()
-{
-  double x;
-  dprintf2(("CRTDLL: _CIlog\n"));
-  POP_FPU(x);
-  return log(x);
-}
-
-
-/*********************************************************************
- *                  _CIlog10    (CRTDLL.013)
- */
-double CDECL CRTDLL__CIlog10()
-{
-  double x;
-  dprintf2(("CRTDLL: _CIlog10\n"));
-  POP_FPU(x);
-  return log10(x);
-}
-
-
-/*********************************************************************
- *                  _CIpow     (CRTDLL.014)
- */
-LONG CDECL CRTDLL__CIpow()
-{
-  double x,y;
-  dprintf2(("CRTDLL: _CIpow\n"));
-  POP_FPU(y);
-  POP_FPU(x);
-  return pow(x,y);
-}
-
-
-
-
-/*********************************************************************
- *                  _CIsin     (CRTDLL.015)
- */
-double CDECL CRTDLL__CIsin()
-{
-  double x;
-  dprintf2(("CRTDLL: _CIsin\n"));
-  POP_FPU(x);
-  return sin(x);
-}
-
-
-/*********************************************************************
- *                  _CIsinh    (CRTDLL.016)
- */
-double CDECL CRTDLL__CIsinh()
-{
-  double x;
-  dprintf2(("CRTDLL: _CIsinh\n"));
-  POP_FPU(x);
-  return sinh(x);
-}
-
-
-/*********************************************************************
- *                  _CIsqrt    (CRTDLL.017)
- */
-double CDECL CRTDLL__CIsqrt()
-{
-  double x;
-  dprintf2(("CRTDLL: _CIsqrt\n"));
-  POP_FPU(x);
-  return sqrt(x);
-}
-
-
-/*********************************************************************
- *                  _CItan    (CRTDLL.018)
- */
-double CDECL CRTDLL__CItan()
-{
-  double x;
-  dprintf2(("CRTDLL: _CItan\n"));
-  POP_FPU(x);
-  return tan(x);
-}
-
-
-/*********************************************************************
- *                  _CItanh    (CRTDLL.019)
- */
-double CDECL CRTDLL__CItanh()
-{
-  double x;
-  dprintf2(("CRTDLL: _CItanh\n"));
-  POP_FPU(x);
-  return tanh(x);
-}
-
-
-/*********************************************************************
- *                  _XcptFilter    (CRTDLL.21)
- */
-INT CDECL CRTDLL__XcptFilter(DWORD ret, struct _EXCEPTION_POINTERS *  ExceptionInfo )
-{
-  dprintf2(("CRTDLL: _XcptFilter\n"));
-  return UnhandledExceptionFilter(ExceptionInfo);
-}
-
-
-/*********************************************************************
- *           CRTDLL___threadhandle   (CRTDLL.33)
- */
-unsigned long CDECL CRTDLL___threadhandle( void )
-{
-  dprintf2(("CRTDLL: __threadhandle\n"));
-  return GetCurrentThread();
-}
-
-
-/*********************************************************************
- *           CRTDLL___threadid   (CRTDLL.34)
- */
-unsigned long CDECL CRTDLL___threadid(void)
-{
-  dprintf2(("CRTDLL: __threadid\n"));
-  return GetCurrentThreadId();
-}
-
-
-/*********************************************************************
- *           _beginthread   (CRTDLL.46)
- */
-int CDECL CRTDLL__beginthread (void (*start)(void *arg), void *stack, unsigned stack_size,
-                  void *arg_list)
-{
-  dprintf(("CRTDLL: _beginthread\n"));
-/*
-  ULONG rc;
-  TID tid;
-  struct _thread *tp;
-  tp = __alloc_thread ();
-  if (tp == NULL)
-    {
-      errno = ENOMEM;
-      return -1;
-    }
-  tp->_th_start = start;
-  tp->_th_arg = arg_list;
-  rc = DosCreateThread (&tid, (PFNTHREAD)start_thread, (ULONG)tp,
-                        3, stack_size);
-  if (rc != 0)
-    {
-      if (rc == ERROR_NOT_ENOUGH_MEMORY)
-        errno = ENOMEM;
-      else if (rc == ERROR_MAX_THRDS_REACHED)
-        errno = EAGAIN;
-      else
-        errno = EINVAL;
-      DosFreeMem (tp);
-      return -1;
-    }
-  if (tid > MAX_THREADS)
-    {
-      DosKillThread (tid);
-      errno = EAGAIN;
-      DosFreeMem (tp);
-      return -1;
-    }
-  if (__newthread (tid) != 0)
-    {
-      DosKillThread (tid);
-      DosFreeMem (tp);
-      return -1;
-    }
-  _thread_tab[tid] = tp;
-  rc = DosResumeThread (tid);
-  if (rc != 0)
-    {
-      errno = ESRCH;
-      DosFreeMem (tp);
-      return -1;
-    }
-  return tid;
-*/
-  return 0;
-}
-
-
-/*********************************************************************
- *           CRTDLL__cgets  (CRTDLL.50)
- */
-char * CDECL CRTDLL__cgets( char *s )
-{
-  dprintf2(("CRTDLL: _cgets\n"));
-  return (_cgets(s));
-}
-
-
-/*********************************************************************
- *           CRTDLL__chmod   (CRTDLL.54)
- */
-int CDECL CRTDLL__chmod( const char *s, int i)
-{
-  dprintf2(("CRTDLL: _chmod\n"));
-  return (_chmod(s, i));
-}
-
-
-/*********************************************************************
- *           CRTDLL__chsize   (CRTDLL.55)
- */
-int CDECL CRTDLL__chsize( int i, long l )
-{
-  dprintf2(("CRTDLL: _chsize\n"));
-  return (_chsize(i, l));
-}
-
-
-/*********************************************************************
- *           CRTDLL__clearfp  (CRTDLL.56)
- */
-unsigned int CDECL CRTDLL__clearfp( void )
-{
-  dprintf2(("CRTDLL: _clearfp\n"));
-  return (_clear87());
-}
-
-
-/*********************************************************************
- *           CRTDLL__control87   (CRTDLL.60)
- */
-unsigned CDECL CRTDLL__control87(unsigned i1,unsigned i2)
-{
-  dprintf2(("CRTDLL: _control87\n"));
-  return (_control87(i1, i2));
-}
-
-
-/*********************************************************************
- *                  CRTDLL__controlfp    (CRTDLL.61)
- */
-unsigned CDECL CRTDLL__controlfp(unsigned i1,unsigned i2)
-{
-  dprintf2(("CRTDLL: _controlfp\n"));
-  return (_control87(i1, i2));
-}
-
-
-/*********************************************************************
- *                  _cprintf    (CRTDLL.63)
- */
-INT CDECL CRTDLL__cprintf( char *fmt, va_list arg )
-{
-  dprintf2(("CRTDLL: _cprintf.\n"));
-  return (_cprintf(fmt, arg));
-}
-
-
-/*********************************************************************
- *                  CRTDLL__cputs      (CRTDLL.65)
- */
-INT CDECL CRTDLL__cputs( char * s )
-{
-  dprintf2(("CRTDLL: _cputs\n"));
-  return (_cputs(s));
-}
-
-
-/*********************************************************************
- *	_cscanf	    				(CRTDLL.67)
- */
-INT CDECL CRTDLL__cscanf( char *s, va_list arg )
-{
-  dprintf(("CRTDLL: _cscanf\n"));
-  return (_cscanf(s, arg));
-}
-
-
-/*********************************************************************
- *           CRTDLL__cwait   (CRTDLL.69)
- */
-int CDECL CRTDLL__cwait( int *status, int process_id, int action_code )
-{
-  dprintf2(("CRTDLL: _cwait\n"));
-  return (_cwait(status, process_id, action_code));
-}
-
-
-/*********************************************************************
- *           CRTDLL__dup   (CRTDLL.71)
- */
-int CDECL CRTDLL__dup(int handle)
-{
-  dprintf2(("CRTDLL: _dup\n"));
-  return (_dup(handle));
-}
-
-
-/*********************************************************************
- *           CRTDLL__dup2  (CRTDLL.72)
- */
-int CDECL CRTDLL__dup2(int handle1,int handle2)
-{
-  dprintf2(("CRTDLL: _dup2\n"));
-  return (_dup2(handle1, handle2));
-}
-
-
-/*********************************************************************
- *           CRTDLL__ecvt  (CRTDLL.73)
- */
-char * CDECL CRTDLL__ecvt( double val, int ndig, int *dec, int *sign )
-{
-  dprintf2(("CRTDLL: _ecvt\n"));
-  return (_ecvt(val, ndig, dec, sign));
-}
-
-
-/*********************************************************************
- *           CRTDLL__endthread  (CRTDLL.74)
- */
-void CDECL CRTDLL__endthread(void)
-{
-  dprintf2(("CRTDLL: _endthread\n"));
-  _endthread ();
-}
-
-
-/*********************************************************************
- *           _execl   (CRTDLL.79)
- */
-int CDECL CRTDLL__execl(char* szPath, char* szArgv0, va_list arg)
-{
-  dprintf2(("CRTDLL: _execl\n"));
-  return (_execl(szPath, szArgv0, arg));
-}
-
-
-/*********************************************************************
- *           _execle   (CRTDLL.80)
- */
-int CDECL CRTDLL__execle(char *path, char *szArgv0, va_list arg)
-{
-  dprintf2(("CRTDLL: _execle\n"));
-  return (_execle(path, szArgv0, arg));
-}
-
-
-/*********************************************************************
- *           CRTDLL__execlp   (CRTDLL.81)
- */
-int CDECL CRTDLL__execlp( char *szPath, char *szArgv0, va_list arg)
-{
-  dprintf2(("CRTDLL: _execlp\n"));
-  return (_execlp(szPath, szArgv0, arg));
-}
-
-
-/*********************************************************************
- *           CRTDLL__execlpe   (CRTDLL.82)
- */
-int CDECL CRTDLL__execlpe( char *path, char *szArgv0, va_list arg)
-{
-  dprintf2(("CRTDLL: _execlpe\n"));
-  return (_execlpe(path, szArgv0, arg));
-}
-
-
-/*********************************************************************
- *           CRTDLL__execv   (CRTDLL.83)
- */
-int CDECL CRTDLL__execv( char *s1, char **s2)
-{
-  dprintf2(("CRTDLL: _execv\n"));
-  return (_execv(s1, s2));
-}
-
-
-/*********************************************************************
- *           CRTDLL__execve   (CRTDLL.84)
- */
-int CDECL CRTDLL__execve( char *s1, char **s2, char **s3)
-{
-  dprintf2(("CRTDLL: _execve\n"));
-  return (_execve(s1, s2, s3));
-}
-
-
-/*********************************************************************
- *           CRTDLL__execvp   (CRTDLL.85)
- */
-int CDECL CRTDLL__execvp( char *s1, char **s2)
-{
-  dprintf2(("CRTDLL: _execvp\n"));
-  return (_execvp(s1, s2));
-}
-
-
-/*********************************************************************
- *           CRTDLL__execvpe   (CRTDLL.86)
- */
-int CDECL CRTDLL__execvpe( char *s1, char **s2, char **s3)
-{
-  dprintf2(("CRTDLL: _execvpe\n"));
-  return (_execvpe(s1, s2, s3));
-}
-
-
-/*********************************************************************
- *           _fcvt  (CRTDLL.90)
- */
-char * CDECL CRTDLL__fcvt( double val, int ndig, int *dec, int *sign )
-{
-  dprintf2(("CRTDLL: _fcvt\n"));
-  return (_fcvt(val, ndig, dec, sign));
-}
-
-
-/*********************************************************************
- *           CRTDLL__filelength     (CRTDLL.96)
- */
-long CDECL CRTDLL__filelength( int i )
-{
-  dprintf2(("CRTDLL: _filelength\n"));
-  return (_filelength(i));
-}
-
-
-/*********************************************************************
- *	_ftime					(CRTDLL.112)
- */
-void CDECL CRTDLL__ftime( struct timeb *timebuf )
-{
-  dprintf(("CRTDLL: _ftime\n"));
-  _ftime(timebuf);
-}
-
-
-/*********************************************************************
- *                  _ftol         (CRTDLL.113)
- */
-LONG CDECL CRTDLL__ftol(void)
-{
-	/* don't just do DO_FPU("fistp",retval), because the rounding
-	 * mode must also be set to "round towards zero"... */
-	double fl;
-	POP_FPU(fl);
-	return (LONG)fl;
-}
-
-
-/*********************************************************************
- *                  _gcvt     (CRTDLL.116)
- */
-char * CDECL CRTDLL__gcvt( double val, int ndig, char *buf )
-{
-  dprintf2(("CRTDLL: _gcvt\n"));
-  return (_gcvt(val, ndig, buf));
-}
-
-
-/*********************************************************************
- *                  _getch     (CRTDLL.118)
- */
-int CDECL CRTDLL__getch(void)
-{
-  dprintf2(("CRTDLL: _getch\n"));
-  return (_getch());
-}
-
-
-/*********************************************************************
- *                  _getche     (CRTDLL.119)
- */
-int CDECL CRTDLL__getche(void)
-{
-  dprintf2(("CRTDLL: _getche\n"));
-  return (_getche());
-}
-
-
-/*********************************************************************
- *                  _getdrives    (CRTDLL.125)
- */
-unsigned long CDECL CRTDLL__getdrives(void)
-{
-  dprintf2(("CRTDLL: _getdrives\n"));
-  return GetLogicalDrives();
-}
-
-
-/*********************************************************************
- *                  _getpid    (CRTDLL.126)
- */
-int CDECL CRTDLL__getpid( void )
-{
-  dprintf2(("CRTDLL: _getpid\n"));
-  return (_getpid());
-}
-
-
-/*********************************************************************
- *                  _getsystime    (CRTDLL.127)
- */
-unsigned int CDECL CRTDLL__getsystime(struct tm *tp)
-{
-  SYSTEMTIME  systemtime;
-
-  GetLocalTime(&systemtime);
-
-  tp->tm_isdst = -1; // FIXME: I don't know is there a correct value
-  tp->tm_sec   = systemtime.wSecond;
-  tp->tm_min   = systemtime.wMinute;
-  tp->tm_hour  = systemtime.wHour;
-  tp->tm_mday  = systemtime.wDay;
-  tp->tm_mon   = systemtime.wMonth - 1;
-  // struct tm has time from 1900  -> 2000 = 100
-  tp->tm_year  = systemtime.wYear - 1900;
-  tp->tm_wday  = systemtime.wDayOfWeek;
-
-  mktime(tp);
-
-  return (0); // FIXME: What Can we return??
-}
-
-
-/*********************************************************************
- *                  _getw     (CRTDLL.128)
- */
-int CDECL CRTDLL__getw( FILE *stream )
-{
-  dprintf2(("CRTDLL: _getw\n"));
-  int x;
-  return (fread (&x, sizeof (x), 1, stream) == 1 ? x : EOF);
-}
-
-
-/*********************************************************************
- *                  _hypot     (CRTDLL.134)
- */
-double CDECL CRTDLL__hypot(double x1, double x2)
-{
-  dprintf2(("CRTDLL: _hypot\n"));
-  return (_hypot(x1, x2));
-}
-
-
-/*********************************************************************
- *                  _itoa      (CRTDLL.165)
- */
-char * CDECL CRTDLL__itoa(int i, char *s, int r)
-{
-  dprintf2(("CRTDLL: _itoa(%08xh, %08xh, %08xh)\n",
-           i,
-           s,
-           r));
-
-  return (itoa(i,s,r));
-}
-
-/*********************************************************************
- *                  _j0     (CRTDLL.166)
- */
-double CDECL CRTDLL__j0(double x)
-{
-  dprintf2(("CRTDLL: _j0\n"));
-  return (_j0(x));
-}
-
-
-/*********************************************************************
- *                  _j1     (CRTDLL.167)
- */
-double CDECL CRTDLL__j1(double x)
-{
-  dprintf2(("CRTDLL: _j1\n"));
-  return (_j1(x));}
-
-
-/*********************************************************************
- *                  _jn     (CRTDLL.168)
- */
-double CDECL CRTDLL__jn(int i, double x)
-{
-  dprintf2(("CRTDLL: _jn\n"));
-  return (_jn(i, x));
-}
-
-
-/*********************************************************************
- *                  _kbhit     (CRTDLL.169)
- */
-int CDECL CRTDLL__kbhit( void )
-{
-  dprintf2(("CRTDLL: _kbhit\n"));
-  return (_kbhit());
-}
-
-
-/*********************************************************************
- *                  _ltoa 	(CRTDLL.179)
- */
-LPSTR  CDECL CRTDLL__ltoa(long x,LPSTR buf,INT radix)
-{
-    return ltoa(x,buf,radix);
-}
-
-
-/*********************************************************************
- *                  _matherr	(CRTDLL.181)
- */
-double CDECL CRTDLL__matherr( struct exception * excep )
-{
-  dprintf2(("CRTDLL: _matherr\n"));
-  return (_matherr(excep));
-}
-
-
-/*********************************************************************
- *                  _mktemp        (CRTDLL.233)
- */
-char * CDECL CRTDLL__mktemp( char *string )
-{
-  dprintf2(("CRTDLL: _mktemp\n"));
-  int pid, n, saved_errno;
-  char *s;
-
-  pid = _getpid ();
-  s = strchr (string, 0);
-  n = 0;
-  while (s != string && s[-1] == 'X')
-    {
-      --s; ++n;
-      *s = (char)(pid % 10) + '0';
-      pid /= 10;
-    }
-  if (n < 2)
-    return NULL;
-  *s = 'a'; saved_errno = errno;
-  for (;;)
-    {
-      errno = 0;
-      if (_access (string, 0) != 0 && errno == ENOENT)
-        {
-          errno = saved_errno;
-          return string;
-        }
-      if (*s == 'z')
-        {
-          errno = saved_errno;
-          return NULL;
-        }
-      ++*s;
-    }
-}
-
-
-/*********************************************************************
- *                  _purecall     (CRTDLL.249)
- */
-void CDECL CRTDLL__purecall(void)
-{
-  dprintf2(("CRTDLL: _purecall\n"));
-}
-
-/*********************************************************************
- *                  _putch     (CRTDLL.250)
- */
-INT CDECL CRTDLL__putch( int i )
-{
-  dprintf2(("CRTDLL: _putch\n"));
-  return (_putch(i));
-}
-
-
-/*********************************************************************
- *                  _putenv     (CRTDLL.251)
- */
-INT CDECL CRTDLL__putenv(const char *s)
-{
-  dprintf2(("CRTDLL: _putenv\n"));
-  return (_putenv(s));
-}
-
-
-/*********************************************************************
- *                  _putw     (CRTDLL.252)
- */
-INT CDECL CRTDLL__putw( int x, FILE *stream )
-{
-  dprintf2(("CRTDLL: _putw\n"));
-  return (fwrite (&x, sizeof (x), 1, stream) == 1 ? x : EOF);
-}
-
-
-/*********************************************************************
- *                  _rmtmp     (CRTDLL.256)
- */
-INT CDECL CRTDLL__rmtmp(void)
-{
-  dprintf2(("CRTDLL: _rmtmp\n"));
-  return(_rmtmp());
-}
-
-
-/*********************************************************************
- *           CRTDLL__searchenv 	 (CRTDLL.260)
- */
-void CDECL CRTDLL__searchenv(char *file, char *var,char *path )
-{
-  dprintf2(("CRTDLL: _searchenv\n"));
-  _searchenv(file, var, path);
-}
-
-
-/*********************************************************************
- *           CRTDLL__seterrormode 	 (CRTDLL.261)
- */
-void CDECL CRTDLL__seterrormode(int uMode)
-{
-  dprintf2(("CRTDLL: _seterrormode\n"));
-  SetErrorMode(uMode);
-  return;
-}
-
-
-/*********************************************************************
- *           CRTDLL__setjmp 	 (CRTDLL.262)
- */
-int CDECL CRTDLL__setjmp( jmp_buf env )
-{
-  //TODO:
-  dprintf2(("CRTDLL: _setjmp -> setjmp (NOT IDENTICAL!!!)\n"));
-  return(setjmp( env));
-}
-
-
-/*********************************************************************
- *                  _setsystime    (CRTDLL.264)
- */
-unsigned int CDECL CRTDLL__setsystime(struct tm *tp, unsigned int ms)
-{
-  SYSTEMTIME  systemtime;
-
-  mktime(tp);
-
-  systemtime.wMilliseconds = ms;
-  systemtime.wSecond       = tp->tm_sec;
-  systemtime.wMinute       = tp->tm_min;
-  systemtime.wHour         = tp->tm_hour;
-  systemtime.wDay          = tp->tm_mday;
-  systemtime.wMonth        = tp->tm_mon + 1;
-  // struct tm has time from 1900 -> 2000 = 100
-  systemtime.wYear         = tp->tm_year + 1900;
-
-  if (SetLocalTime(&systemtime) != 0) return GetLastError();
-
-  return (0);
-}
-
-
-/*********************************************************************
- *	_sopen					(CRTDLL.268)
- */
-int CDECL CRTDLL__sopen( const char *s, int i1, int i2, va_list arg )
-{
-  dprintf(("CRTDLL: _sopen\n"));
-  return (_sopen(s, i1, i2, arg));
-}
-
-
-/*********************************************************************
- *           CRTDLL__spawnl 	 (CRTDLL.269)
- */
-int CDECL CRTDLL__spawnl(int nMode, char* szPath, char* szArgv0, va_list arg)
-{
-  dprintf2(("CRTDLL: _spawnl\n"));
-  return (_spawnl(nMode, szPath, szArgv0, arg));
-}
-
-
-/*********************************************************************
- *           CRTDLL__spawnle 	 (CRTDLL.270)
- */
-int CDECL CRTDLL__spawnle( int mode, char *path, char **szArgv0, va_list arg )
-{
-  dprintf2(("CRTDLL: _spawnle\n"));
-  return (_spawnle(mode, path, (char*)szArgv0, arg));
-}
-
-
-/*********************************************************************
- *           CRTDLL__spawnlp 	 (CRTDLL.271)
- */
-int CDECL CRTDLL__spawnlp(int nMode, char* szPath, char* szArgv0, va_list arg)
-{
-  dprintf2(("CRTDLL: _spawnlp\n"));
-  return (_spawnlp(nMode, szPath, szArgv0, arg));
-}
-
-
-/*********************************************************************
- *           CRTDLL__spawnlpe 	 (CRTDLL.272)
- */
-int CDECL CRTDLL__spawnlpe( int mode, char *path, char *szArgv0, va_list arg )
-{
-  dprintf2(("CRTDLL: _spawnlpe\n"));
-  return (_spawnlpe(mode, path, szArgv0, arg));
-}
-
-
-/*********************************************************************
- *           CRTDLL__spawnv 	 (CRTDLL.273)
- */
-int CDECL CRTDLL__spawnv( int i, char *s1, char ** s2 )
-{
-  dprintf2(("CRTDLL: _spawnv\n"));
-  return (_spawnv(i, s1, s2));
-}
-
-
-/*********************************************************************
- *           CRTDLL__spawnvp 	 (CRTDLL.275)
- */
-int CDECL CRTDLL__spawnvp( int i, char *s1, char ** s2 )
-{
-  dprintf2(("CRTDLL: _spawnvp\n"));
-  return (_spawnvp(i, s1, s2));
-}
-
-/*********************************************************************
- *           CRTDLL__spawnv 	 (CRTDLL.276)
- */
-int CDECL CRTDLL__spawnvpe( int i, char *s1, char ** s2, char ** s3 )
-{
-  dprintf2(("CRTDLL: _spawnvpe\n"));
-  return (_spawnvpe(i, s1, s2, s3));
-}
-
-
-/*********************************************************************
- *           CRTDLL__statusfp	 (CRTDLL.279)
- */
-unsigned int CDECL CRTDLL__statusfp( void )
-{
-  dprintf2(("CRTDLL: _statusfp\n"));
-  return (_status87());
-}
-	
-
-/*********************************************************************
- *           _ultoa		 (CRTDLL.309)
- */
-LPSTR  CDECL CRTDLL__ultoa(long x,LPSTR buf,INT radix)
-{
-  dprintf2(("CRTDLL: _ultoa\n"));
-  return _ultoa(x,buf,radix);
-}
-
-
-/*********************************************************************
- *           CRTDLL__ungetch	 (CRTDLL.311)
- */
-int CDECL CRTDLL__ungetch( int i )
-{
-  dprintf2(("CRTDLL: _ungetch\n"));
-  return (_ungetch(i));
-}
-
-
-/*********************************************************************
- *           _utime		 (CRTDLL.314)
- */
-int CDECL CRTDLL__utime( char *path, struct utimbuf * times )
-{
-  dprintf2(("CRTDLL: _utime\n"));
-  return (_utime(path, times));
-}
-
-
-/*********************************************************************
- *	_vsnprintf			 	(CRTDLL.315)
- */
-int CDECL CRTDLL__vsnprintf( char *s, size_t bufsize, const char *format, va_list arg )
-{
-  dprintf2(("CRTDLL: _vsnprintf(%08xh, %08xh, %08xh)\n",
-           s,
-           bufsize,
-           format));
-
-  return wvsnprintfA(s, bufsize, format, arg);
-}
-
-
-/*********************************************************************
- *                  _y0     (CRTDLL.332)
- */
-double CDECL CRTDLL__y0(double x)
-{
-  dprintf2(("CRTDLL: _y0\n"));
-  return (_y0(x));
-}
-
-
-/*********************************************************************
- *                  _y1     (CRTDLL.333)
- */
-double CDECL CRTDLL__y1(double x)
-{
-  dprintf2(("CRTDLL: _y1\n"));
-  return (_y1(x));
-}
-
-
-/*********************************************************************
- *                  _yn     (CRTDLL.334)
- */
-double CDECL CRTDLL__yn(int i, double x)
-{
-  dprintf2(("CRTDLL: _yn\n"));
-  return (_yn(i, x));
-}
-
-
-/*********************************************************************
- *                  abs		(CRTDLL.336)
- */
-double CDECL CRTDLL_abs(double d)
-{
-  dprintf2(("CRTDLL: abs(%f)\n",
-           d));
-
-  return (abs(d));
-}
-
-
-/*********************************************************************
- *                  acos	(CRTDLL.337)
- */
-double CDECL CRTDLL_acos( double x )
-{
-  dprintf2(("CRTDLL: acos\n"));
-  return (acos(x));
-}
-
-
-/*********************************************************************
- *                  asctime	(CRTDLL.338)
- */
-char * CDECL CRTDLL_asctime( const struct tm *timeptr )
-{
-  dprintf2(("CRTDLL: asctime\n"));
-  return (asctime(timeptr));
-}
-
-
-/*********************************************************************
- *                  asin	(CRTDLL.339)
- */
-double CDECL CRTDLL_asin( double x )
-{
-  dprintf2(("CRTDLL: asin\n"));
-  return (asin(x));
-}
-
-
-/*********************************************************************
- *                  atan 	(CRTDLL.340)
- */
-double CDECL CRTDLL_atan(double d)
-{
-  dprintf2(("CRTDLL: atan(%f)\n",
-           d));
-
-  return (atan(d));
-}
-
-
-/*********************************************************************
- *                  atan2	(CRTDLL.341)
- */
-double CDECL CRTDLL_atan2( double y, double x )
-{
-  dprintf2(("CRTDLL: atan2\n"));
-  return (atan2(y, x));
-}
-
-
-/*********************************************************************
- *                  atof 	(CRTDLL.343)
- */
-double CDECL CRTDLL_atof( const char *nptr )
-{
-  dprintf2(("CRTDLL: atof\n"));
-  return (atof(nptr));
-}
-
-
-/*********************************************************************
- *                  atoi 	(CRTDLL.344)
- */
-int CDECL CRTDLL_atoi(LPSTR str)
-{
-  dprintf2(("CRTDLL: atoi(%s)\n",
-           str));
-
-  return (atoi(str));
-}
-
-
-/*********************************************************************
- *                  atol 	(CRTDLL.345)
- */
-long CDECL CRTDLL_atol(LPSTR str)
-{
-  dprintf2(("CRTDLL: atol(%s)\n",
-           str));
-
-  return (atol(str));
-}
-
-
-/*********************************************************************
- *                  bsearch	(CRTDLL.346)
- */
-void *CDECL CRTDLL_bsearch (const void *key, const void *base, size_t num, size_t width,
-                     int (* CDECL compare)(const void *key, const void *element))
-{
-  int left, right, median, sign;
-  const void *element;
-  
-  if (width == 0)
-    return 0;
-  left = 1; right = num;
-  while (left <= right)
-    {
-      median = (left + right) / 2;
-      element = (void *)((char *)base + (median-1)*width);
-      sign = compare (key, element);
-      if (sign == 0)
-        return (void *)element;
-      if (sign > 0)
-        left = median + 1;
-      else
-        right = median - 1;
-    }
-  return 0;
-}
-
-
-/*********************************************************************
- *                  ceil  	(CRTDLL.348)
- */
-double CDECL CRTDLL_ceil(double d)
-{
-  dprintf2(("CRTDLL: ceil(%f)\n",
-           d));
-  return (ceil(d));
-}
-
-
-/*********************************************************************
- *                  clock	(CRTDLL.350)
- */
-clock_t CDECL CRTDLL_clock( void )
-{
-  dprintf2(("CRTDLL: clock\n"));
-  return (clock());
-}
-
-
-/*********************************************************************
- *                  cos 	(CRTDLL.351)
- */
-double CDECL CRTDLL_cos(double d)
-{
-  dprintf2(("CRTDLL: cos(%f)\n",
-           d));
-
-  return (cos(d));
-}
-
-
-/*********************************************************************
- *                  cosh	(CRTDLL.352)
- */
-double CDECL CRTDLL_cosh( double x )
-{
-  dprintf2(("CRTDLL: cosh\n"));
-  return (cosh(x));
-}
-
-
-/*********************************************************************
- *                  ctime	(CRTDLL.353)
- */
-char * CDECL CRTDLL_ctime( const time_t *timer )
-{
-  dprintf2(("CRTDLL: ctime\n"));
-  return (ctime(timer));
-}
-
-
-/*********************************************************************
- *                  difftime	(CRTDLL.354)
- */
-double CDECL CRTDLL_difftime( time_t t1, time_t t0 )
-{
-  dprintf2(("CRTDLL: difftime\n"));
-  return (difftime(t1, t0));
-}
-
-
-/*********************************************************************
- *                  div		(CRTDLL.355)
- */
-ULONG CDECL CRTDLL_div( int number, int denom )
-{
- div_t divt;
-
-  dprintf2(("CRTDLL: div\n"));
-  divt = (div(number, denom));
-  SetEDX(divt.rem); //NOTE: make sure the compiler doesn't overwrite edx!
-  return divt.quot;
-}
-
-
-/*********************************************************************
- *                  exp		(CRTDLL.357)
- */
-double CDECL CRTDLL_exp( double x )
-{
-  dprintf2(("CRTDLL: exp\n"));
-  return (exp(x));
-}
-
-
-/*********************************************************************
- *                  fabs  	(CRTDLL.358)
- */
-double CDECL CRTDLL_fabs(double d)
-{
-  dprintf2(("CRTDLL: fabs(%f)\n",
-           d));
-
-  return (fabs(d));
-}
-
-
-/*********************************************************************
- *                  floor		(CRTDLL.367)
- */
-double CDECL CRTDLL_floor(double d)
-{
-  dprintf2(("CRTDLL: floor(%f)\n",
-           d));
-
-  return (floor(d));
-}
-
-
-/*********************************************************************
- *                  fmod	(CRTDLL.368)
- */
-double CDECL CRTDLL_fmod(double x, double y )
-{
-  dprintf2(("CRTDLL: fmod\n"));
-  return (fmod(x,y));
-}
-
-
-/*********************************************************************
- *                  frexp	  (CRTDLL.377)
- */
-double CDECL CRTDLL_frexp( double value, int *exp )
-{
-  dprintf2(("CRTDLL: frexp\n"));
-  return (frexp(value, exp));
-}
-
-
-/*********************************************************************
- *                  gmtime    (CRTDLL.389)
- */
-struct tm * CDECL CRTDLL_gmtime( const time_t *timer )
-{
-  dprintf2(("CRTDLL: gmtime\n"));
-  return (gmtime(timer));
-}
-
-
-/*********************************************************************
- *                  isalnum    (CRTDLL.391)
- */
-int CDECL CRTDLL_isalnum(int i)
-{
-  dprintf2(("CRTDLL: isalnum(%08xh)\n", i));
-  return (isalnum(i));
-}
-
-
-/*********************************************************************
- *                  isalpha    (CRTDLL.392)
- */
-int CDECL CRTDLL_isalpha(int i)
-{
-  dprintf2(("CRTDLL: isalpha(%08xh)\n",
-           i));
-
-  return (isalpha(i));
-}
-
-
-/*********************************************************************
- *                  iscntrl    (CRTDLL.393)
- */
-int CDECL CRTDLL_iscntrl(int i)
-{
-  dprintf2(("CRTDLL: iscntrl(%08xh)\n", i));
-  return (iscntrl(i));
-}
-
-
-/*********************************************************************
- *                  isdigit    (CRTDLL.394)
- */
-int CDECL CRTDLL_isdigit(int i)
-{
-  dprintf2(("CRTDLL: isdigit(%08xh)\n",
-           i));
-
-  return (isdigit(i));
-}
-
-
-/*********************************************************************
- *                  isgraph    (CRTDLL.395)
- */
-int CDECL CRTDLL_isgraph(int i)
-{
-  dprintf2(("CRTDLL: isgraph(%08xh)\n", i));
-  return (isgraph(i));
-}
-
-
-/*********************************************************************
- *                  islower    (CRTDLL.397)
- */
-int CDECL CRTDLL_islower(int i)
-{
-  dprintf2(("CRTDLL: islower(%08xh)\n",
-           i));
-
-  return (islower(i));
-}
-
-
-/*********************************************************************
- *                  isprint    (CRTDLL.398)
- */
-int CDECL CRTDLL_isprint(int i)
-{
-  dprintf2(("CRTDLL: isprint(%08xh)\n",
-           i));
-
-  return (isprint(i));
-}
-
-
-/*********************************************************************
- *                  ispunct    (CRTDLL.399)
- */
-int CDECL CRTDLL_ispunct(int i)
-{
-  dprintf2(("CRTDLL: ispunct(%08xh)\n", i));
-  return (ispunct(i));
-}
-
-
-/*********************************************************************
- *                  isspace    (CRTDLL.400)
- */
-int CDECL CRTDLL_isspace(int i)
-{
-  dprintf2(("CRTDLL: isspace(%08xh)\n",
-           i));
-
-  return (isspace(i));
-}
-
-
-/*********************************************************************
- *                  isupper       (CRTDLL.401)
- */
-int CDECL CRTDLL_isupper(int i)
-{
-  dprintf2(("CRTDLL: isupper(%08xh)\n",
-           i));
-
-  return (isupper(i));
-}
-
-
-/*********************************************************************
- *                  isxdigit    (CRTDLL.415)
- */
-int CDECL CRTDLL_isxdigit(int i)
-{
-  dprintf2(("CRTDLL: isxdigit(%08xh)\n", i));
-  return (isxdigit(i));
-}
-
-
-/*********************************************************************
- *                  labs	(CRTDLL.416)
- */
-long int CDECL CRTDLL_labs( long int j )
-{
-  dprintf2(("CRTDLL: labs(%08xh)\n", j));
-  return (labs(j));
-}
-
-
-/*********************************************************************
- *                  ldexp	(CRTDLL.417)
- */
-double CDECL CRTDLL_ldexp( double x, int exp ) 
-{
-  dprintf2(("CRTDLL: ldexp\n"));
-  return (ldexp(x, exp));
-}
-
-
-/*********************************************************************
- *                  ldiv	(CRTDLL.418)
- */
-ldiv_t CDECL CRTDLL_ldiv( long int numer, long int denom ) 
-{
-  dprintf2(("CRTDLL: ldiv\n"));
-  return (ldiv(numer, denom));
-}
-
-
-/*********************************************************************
- *                  localeconv	(CRTDLL.419)
- */
-struct lconv * CDECL CRTDLL_localeconv(void)
-{
-  dprintf2(("CRTDLL: localeconv\n"));
-  return (localeconv());
-}
-
-
-/*********************************************************************
- *                  localtime 	(CRTDLL.420)
- */
-struct tm * CDECL CRTDLL_localtime( const time_t *timer )
-{
-  dprintf2(("CRTDLL: localtime\n"));
-  return (localtime(timer));
-}
-
-
-/*********************************************************************
- *                  log  	(CRTDLL.421)
- */
-double CDECL CRTDLL_log( double x )
-{
-  dprintf2(("CRTDLL: log(%08xh)\n", x));
-  return (log(x));
-}
-
-
-/*********************************************************************
- *                  log10	(CRTDLL.422)
- */
-double CDECL CRTDLL_log10( double x )
-{
-  dprintf2(("CRTDLL: log10\n"));
-  return (log10(x));
-}
-
-
-/*********************************************************************
- *                  mktime   (CRTDLL.433)
- */
-time_t CDECL CRTDLL_mktime( struct tm *timeptr )
-{
-    dprintf2(("CRTDLL: mktime\n"));
-    return mktime( timeptr );
-}
-
-
-/*********************************************************************
- *                  modf   (CRTDLL.434)
- */
-double CDECL CRTDLL_modf( double value, double *iptr )
-{
-    dprintf2(("CRTDLL: modf\n"));
-    return modf( value, iptr );
-}
-
-
-/*********************************************************************
- *                  pow      (CRTDLL.436)
- */
-double CDECL CRTDLL_pow( double x, double y )	
-{
-    dprintf2(("CRTDLL: pow(%08xh, %08xh)\n",x, y));
-    return pow( x, y );
-}
-
-
-/*********************************************************************
- *                  printf   (CRTDLL.437)
- */
-int CDECL CRTDLL_printf( const char *format, va_list arg )
-{
-  dprintf2(("CRTDLL: printf\n"));
-  return (printf(format, arg));
-}
-
-
-/*********************************************************************
- *                  qsort        (CRTDLL.441)
- */
-void CDECL CRTDLL_qsort (void *base, size_t num, size_t width,
-                         int (*CDECL compare)(const void *x1, const void *x2))
-{
-  dprintf2(("CRTDLL: qsort\n"));
-  if (width > 0 && num > 1 && base != 0)
-    qsort1 ((char *)base, (char *)base+(num-1)*width, width, compare);
-}
-
-
-/*********************************************************************
- *                  raise        (CRTDLL.442)
- */
-int CDECL CRTDLL_raise( int sig )
-{
-    dprintf2(("CRTDLL: raise\n"));
-    return raise( sig );
-}
-
-
-/*********************************************************************
- *	scanf					(CRTDLL.448)
- */
-int CDECL CRTDLL_scanf( const char *format, va_list arg )
-{
-  dprintf(("CRTDLL: scanf\n"));
-  return (scanf(format, arg));
-}
-
-
-/*********************************************************************
- *                  setvbuf      (CRTDLL.451)
- */
-int CDECL CRTDLL_setvbuf( FILE *fp, char *buf, int mode, size_t size )
-{
-  dprintf2(("CRTDLL: setvbuf\n"));
-  return (setvbuf(fp, buf, mode, size));
-}
-
-
-/*********************************************************************
- *                  sin          (CRTDLL.453)
- */
-double CDECL CRTDLL_sin( double x )
-{
-  dprintf2(("CRTDLL: sin(%08xh)\n", x));
-  return (sin(x));
-}
-
-
-/*********************************************************************
- *                  sinh         (CRTDLL.454)
- */
-double CDECL CRTDLL_sinh( double x )
-{
-  dprintf2(("CRTDLL: sinh\n"));
-  return (sinh(x));
-}
-
-
-/*********************************************************************
- *                  sprintf      (CRTDLL.455)
- */
-LPSTR CDECL CRTDLL_sprintf(LPSTR lpstrBuffer,
-                       LPSTR lpstrFormat,
-                       ...)
-{
-  va_list argptr;                          /* -> variable argument list */
-
-  dprintf2(("CRTDLL: sprintf(%08xh,%s)\n",
-           lpstrBuffer,
-           lpstrFormat));
-
-  va_start(argptr,
-           lpstrFormat);                   /* get pointer to argument list */
-  vsprintf(lpstrBuffer,
-           lpstrFormat,
-           argptr);
-  va_end(argptr);                          /* done with variable arguments */
-
-  return (lpstrBuffer);
-}
-
-
-/*********************************************************************
- *                  sqrt         (CRTDLL.456)
- */
-double CDECL CRTDLL_sqrt( double x )
-{
-  dprintf2(("CRTDLL: sqrt(%08xh)\n", x));
-  return (sqrt(x));
-}
-
-
-/*********************************************************************
- *                  srand        (CRTDLL.457)
- */
-void CDECL CRTDLL_srand( unsigned int seed )
-{
-  dprintf2(("CRTDLL: srand\n"));
-  srand(seed);
-}
-
-
-/*********************************************************************
- *	sscanf					(CRTDLL.458)
- */
-int CDECL CRTDLL_sscanf( const char *s, const char *format, va_list arg )
-{
-  dprintf(("CRTDLL: sscanf\n"));
-  return (sscanf(s, format, arg));
-}
-
-
-/*********************************************************************
- *                  tan           (CRTDLL.483)
- */
-double CDECL CRTDLL_tan(double d)
-{
-  dprintf2(("CRTDLL: tan(%f)\n",
-           d));
-
-  return (tan(d));
-}
-
-
-/*********************************************************************
- *                  tanh           (CRTDLL.484)
- */
-double CDECL CRTDLL_tanh( double x )
-{
-  dprintf2(("CRTDLL: tanh\n"));
-  return tanh(x);
-}
-
-
-/*********************************************************************
- *                  time           (CRTDLL.485)
- */
-time_t CDECL CRTDLL_time( time_t *timer )
-{
-  dprintf2(("CRTDLL: time\n"));
-
-  return time(timer);
-}
-
-
-/*********************************************************************
- *                  tmpfile           (CRTDLL.486)
- */
-FILE * CDECL CRTDLL_tmpfile( void )
-{
-  dprintf2(("CRTDLL: tmpfile\n"));
-  return (tmpfile());
-}
-
-
-/*********************************************************************
- *                  tolower       (CRTDLL.488)
- */
-int CDECL CRTDLL_tolower(int c)
-{
-  dprintf2(("CRTDLL: tolower(%c)\n",
-           c));
-
-  return (tolower(c));
-}
-
-
-/*********************************************************************
- *                  toupper       (CRTDLL.489)
- */
-int CDECL CRTDLL_toupper(int c)
-{
-  dprintf2(("CRTDLL: toupper(%c)\n",
-           c));
-
-  return (toupper(c));
-}
-
-
-/*********************************************************************
- *	ungetc					(CRTDLL.492)
- */
-INT CDECL CRTDLL_ungetc(int c, FILE *f)
-{
-  dprintf(("CRTDLL: ungetc\n"));
-  return (ungetc(c, f));
-}
-
-
-/*********************************************************************
- *                  vprintf       (CRTDLL.496)
- */
-int CDECL CRTDLL_vprintf( const char *format, __va_list arg )
-{
-  dprintf2(("CRTDLL: vprintf\n"));
-  return (vprintf(format, arg));
-}
-
-
-/*********************************************************************
- *                  vsprintf       (CRTDLL.497)
- */
-int CDECL CRTDLL_vsprintf( char *s, const char *format, va_list arg )
-{
-  dprintf2(("CRTDLL: vsprintf(%08xh, %08xh)\n", s, format));
-  return (vsprintf(s, format, arg));
-}
-
-
-/*********************************************************************
- *           CRTDLL__setjmp3 	 (CRTDLL.600)
- */
-int CDECL CRTDLL__setjmp3( jmp_buf env )
-{
-  //TODO:
-  dprintf2(("CRTDLL: _setjmp3 -> setjmp (NOT IDENTICAL!!!)\n"));
-  return(setjmp( env));
-}
Index: trunk/src/crtdll/crtdll.def
===================================================================
--- trunk/src/crtdll/crtdll.def	(revision 9655)
+++ 	(revision )
@@ -1,543 +1,0 @@
-; $Id: crtdll.def,v 1.19 2001-07-09 08:08:00 bird Exp $
-
-;
-; Based on Windows 98 (Build 2222): CRTDLL.DLL
-;
-LIBRARY CRTDLL32 INITINSTANCE TERMINSTANCE
-DESCRIPTION 'Odin32 System DLL - CrtDll'
-DATA MULTIPLE NONSHARED
-
-IMPORTS
-    _RtlUnwind@16       = NTDLL.RtlUnwind
-        _RtlSecondsSince1970ToTime@8 = NTDLL.RtlSecondsSince1970ToTime
-        _RtlTimeToSecondsSince1970@8 = NTDLL.RtlTimeToSecondsSince1970
-
-EXPORTS
-    ??2@YAPAXI@Z        = _CRTDLL_new           @1
-    ??3@YAXPAX@Z        = _CRTDLL_delete        @2
-    ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z = _CRTDLL_set_new_handler @3
-    _CIacos         = _CRTDLL__CIacos       @4
-    _CIasin         = _CRTDLL__CIasin       @5
-    _CIatan         = _CRTDLL__CIatan       @6
-    _CIatan2            = _CRTDLL__CIatan2      @7
-    _CIcos          = _CRTDLL__CIcos        @8
-    _CIcosh         = _CRTDLL__CIcosh       @9
-    _CIexp          = _CRTDLL__CIexp        @10
-    _CIfmod         = _CRTDLL__CIfmod       @11
-    _CIlog          = _CRTDLL__CIlog        @12
-    _CIlog10            = _CRTDLL__CIlog10      @13
-    _CIpow          = _CRTDLL__CIpow        @14
-    _CIsin          = _CRTDLL__CIsin        @15
-    _CIsinh         = _CRTDLL__CIsinh       @16
-    _CIsqrt         = _CRTDLL__CIsqrt       @17
-    _CItan          = _CRTDLL__CItan        @18
-    _CItanh         = _CRTDLL__CItanh       @19
-    _HUGE_dll           = CRTDLL_HUGE_dll       @20
-    _XcptFilter         = _CRTDLL__XcptFilter       @21
-    __GetMainArgs       = _CRTDLL__GetMainArgs      @22
-    __argc_dll          = CRTDLL_argc_dll       @23
-    __argv_dll          = CRTDLL_argv_dll       @24
-    __dllonexit         = _CRTDLL___dllonexit       @25
-    __doserrno          = _CRTDLL___doserrno        @26
-    __fpecode           = _CRTDLL___fpecode     @27
-    __isascii           = _CRTDLL___isascii     @28
-    __iscsym            = _CRTDLL___iscsym      @29
-    __iscsymf           = _CRTDLL___iscsymf     @30
-    __mb_cur_max_dll        = CRTDLL_mb_cur_max_dll     @31
-    __pxcptinfoptrs     = _CRTDLL___pxcptinfoptrs   @32
-    __threadhandle      = _CRTDLL___threadhandle    @33
-    __threadid          = _CRTDLL___threadid        @34
-    __toascii           = _CRTDLL___toascii     @35
-    _abnormal_termination   = _CRTDLL__abnormal_termination @36
-    _access         = _CRTDLL__access       @37
-    _acmdln_dll         = CRTDLL_acmdln_dll     @38
-    _aexit_rtn_dll      = _CRTDLL__aexit_rtn_dll    @39
-    _amsg_exit          = _CRTDLL__amsg_exit        @40
-    _assert         = _CRTDLL__assert       @41
-    _basemajor_dll      = CRTDLL_basemajor_dll      @42
-    _baseminor_dll      = CRTDLL_baseminor_dll      @43
-    _baseversion_dll        = CRTDLL_baseversion_dll    @44
-    _beep           = _CRTDLL__beep         @45
-    _beginthread        = _CRTDLL__beginthread      @46
-    _c_exit         = _CRTDLL__c_exit       @47
-    _cabs           = _CRTDLL__cabs         @48
-    _cexit          = _CRTDLL__cexit        @49
-    _cgets          = _CRTDLL__cgets        @50
-    _chdir          = _CRTDLL__chdir        @51
-    _chdrive            = _CRTDLL__chdrive      @52
-    _chgsign            = _CRTDLL__chgsign      @53
-    _chmod          = _CRTDLL__chmod        @54
-    _chsize         = _CRTDLL__chsize       @55
-    _clearfp            = _CRTDLL__clearfp      @56
-    _close          = _CRTDLL__close        @57
-    _commit         = _CRTDLL__commit       @58
-    _commode_dll        = CRTDLL_commode_dll        @59
-    _control87          = _CRTDLL__control87        @60
-    _controlfp          = _CRTDLL__controlfp        @61
-    _copysign           = _CRTDLL__copysign     @62
-    _cprintf            = _CRTDLL__cprintf      @63
-    _cpumode_dll        = CRTDLL_cpumode_dll        @64
-    _cputs          = _CRTDLL__cputs        @65
-    _creat          = _CRTDLL__creat        @66
-    _cscanf         = _CRTDLL__cscanf       @67
-    _ctype          = CRTDLL_ctype          @68
-    _cwait          = _CRTDLL__cwait        @69
-    _daylight_dll       = CRTDLL_daylight_dll       @70
-    _dup            = _CRTDLL__dup          @71
-    _dup2           = _CRTDLL__dup2         @72
-    _ecvt           = _CRTDLL__ecvt         @73
-    _endthread          = _CRTDLL__endthread        @74
-    _environ_dll        = CRTDLL_environ_dll        @75
-    _eof            = _CRTDLL__eof          @76
-    _errno          = _CRTDLL__errno        @77
-    _except_handler2        = _CRTDLL__except_handler2  @78
-    _execl          = _CRTDLL__execl        @79
-    _execle         = _CRTDLL__execle       @80
-    _execlp         = _CRTDLL__execlp       @81
-    _execlpe            = _CRTDLL__execlpe      @82
-    _execv          = _CRTDLL__execv        @83
-    _execve         = _CRTDLL__execve       @84
-    _execvp         = _CRTDLL__execvp       @85
-    _execvpe            = _CRTDLL__execvpe      @86
-    _exit           = _CRTDLL__exit         @87
-    _expand         = _CRTDLL__expand       @88
-    _fcloseall          = _CRTDLL__fcloseall        @89
-    _fcvt           = _CRTDLL__fcvt         @90
-    _fdopen         = _CRTDLL__fdopen       @91
-    _fgetchar           = _CRTDLL__fgetchar     @92
-    _fgetwchar          = _CRTDLL__fgetwchar        @93
-    _filbuf         = _CRTDLL__filbuf       @94
-    _fileinfo_dll       = CRTDLL_fileinfo_dll       @95
-    _filelength         = _CRTDLL__filelength       @96
-    _fileno         = _CRTDLL__fileno       @97
-    _findclose          = _CRTDLL__findclose        @98
-    _findfirst          = _CRTDLL__findfirst        @99
-    _findnext           = _CRTDLL__findnext     @100
-    _finite         = _CRTDLL__finite       @101
-    _flsbuf         = _CRTDLL__flsbuf       @102
-    _flushall           = _CRTDLL__flushall     @103
-    _fmode_dll          = CRTDLL_fmode_dll      @104
-    _fpclass            = _CRTDLL__fpclass      @105
-    _fpieee_flt         = _CRTDLL__fpieee_flt       @106
-    _fpreset            = _CRTDLL__fpreset      @107
-    _fputchar           = _CRTDLL__fputchar     @108
-    _fputwchar          = _CRTDLL__fputwchar        @109
-    _fsopen         = _CRTDLL__fsopen       @110
-    _fstat          = _CRTDLL__fstat        @111
-    _ftime          = _CRTDLL__ftime        @112
-    _ftol           = _CRTDLL__ftol         @113
-    _fullpath           = _CRTDLL__fullpath     @114
-    _futime         = _CRTDLL__futime       @115
-    _gcvt           = _CRTDLL__gcvt         @116
-    _get_osfhandle      = _CRTDLL__get_osfhandle    @117
-    _getch          = _CRTDLL__getch        @118
-    _getche         = _CRTDLL__getche       @119
-    _getcwd         = _CRTDLL__getcwd       @120
-    _getdcwd            = _CRTDLL__getdcwd      @121
-    _getdiskfree        = _CRTDLL__getdiskfree      @122
-    _getdllprocaddr     = _CRTDLL__getdllprocaddr   @123
-    _getdrive           = _CRTDLL__getdrive     @124
-    _getdrives          = _CRTDLL__getdrives        @125
-    _getpid         = _CRTDLL__getpid       @126
-    _getsystime         = _CRTDLL__getsystime       @127
-    _getw           = _CRTDLL__getw         @128
-    _global_unwind2     = _CRTDLL__global_unwind2   @129
-    _heapchk            = _CRTDLL__heapchk      @130
-    _heapmin            = _CRTDLL__heapmin      @131
-    _heapset            = _CRTDLL__heapset      @132
-    _heapwalk           = _CRTDLL__heapwalk     @133
-    _hypot          = _CRTDLL__hypot        @134
-    _initterm           = _CRTDLL__initterm     @135
-    _iob            = CRTDLL_iob            @136
-    _isatty         = _CRTDLL__isatty       @137
-    _isctype            = _CRTDLL__isctype      @138
-    _ismbbalnum         = _CRTDLL__ismbbalnum       @139
-    _ismbbalpha         = _CRTDLL__ismbbalpha       @140
-    _ismbbgraph         = _CRTDLL__ismbbgraph       @141
-    _ismbbkalnum        = _CRTDLL__ismbbkalnum      @142
-    _ismbbkana          = _CRTDLL__ismbbkana        @143
-    _ismbbkpunct        = _CRTDLL__ismbbkpunct      @144
-    _ismbblead          = _CRTDLL__ismbblead        @145
-    _ismbbprint         = _CRTDLL__ismbbprint       @146
-    _ismbbpunct         = _CRTDLL__ismbbpunct       @147
-    _ismbbtrail         = _CRTDLL__ismbbtrail       @148
-    _ismbcalpha         = _CRTDLL__ismbcalpha       @149
-    _ismbcdigit         = _CRTDLL__ismbcdigit       @150
-    _ismbchira          = _CRTDLL__ismbchira        @151
-    _ismbckata          = _CRTDLL__ismbckata        @152
-    _ismbcl0            = _CRTDLL__ismbcl0      @153
-    _ismbcl1            = _CRTDLL__ismbcl1      @154
-    _ismbcl2            = _CRTDLL__ismbcl2      @155
-    _ismbclegal         = _CRTDLL__ismbclegal       @156
-    _ismbclower         = _CRTDLL__ismbclower       @157
-    _ismbcprint         = _CRTDLL__ismbcprint       @158
-    _ismbcspace         = _CRTDLL__ismbcspace       @159
-    _ismbcsymbol        = _CRTDLL__ismbcsymbol      @160
-    _ismbcupper         = _CRTDLL__ismbcupper       @161
-    _ismbslead          = _CRTDLL__ismbslead        @162
-    _ismbstrail         = _CRTDLL__ismbstrail       @163
-    _isnan          = _CRTDLL__isnan        @164
-    _itoa           = _CRTDLL__itoa         @165
-    _itow           = _CRTDLL__itow         @600 ; @@@PH fix ordinal
-    _j0             = _CRTDLL__j0           @166
-    _j1             = _CRTDLL__j1           @167
-    _jn             = _CRTDLL__jn           @168
-    _kbhit          = _CRTDLL__kbhit        @169
-    _lfind          = _CRTDLL__lfind        @170
-    _loaddll            = _CRTDLL__loaddll      @171
-    _local_unwind2      = _CRTDLL__local_unwind2    @172
-    _locking            = _CRTDLL__locking      @173
-    _logb           = _CRTDLL__logb         @174
-    _lrotl          = _CRTDLL__lrotl        @175
-    _lrotr          = _CRTDLL__lrotr        @176
-    _lsearch            = _CRTDLL__lsearch      @177
-    _lseek          = _CRTDLL__lseek        @178
-    _ltoa           = _CRTDLL__ltoa         @179
-    _ltow           = _CRTDLL__ltow                 @601   ; @@@PH ordinal missing!
-    _makepath           = _CRTDLL__makepath     @180
-    _matherr            = _CRTDLL__matherr      @181
-    _mbbtombc           = _CRTDLL__mbbtombc     @182
-    _mbbtype            = _CRTDLL__mbbtype      @183
-    _mbccpy         = _CRTDLL__mbccpy       @184
-    _mbcjistojms        = _CRTDLL__mbcjistojms      @185
-    _mbcjmstojis        = _CRTDLL__mbcjmstojis      @186
-    _mbclen         = _CRTDLL__mbclen       @187
-    _mbctohira          = _CRTDLL__mbctohira        @188
-    _mbctokata          = _CRTDLL__mbctokata        @189
-    _mbctolower         = _CRTDLL__mbctolower       @190
-    _mbctombb           = _CRTDLL__mbctombb     @191
-    _mbctoupper         = _CRTDLL__mbctoupper       @192
-    _mbctype            = CRTDLL_mbctype        @193
-    _mbsbtype           = _CRTDLL__mbsbtype     @194
-    _mbscat         = _CRTDLL__mbscat       @195
-    _mbschr         = _CRTDLL__mbschr       @196
-    _mbscmp         = _CRTDLL__mbscmp       @197
-    _mbscpy         = _CRTDLL__mbscpy       @198
-    _mbscspn            = _CRTDLL__mbscspn      @199
-    _mbsdec         = _CRTDLL__mbsdec       @200
-    _mbsdup         = _CRTDLL__mbsdup       @201
-    _mbsicmp            = _CRTDLL__mbsicmp      @202
-    _mbsinc         = _CRTDLL__mbsinc       @203
-    _mbslen         = _CRTDLL__mbslen       @204
-    _mbslwr         = _CRTDLL__mbslwr       @205
-    _mbsnbcat           = _CRTDLL__mbsnbcat     @206
-    _mbsnbcmp           = _CRTDLL__mbsnbcmp     @207
-    _mbsnbcnt           = _CRTDLL__mbsnbcnt     @208
-    _mbsnbcpy           = _CRTDLL__mbsnbcpy     @209
-    _mbsnbicmp          = _CRTDLL__mbsnbicmp        @210
-    _mbsnbset           = _CRTDLL__mbsnbset     @211
-    _mbsncat            = _CRTDLL__mbsncat      @212
-    _mbsnccnt           = _CRTDLL__mbsnccnt     @213
-    _mbsncmp            = _CRTDLL__mbsncmp      @214
-    _mbsncpy            = _CRTDLL__mbsncpy      @215
-    _mbsnextc           = _CRTDLL__mbsnextc     @216
-    _mbsnicmp           = _CRTDLL__mbsnicmp     @217
-    _mbsninc            = _CRTDLL__mbsninc      @218
-    _mbsnset            = _CRTDLL__mbsnset      @219
-    _mbspbrk            = _CRTDLL__mbspbrk      @220
-    _mbsrchr            = _CRTDLL__mbsrchr      @221
-    _mbsrev         = _CRTDLL__mbsrev       @222
-    _mbsset         = _CRTDLL__mbsset       @223
-    _mbsspn         = _CRTDLL__mbsspn       @224
-    _mbsspnp            = _CRTDLL__mbsspnp      @225
-    _mbsstr         = _CRTDLL__mbsstr       @226
-    _mbstok         = _CRTDLL__mbstok       @227
-    _mbstrlen           = _CRTDLL__mbstrlen     @228
-    _mbsupr         = _CRTDLL__mbsupr       @229
-    _memccpy            = _CRTDLL__memccpy      @230
-    _memicmp            = _CRTDLL__memicmp      @231
-    _mkdir          = _CRTDLL__mkdir        @232
-    _mktemp         = _CRTDLL__mktemp       @233
-    _msize          = _CRTDLL__msize        @234
-    _nextafter          = _CRTDLL__nextafter        @235
-    _onexit         = _CRTDLL__onexit       @236
-    _open           = _CRTDLL__open         @237
-    _open_osfhandle     = _CRTDLL__open_osfhandle   @238
-    _osmajor_dll        = CRTDLL_osmajor_dll        @239
-    _osminor_dll        = CRTDLL_osminor_dll        @240
-    _osmode_dll         = CRTDLL_osmode_dll     @241
-    _osver_dll          = CRTDLL_osver_dll      @242
-    _osversion_dll      = CRTDLL_osversion_dll      @243
-    _pclose         = _CRTDLL__pclose       @244
-    _pctype_dll         = CRTDLL_pctype_dll     @245
-    _pgmptr_dll         = CRTDLL_pgmptr_dll     @246
-    _pipe           = _CRTDLL__pipe         @247
-    _popen          = _CRTDLL__popen        @248
-    _purecall           = _CRTDLL__purecall     @249
-    _putch          = _CRTDLL__putch        @250
-    _putenv         = _CRTDLL__putenv       @251
-    _putw           = _CRTDLL__putw         @252
-    _pwctype_dll        = CRTDLL_pwctype_dll        @253
-    _read           = _CRTDLL__read         @254
-    _rmdir          = _CRTDLL__rmdir        @255
-    _rmtmp          = _CRTDLL__rmtmp        @256
-    _rotl           = _CRTDLL__rotl         @257
-    _rotr           = _CRTDLL__rotr         @258
-    _scalb          = _CRTDLL__scalb        @259
-    _searchenv          = _CRTDLL__searchenv        @260
-    _seterrormode       = _CRTDLL__seterrormode     @261
-    _setjmp         = _CRTDLL__setjmp       @262
-    _setmode            = _CRTDLL__setmode      @263
-    _setsystime         = _CRTDLL__setsystime       @264
-    _sleep          = _CRTDLL__sleep        @265
-    _snprintf           = _CRTDLL__snprintf     @266
-    _snwprintf          = _CRTDLL__snwprintf        @267
-    _sopen          = _CRTDLL__sopen        @268
-    _spawnl         = _CRTDLL__spawnl       @269
-    _spawnle            = _CRTDLL__spawnle      @270
-    _spawnlp            = _CRTDLL__spawnlp      @271
-    _spawnlpe           = _CRTDLL__spawnlpe     @272
-    _spawnv         = _CRTDLL__spawnv       @273
-    _spawnve            = _CRTDLL__spawnve      @274
-    _spawnvp            = _CRTDLL__spawnvp      @275
-    _spawnvpe           = _CRTDLL__spawnvpe     @276
-    _splitpath          = _CRTDLL__splitpath        @277
-    _stat           = _CRTDLL__stat         @278
-    _statusfp           = _CRTDLL__statusfp     @279
-    _strcmpi            = _CRTDLL__strcmpi      @280
-    _strdate            = _CRTDLL__strdate      @281
-    _strdec         = _CRTDLL__strdec       @282
-    _strdup         = _CRTDLL__strdup       @283
-    _strerror           = _CRTDLL__strerror     @284
-    _stricmp            = _CRTDLL__stricmp      @285
-    _stricoll           = _CRTDLL__stricoll     @286
-    _strinc         = _CRTDLL__strinc       @287
-    _strlwr         = _CRTDLL__strlwr       @288
-    _strncnt            = _CRTDLL__strncnt      @289
-    _strnextc           = _CRTDLL__strnextc     @290
-    _strnicmp           = _CRTDLL__strnicmp     @291
-    _strninc            = _CRTDLL__strninc      @292
-    _strnset            = _CRTDLL__strnset      @293
-    _strrev         = _CRTDLL__strrev       @294
-    _strset         = _CRTDLL__strset       @295
-    _strspnp            = _CRTDLL__strspnp      @296
-    _strtime            = _CRTDLL__strtime      @297
-    _strupr         = _CRTDLL__strupr       @298
-    _swab           = _CRTDLL__swab         @299
-    _sys_errlist        = CRTDLL_sys_errlist        @300
-    _sys_nerr_dll       = CRTDLL_sys_nerr_dll       @301
-    _tell           = _CRTDLL__tell         @302
-    _tempnam            = _CRTDLL__tempnam      @303
-    _timezone_dll       = CRTDLL_timezone_dll       @304
-    _tolower            = _CRTDLL__tolower      @305
-    _toupper            = _CRTDLL__toupper      @306
-    _tzname         = CRTDLL_tzname         @307
-    _tzset          = _CRTDLL__tzset        @308
-    _ultoa          = _CRTDLL__ultoa        @309
-    _ultow          = _CRTDLL__ultow                @602 ; @@@PH ordinal missing
-    _umask          = _CRTDLL__umask        @310
-    _ungetch            = _CRTDLL__ungetch      @311
-    _unlink         = _CRTDLL__unlink       @312
-    _unloaddll          = _CRTDLL__unloaddll        @313
-    _utime          = _CRTDLL__utime        @314
-    _vsnprintf          = _CRTDLL__vsnprintf        @315
-    _vsnwprintf         = _CRTDLL__vsnwprintf       @316
-    _wcsdup         = _CRTDLL__wcsdup       @317
-    _wcsicmp            = _CRTDLL__wcsicmp      @318
-    _wcsicoll           = _CRTDLL__wcsicoll     @319
-    _wcslwr         = _CRTDLL__wcslwr       @320
-    _wcsnicmp           = _CRTDLL__wcsnicmp     @321
-    _wcsnset            = _CRTDLL__wcsnset      @322
-    _wcsrev         = _CRTDLL__wcsrev       @323
-    _wcsset         = _CRTDLL__wcsset       @324
-    _wcsupr         = _CRTDLL__wcsupr       @325
-    _winmajor_dll       = CRTDLL_winmajor_dll       @326
-    _winminor_dll       = CRTDLL_winminor_dll       @327
-    _winver_dll         = CRTDLL_winver_dll     @328
-    _write          = _CRTDLL__write        @329
-    _wtoi           = _CRTDLL__wtoi         @330
-    _wtol           = _CRTDLL__wtol         @331
-    _y0             = _CRTDLL__y0           @332
-    _y1             = _CRTDLL__y1           @333
-    _yn             = _CRTDLL__yn           @334
-    abort           = _CRTDLL_abort         @335
-    abs             = _CRTDLL_abs           @336
-    acos            = _CRTDLL_acos          @337
-    asctime         = _CRTDLL_asctime       @338
-    asin            = _CRTDLL_asin          @339
-    atan            = _CRTDLL_atan          @340
-    atan2           = _CRTDLL_atan2         @341
-    atexit          = _CRTDLL_atexit        @342
-    atof            = _CRTDLL_atof          @343
-    atoi            = _CRTDLL_atoi          @344
-    atol            = _CRTDLL_atol          @345
-    bsearch                     = _CRTDLL_bsearch       @346
-    calloc          = _CRTDLL_calloc        @347
-    ceil            = _CRTDLL_ceil          @348
-    clearerr            = _CRTDLL_clearerr      @349
-    clock           = _CRTDLL_clock         @350
-    cos             = _CRTDLL_cos           @351
-    cosh            = _CRTDLL_cosh          @352
-    ctime           = _CRTDLL_ctime         @353
-    difftime            = _CRTDLL_difftime      @354
-    div             = _CRTDLL_div           @355
-    exit            = _CRTDLL_exit          @356
-    exp             = _CRTDLL_exp           @357
-    fabs            = _CRTDLL_fabs          @358
-    fclose          = _CRTDLL_fclose        @359
-    feof            = _CRTDLL_feof          @360
-    ferror          = _CRTDLL_ferror        @361
-    fflush          = _CRTDLL_fflush        @362
-    fgetc           = _CRTDLL_fgetc         @363
-    fgetpos         = _CRTDLL_fgetpos       @364
-    fgets           = _CRTDLL_fgets         @365
-    fgetwc          = _CRTDLL_fgetwc        @366
-    floor           = _CRTDLL_floor         @367
-    fmod            = _CRTDLL_fmod          @368
-    fopen           = _CRTDLL_fopen         @369
-    fprintf             = _CRTDLL_fprintf       @370
-    fputc           = _CRTDLL_fputc         @371
-    fputs           = _CRTDLL_fputs         @372
-    fputwc          = _CRTDLL_fputwc        @373
-    fread           = _CRTDLL_fread         @374
-    free                = _CRTDLL_free          @375
-    freopen         = _CRTDLL_freopen       @376
-    frexp           = _CRTDLL_frexp         @377
-    fscanf          = _CRTDLL_fscanf        @378
-    fseek           = _CRTDLL_fseek         @379
-    fsetpos         = _CRTDLL_fsetpos       @380
-    ftell           = _CRTDLL_ftell         @381
-    fwprintf            = _CRTDLL_fwprintf      @382
-    fwrite              = _CRTDLL_fwrite        @383
-    fwscanf         = _CRTDLL_fwscanf       @384
-    getc            = _CRTDLL_getc          @385
-    getchar         = _CRTDLL_getchar       @386
-    getenv          = _CRTDLL_getenv        @387
-    gets            = _CRTDLL_gets          @388
-    gmtime          = _CRTDLL_gmtime        @389
-    is_wctype           = _CRTDLL_is_wctype     @390
-    isalnum         = _CRTDLL_isalnum       @391
-    isalpha         = _CRTDLL_isalpha       @392
-    iscntrl         = _CRTDLL_iscntrl       @393
-    isdigit         = _CRTDLL_isdigit       @394
-    isgraph         = _CRTDLL_isgraph       @395
-    isleadbyte          = _CRTDLL_isleadbyte        @396
-    islower         = _CRTDLL_islower       @397
-    isprint         = _CRTDLL_isprint       @398
-    ispunct         = _CRTDLL_ispunct       @399
-    isspace         = _CRTDLL_isspace       @400
-    isupper         = _CRTDLL_isupper       @401
-    iswalnum            = _CRTDLL_iswalnum      @402
-    iswalpha            = _CRTDLL_iswalpha      @403
-    iswascii            = _CRTDLL_iswascii      @404
-    iswcntrl            = _CRTDLL_iswcntrl      @405
-    iswctype            = _CRTDLL_iswctype      @406
-    iswdigit            = _CRTDLL_iswdigit      @407
-    iswgraph            = _CRTDLL_iswgraph      @408
-    iswlower            = _CRTDLL_iswlower      @409
-    iswprint            = _CRTDLL_iswprint      @410
-    iswpunct            = _CRTDLL_iswpunct      @411
-    iswspace            = _CRTDLL_iswspace      @412
-    iswupper            = _CRTDLL_iswupper      @413
-    iswxdigit           = _CRTDLL_iswxdigit     @414
-    isxdigit            = _CRTDLL_isxdigit      @415
-    labs            = _CRTDLL_labs          @416
-    ldexp           = _CRTDLL_ldexp         @417
-    ldiv            = _CRTDLL_ldiv          @418
-    localeconv          = _CRTDLL_localeconv        @419
-    localtime           = _CRTDLL_localtime     @420
-    log             = _CRTDLL_log           @421
-    log10           = _CRTDLL_log10         @422
-    longjmp             = _CRTDLL_longjmp       @423
-    malloc              = _CRTDLL_malloc        @424
-    mblen           = _CRTDLL_mblen         @425
-    mbstowcs            = _CRTDLL_mbstowcs      @426
-    mbtowc          = _CRTDLL_mbtowc        @427
-    memchr          = _CRTDLL_memchr        @428
-    memcmp              = _CRTDLL_memcmp        @429
-    memcpy              = _CRTDLL_memcpy        @430
-    memmove         = _CRTDLL_memmove       @431
-    memset              = _CRTDLL_memset        @432
-    mktime          = _CRTDLL_mktime        @433
-    modf            = _CRTDLL_modf          @434
-    perror          = _CRTDLL_perror        @435
-    pow             = _CRTDLL_pow           @436
-    printf          = _CRTDLL_printf        @437
-    putc            = _CRTDLL_putc          @438
-    putchar         = _CRTDLL_putchar       @439
-    puts            = _CRTDLL_puts          @440
-    qsort           = _CRTDLL_qsort         @441
-    raise           = _CRTDLL_raise         @442
-    rand                = _CRTDLL_rand          @443
-    realloc         = _CRTDLL_realloc       @444
-    remove              = _CRTDLL_remove        @445
-    rename          = _CRTDLL_rename        @446
-    rewind          = _CRTDLL_rewind        @447
-    scanf           = _CRTDLL_scanf         @448
-    setbuf          = _CRTDLL_setbuf        @449
-    setlocale           = _CRTDLL_setlocale     @450
-    setvbuf         = _CRTDLL_setvbuf       @451
-    signal          = _CRTDLL_signal        @452
-    sin             = _CRTDLL_sin           @453
-    sinh            = _CRTDLL_sinh          @454
-    sprintf         = _CRTDLL_sprintf       @455
-    sqrt            = _CRTDLL_sqrt          @456
-    srand           = _CRTDLL_srand         @457
-    sscanf          = _CRTDLL_sscanf        @458
-    strcat          = _CRTDLL_strcat        @459
-    strchr          = _CRTDLL_strchr        @460
-    strcmp          = _CRTDLL_strcmp        @461
-    strcoll         = _CRTDLL_strcoll       @462
-    strcpy          = _CRTDLL_strcpy        @463
-    strcspn         = _CRTDLL_strcspn       @464
-    strerror            = _CRTDLL_strerror      @465
-    strftime            = _CRTDLL_strftime      @466
-    strlen          = _CRTDLL_strlen        @467
-    strncat         = _CRTDLL_strncat       @468
-    strncmp         = _CRTDLL_strncmp       @469
-    strncpy         = _CRTDLL_strncpy       @470
-    strpbrk         = _CRTDLL_strpbrk       @471
-    strrchr         = _CRTDLL_strrchr       @472
-    strspn          = _CRTDLL_strspn        @473
-    strstr          = _CRTDLL_strstr        @474
-    strtod          = _CRTDLL_strtod        @475
-    strtok          = _CRTDLL_strtok        @476
-    strtol          = _CRTDLL_strtol        @477
-    strtoul         = _CRTDLL_strtoul       @478
-    strxfrm         = _CRTDLL_strxfrm       @479
-    swprintf            = _CRTDLL_swprintf      @480
-    swscanf         = _CRTDLL_swscanf       @481
-    system          = _CRTDLL_system        @482
-    tan             = _CRTDLL_tan           @483
-    tanh            = _CRTDLL_tanh          @484
-    time            = _CRTDLL_time          @485
-    tmpfile         = _CRTDLL_tmpfile       @486
-    tmpnam          = _CRTDLL_tmpnam        @487
-    tolower         = _CRTDLL_tolower       @488
-    toupper         = _CRTDLL_toupper       @489
-    towlower            = _CRTDLL_towlower      @490
-    towupper            = _CRTDLL_towupper      @491
-    ungetc                  = _CRTDLL_ungetc        @492
-    ungetwc                 = _CRTDLL_ungetwc       @493
-    vfprintf                = _CRTDLL_vfprintf      @494
-    vfwprintf               = _CRTDLL_vfwprintf     @495
-    vprintf             = _CRTDLL_vprintf       @496
-    vsprintf            = _CRTDLL_vsprintf      @497
-    vswprintf           = _CRTDLL_vswprintf     @498
-    vwprintf                = _CRTDLL_vwprintf      @499
-    wcscat          = _CRTDLL_wcscat        @500
-    wcschr          = _CRTDLL_wcschr        @501
-    wcscmp          = _CRTDLL_wcscmp        @502
-    wcscoll         = _CRTDLL_wcscoll       @503
-    wcscpy          = _CRTDLL_wcscpy        @504
-    wcscspn         = _CRTDLL_wcscspn       @505
-    wcsftime            = _CRTDLL_wcsftime      @506
-    wcslen          = _CRTDLL_wcslen        @507
-    wcsncat         = _CRTDLL_wcsncat       @508
-    wcsncmp         = _CRTDLL_wcsncmp       @509
-    wcsncpy         = _CRTDLL_wcsncpy       @510
-    wcspbrk         = _CRTDLL_wcspbrk       @511
-    wcsrchr         = _CRTDLL_wcsrchr       @512
-    wcsspn          = _CRTDLL_wcsspn        @513
-    wcsstr          = _CRTDLL_wcsstr        @514
-    wcstod          = _CRTDLL_wcstod        @515
-    wcstok          = _CRTDLL_wcstok                @516
-    wcstol          = _CRTDLL_wcstol        @517
-    wcstombs            = _CRTDLL_wcstombs      @518
-    wcstoul         = _CRTDLL_wcstoul       @519
-    wcsxfrm         = _CRTDLL_wcsxfrm       @520
-    wctomb          = _CRTDLL_wctomb        @521
-    wprintf         = _CRTDLL_wprintf       @522
-    wscanf          = _CRTDLL_wscanf        @523
-
-    _setjmp3            = _CRTDLL__setjmp3      @603
Index: trunk/src/crtdll/crtdll.h
===================================================================
--- trunk/src/crtdll/crtdll.h	(revision 9655)
+++ 	(revision )
@@ -1,441 +1,0 @@
-#ifndef __WINE_CRTDLL_H
-#define __WINE_CRTDLL_H
-
-#include "config.h"
-#include "windef.h"
-/* @@@PH #include "wine/windef16.h" */
-#include "debugtools.h"
-#include "winbase.h"
-#include "winerror.h"
-#include "winnls.h"
-#include <time.h>
-#include <stdarg.h>
-#include <setjmp.h>
-
-
-#define CRTDLL_LC_ALL		0
-#define CRTDLL_LC_COLLATE	1
-#define CRTDLL_LC_CTYPE		2
-#define CRTDLL_LC_MONETARY	3
-#define CRTDLL_LC_NUMERIC	4
-#define CRTDLL_LC_TIME		5
-#define CRTDLL_LC_MIN		LC_ALL
-#define CRTDLL_LC_MAX		LC_TIME
-
-/* ctype defines */
-#define CRTDLL_UPPER		0x1
-#define CRTDLL_LOWER		0x2
-#define CRTDLL_DIGIT		0x4
-#define CRTDLL_SPACE		0x8
-#define CRTDLL_PUNCT		0x10
-#define CRTDLL_CONTROL		0x20
-#define CRTDLL_BLANK		0x40
-#define CRTDLL_HEX		0x80
-#define CRTDLL_LEADBYTE		0x8000
-#define CRTDLL_ALPHA		(0x0100|CRTDLL_UPPER|CRTDLL_LOWER)
-
-/* stat() mode bits */
-#define _S_IFMT                  0170000
-#define _S_IFREG                 0100000
-#define _S_IFDIR                 0040000
-#define _S_IFCHR                 0020000
-#define _S_IFIFO                 0010000
-#define _S_IREAD                 0000400
-#define _S_IWRITE                0000200
-#define _S_IEXEC                 0000100
-
-/* _open modes */
-#define _O_RDONLY 0x0000
-#define _O_WRONLY 0x0001
-#define _O_RDWR   0x0002
-#define _O_APPEND 0x0008
-#define _O_CREAT  0x0100
-#define _O_TRUNC  0x0200
-#define _O_EXCL   0x0400
-#define _O_TEXT   0x4000
-#define _O_BINARY 0x8000
-
-/* _access() bit flags FIXME: incomplete */
-#define W_OK      2
-
-/* windows.h RAND_MAX is smaller than normal RAND_MAX */
-#define CRTDLL_RAND_MAX         0x7fff
-
-/* heap function constants */
-
-#ifdef _HEAPEMPTY
-#undef _HEAPEMPTY
-#endif
-
-#ifdef _HEAPOK
-#undef _HEAPOK
-#endif
-
-#ifdef _HEAPBADBEGIN
-#undef _HEAPBADBEGIN
-#endif
-
-#ifdef _HEAPBADNODE
-#undef _HEAPBADNODE
-#endif
-
-#ifdef _HEAPEND
-#undef _HEAPEND
-#endif
-
-#ifdef _HEAPBADPTR
-#undef _HEAPBADPTR
-#endif
-
-#ifdef _FREEENTRY
-#undef _FREEENTRY
-#endif
-
-#ifdef _USEDENTRY
-#undef _USEDENTRY
-#endif
-
-#define _HEAPEMPTY    -1
-#define _HEAPOK       -2
-#define _HEAPBADBEGIN -3
-#define _HEAPBADNODE  -4
-#define _HEAPEND      -5
-#define _HEAPBADPTR   -6
-#define _FREEENTRY    0
-#define _USEDENTRY    1
-
-/* CRTDLL Globals */
-extern INT  CRTDLL_doserrno;
-extern INT  CRTDLL_errno;
-
-
-/* Binary compatable structures, types and defines used
- * by CRTDLL. These should move to external header files,
- * and in some cases need be renamed (CRTDLL_FILE!) to defs
- * as used by lcc/bcc/watcom/vc++ etc, in order to get source
- * compatability for winelib.
- */
-
-typedef struct _crtfile
-{
-  CHAR* _ptr;
-  INT   _cnt;
-  CHAR* _base;
-  INT   _flag;
-  INT   _file; /* fd */
-  int   _charbuf;
-  int   _bufsiz;
-  char *_tmpfname;
-} CRTDLL_FILE;
-
-/* file._flag flags */
-#ifdef _IOEOF
-#undef _IOEOF
-#endif
-
-#ifdef _IOERR
-#undef _IOERR
-#endif
-
-#ifdef EOF
-#undef EOF
-#endif
-
-#define _IOREAD   0x0001
-#define _IOWRT    0x0002
-#define _IOEOF    0x0010
-#define _IOERR    0x0020
-#define _IORW     0x0080
-#define _IOAPPEND 0x0200
-
-#define SEEK_SET    0
-#define SEEK_CUR    1
-#define SEEK_END    2
-
-#define EOF         -1
-
-extern CRTDLL_FILE __CRTDLL_iob[3];
-
-#define CRTDLL_stdin  (&__CRTDLL_iob[0])
-#define CRTDLL_stdout (&__CRTDLL_iob[1])
-#define CRTDLL_stderr (&__CRTDLL_iob[2])
-
-typedef struct _find_t
-{
-  unsigned      attrib;
-  time_t        time_create; /* -1 when N/A */
-  time_t        time_access; /* -1 when N/A */
-  time_t        time_write;
-  unsigned long size;        /* FIXME: 64 bit ??*/
-  char          name[MAX_PATH];
-} find_t;
-
-typedef struct _diskfree_t {
-  unsigned num_clusters;
-  unsigned available;
-  unsigned cluster_sectors;
-  unsigned sector_bytes;
-} diskfree_t;
-
-struct _stat
-{
-    UINT16 st_dev;
-    UINT16 st_ino;
-    UINT16 st_mode;
-    INT16  st_nlink;
-    INT16  st_uid;
-    INT16  st_gid;
-    UINT   st_rdev;
-    INT    st_size;
-    INT    st_atime;
-    INT    st_mtime;
-    INT    st_ctime;
-};
-
-struct _timeb
-{
-  time_t  time;
-  UINT16  millitm;
-  INT16   timezone;
-  INT16   dstflag;
-};
-
-typedef long __CRTDLL_fpos_t;
-struct __CRTDLL_complex
-{
-  double real;
-  double imaginary;
-};
-
-typedef struct _heapinfo
-{
-  int * _pentry;
-  size_t _size;
-  int    _useflag;
-} _HEAPINFO;
-
-typedef VOID (*sig_handler_type)(VOID);
-
-typedef VOID (*new_handler_type)(VOID);
-
-typedef VOID (*_INITTERMFUN)();
-
-typedef VOID (*atexit_function)(VOID);
-
-/* @@@PH typedef INT (__cdecl *comp_func)(LPVOID *,LPVOID *); */
-typedef INT (* _cdecl comp_func)(LPVOID *,LPVOID *);
-
-/* CRTDLL functions */
-
-/* CRTDLL_dir.c */
-INT    __cdecl CRTDLL__chdir( LPCSTR newdir );
-BOOL   __cdecl CRTDLL__chdrive( INT newdrive );
-INT    __cdecl CRTDLL__findclose( DWORD hand );
-DWORD  __cdecl CRTDLL__findfirst( LPCSTR fspec, find_t* ft );
-INT    __cdecl CRTDLL__findnext( DWORD hand, find_t * ft );
-CHAR*  __cdecl CRTDLL__getcwd( LPSTR buf, INT size );
-CHAR*  __cdecl CRTDLL__getdcwd( INT drive,LPSTR buf, INT size );
-UINT   __cdecl CRTDLL__getdiskfree( UINT disk, diskfree_t* d );
-INT    __cdecl CRTDLL__getdrive( VOID );
-INT    __cdecl CRTDLL__mkdir( LPCSTR newdir );
-INT    __cdecl CRTDLL__rmdir( LPSTR dir );
-
-/* CRTDLL_exit.c */
-INT    __cdecl CRTDLL__abnormal_termination( VOID );
-VOID   __cdecl CRTDLL__amsg_exit( INT err );
-VOID   __cdecl CRTDLL__assert( LPVOID str, LPVOID file, UINT line );
-// @@@PH VOID   __cdecl CRTDLL__c_exit( VOID );
-VOID   __cdecl CRTDLL__c_exit( INT ret );
-// @@@PH VOID   __cdecl CRTDLL__cexit( VOID );
-VOID   __cdecl CRTDLL__cexit( INT ret );
-void   __cdecl CRTDLL_exit( DWORD ret );
-VOID   __cdecl CRTDLL__exit( LONG ret );
-VOID   __cdecl CRTDLL_abort( VOID );
-INT    __cdecl CRTDLL_atexit( atexit_function x );
-atexit_function __cdecl CRTDLL__onexit( atexit_function func);
-
-/* CRTDLL_file.c */
-CRTDLL_FILE* __cdecl CRTDLL__iob( VOID );
-CRTDLL_FILE* __cdecl CRTDLL__fsopen( LPCSTR path, LPCSTR mode, INT share );
-CRTDLL_FILE* __cdecl CRTDLL__fdopen( INT fd, LPCSTR mode );
-CRTDLL_FILE* __cdecl CRTDLL_fopen( LPCSTR path, LPCSTR mode );
-CRTDLL_FILE* __cdecl CRTDLL_freopen( LPCSTR path,LPCSTR mode,CRTDLL_FILE* f );
-INT    __cdecl CRTDLL__fgetchar( VOID );
-DWORD  __cdecl CRTDLL_fread( LPVOID ptr,INT size,INT nmemb,CRTDLL_FILE* file );
-INT    __cdecl CRTDLL_fscanf( CRTDLL_FILE* stream, LPSTR format, ... );
-INT    __cdecl CRTDLL__filbuf( CRTDLL_FILE* file );
-INT    __cdecl CRTDLL__fileno( CRTDLL_FILE* file );
-INT    __cdecl CRTDLL__flsbuf( INT c, CRTDLL_FILE* file );
-INT    __cdecl CRTDLL__fputchar( INT c );
-INT    __cdecl CRTDLL__flushall( VOID );
-INT    __cdecl CRTDLL__fcloseall( VOID );
-LONG   __cdecl CRTDLL__lseek( INT fd, LONG offset, INT whence );
-LONG   __cdecl CRTDLL_fseek( CRTDLL_FILE* file, LONG offset, INT whence );
-VOID   __cdecl CRTDLL_rewind( CRTDLL_FILE* file );
-INT    __cdecl CRTDLL_fsetpos( CRTDLL_FILE* file, __CRTDLL_fpos_t *pos );
-LONG   __cdecl CRTDLL_ftell( CRTDLL_FILE* file );
-UINT   __cdecl CRTDLL_fwrite( LPCVOID ptr,INT size,INT nmemb,CRTDLL_FILE*file);
-INT    __cdecl CRTDLL_setbuf( CRTDLL_FILE* file, LPSTR buf );
-INT    __cdecl CRTDLL__open_osfhandle( HANDLE osfhandle, INT flags );
-INT    __cdecl CRTDLL_vfprintf( CRTDLL_FILE* file, LPCSTR format,va_list args);
-INT    __cdecl CRTDLL_fprintf( CRTDLL_FILE* file, LPCSTR format, ... );
-INT    __cdecl CRTDLL__read( INT fd, LPVOID buf, UINT count );
-UINT   __cdecl CRTDLL__write( INT fd,LPCVOID buf,UINT count );
-INT    __cdecl CRTDLL__access( LPCSTR filename, INT mode );
-INT    __cdecl CRTDLL_fflush( CRTDLL_FILE* file );
-INT    __cdecl CRTDLL_fputc( INT c, CRTDLL_FILE* file );
-VOID   __cdecl CRTDLL_putchar( INT x );
-INT    __cdecl CRTDLL_fputs( LPCSTR s, CRTDLL_FILE* file );
-INT    __cdecl CRTDLL_puts( LPCSTR s );
-INT    __cdecl CRTDLL_putc( INT c, CRTDLL_FILE* file );
-INT    __cdecl CRTDLL_fgetc( CRTDLL_FILE* file );
-INT    __cdecl CRTDLL_getchar( VOID );
-INT    __cdecl CRTDLL_getc( CRTDLL_FILE* file );
-CHAR*  __cdecl CRTDLL_fgets( LPSTR s, INT size, CRTDLL_FILE* file );
-LPSTR  __cdecl CRTDLL_gets( LPSTR buf );
-INT    __cdecl CRTDLL_fclose( CRTDLL_FILE* file );
-INT    __cdecl CTRDLL__creat( LPCSTR path, INT flags );
-INT    __cdecl CRTDLL__eof( INT fd );
-LONG   __cdecl CRTDLL__tell(INT fd);
-INT    __cdecl CRTDLL__umask(INT umask);
-INT    __cdecl CRTDLL__unlink( LPCSTR pathname );
-INT    __cdecl CRTDLL_rename( LPCSTR oldpath,LPCSTR newpath );
-int    __cdecl CRTDLL__stat(  LPCSTR filename, struct _stat * buf );
-INT    __cdecl CRTDLL__open( LPCSTR path,INT flags );
-INT    __cdecl CRTDLL__close( INT fd );
-INT    __cdecl CRTDLL_feof( CRTDLL_FILE* file );
-INT    __cdecl CRTDLL__setmode( INT fh,INT mode );
-INT    __cdecl CRTDLL_remove( LPCSTR path );
-INT    __cdecl CRTDLL__commit( INT fd );
-INT    __cdecl CRTDLL__fstat( int file, struct _stat* buf );
-HANDLE __cdecl CRTDLL__get_osfhandle( INT fd );
-
-/* CRTDLL_main.c */
-DWORD  __cdecl CRTDLL__initterm( _INITTERMFUN *start,_INITTERMFUN *end );
-VOID   __cdecl CRTDLL__global_unwind2( PEXCEPTION_FRAME frame );
-VOID   __cdecl CRTDLL__local_unwind2( PEXCEPTION_FRAME endframe, DWORD nr );
-INT    __cdecl CRTDLL__setjmp( LPDWORD *jmpbuf );
-VOID   __cdecl CRTDLL_srand( DWORD seed );
-INT    __cdecl CRTDLL__isatty(INT fd);
-VOID   __cdecl CRTDLL__beep( UINT freq, UINT duration );
-INT    __cdecl CRTDLL_rand( VOID );
-UINT   __cdecl CRTDLL__rotl( UINT x,INT shift );
-DWORD  __cdecl CRTDLL__lrotl( DWORD x,INT shift );
-DWORD  __cdecl CRTDLL__lrotr( DWORD x,INT shift );
-DWORD  __cdecl CRTDLL__rotr( UINT x,INT shift );
-INT    __cdecl CRTDLL__mbsicmp( unsigned char *x,unsigned char *y );
-INT    __cdecl CRTDLL_vswprintf( LPWSTR buffer, LPCWSTR spec, va_list args );
-VOID   __cdecl CRTDLL_longjmp( jmp_buf env, int val );
-LPSTR  __cdecl CRTDLL_setlocale( INT category,LPCSTR locale );
-BOOL   __cdecl CRTDLL__isctype( CHAR x,CHAR type );
-LPSTR  __cdecl CRTDLL__fullpath( LPSTR buf, LPCSTR name, INT size );
-VOID   __cdecl CRTDLL__splitpath( LPCSTR path, LPSTR drive, LPSTR directory,
-                                  LPSTR filename, LPSTR extension );
-LPINT  __cdecl CRTDLL__errno( VOID );
-LPINT  __cdecl CRTDLL___doserrno( VOID );
-LPCSTR**__cdecl CRTDLL__sys_errlist( VOID );
-VOID   __cdecl CRTDLL_perror( LPCSTR err );
-LPSTR  __cdecl CRTDLL__strerror( LPCSTR err );
-LPSTR  __cdecl CRTDLL_strerror( INT err );
-LPSTR  __cdecl CRTDLL__tempnam( LPCSTR dir, LPCSTR prefix );
-LPSTR  __cdecl CRTDLL_tmpnam( LPSTR s );
-LPVOID __cdecl CRTDLL_signal( INT sig, sig_handler_type ptr );
-VOID   __cdecl CRTDLL__sleep( ULONG timeout );
-LPSTR  __cdecl CRTDLL_getenv( LPCSTR name );
-LPSTR  __cdecl CRTDLL__mbsrchr( LPSTR s,CHAR x );
-VOID   __cdecl CRTDLL___dllonexit ( VOID );
-VOID   __cdecl CRTDLL__mbccpy( LPSTR dest, LPSTR src );
-INT    __cdecl CRTDLL___isascii( INT c );
-INT    __cdecl CRTDLL___toascii( INT c );
-INT    __cdecl CRTDLL_iswascii( LONG c );
-INT    __cdecl CRTDLL___iscsym( LONG c );
-INT    __cdecl CRTDLL___iscsymf( LONG c );
-INT    __cdecl CRTDLL__loaddll( LPSTR dllname );
-INT    __cdecl CRTDLL__unloaddll( HANDLE dll );
-WCHAR* __cdecl CRTDLL__itow( INT value,WCHAR* out,INT base );
-WCHAR* __cdecl CRTDLL__ltow( LONG value,WCHAR* out,INT base );
-WCHAR* __cdecl CRTDLL__ultow(ULONG value,WCHAR* out,INT base);
-CHAR   __cdecl CRTDLL__toupper( CHAR c );
-CHAR   __cdecl CRTDLL__tolower( CHAR c );
-double __cdecl CRTDLL__cabs( struct __CRTDLL_complex c );
-double __cdecl CRTDLL__chgsign( double d );
-UINT   __cdecl CRTDLL__control87( UINT, UINT );
-UINT   __cdecl CRTDLL__controlfp( UINT, UINT );
-double __cdecl CRTDLL__copysign(double x, double sign);
-INT    __cdecl CRTDLL__finite( double d );
-VOID   __cdecl CRTDLL__fpreset( void );
-INT    __cdecl CRTDLL__isnan( double d );
-LPVOID __cdecl CRTDLL__lsearch( LPVOID match, LPVOID start, LPUINT array_size,
-                                UINT elem_size, comp_func cf );
-
-/* CRTDLL_mem.c */
-LPVOID  __cdecl CRTDLL_new( DWORD size );
-VOID   __cdecl CRTDLL_delete( LPVOID ptr );
-new_handler_type __cdecl CRTDLL_set_new_handler( new_handler_type func );
-INT    __cdecl CRTDLL__heapchk( VOID );
-INT    __cdecl CRTDLL__heapmin( VOID );
-INT    __cdecl CRTDLL__heapset( UINT value );
-INT    __cdecl CRTDLL__heapwalk( struct _heapinfo *next );
-LPVOID __cdecl CRTDLL__expand( LPVOID ptr, INT size );
-LONG   __cdecl CRTDLL__msize( LPVOID mem );
-LPVOID __cdecl CRTDLL_calloc( DWORD size, DWORD count );
-VOID   __cdecl CRTDLL_free( LPVOID ptr );
-LPVOID __cdecl CRTDLL_malloc( DWORD size );
-LPVOID __cdecl CRTDLL_realloc( VOID *ptr, DWORD size );
-
-/* CRTDLL_spawn.c */
-HANDLE __cdecl CRTDLL__spawnve( INT flags, LPSTR name, LPSTR *argv, LPSTR *envv);
-INT    __cdecl CRTDLL_system( LPSTR x );
-
-/* CRTDLL_str.c */
-LPSTR  __cdecl CRTDLL__strdec( LPSTR str1, LPSTR str2 );
-LPSTR  __cdecl CRTDLL__strdup( LPCSTR ptr );
-LPSTR  __cdecl CRTDLL__strinc( LPSTR str );
-UINT   __cdecl CRTDLL__strnextc( LPCSTR str );
-LPSTR  __cdecl CRTDLL__strninc( LPSTR str, INT n );
-LPSTR  __cdecl CRTDLL__strnset( LPSTR str, INT c, INT len );
-LPSTR  __cdecl CRTDLL__strrev ( LPSTR str );
-LPSTR  __cdecl CRTDLL__strset ( LPSTR str, INT set );
-LONG   __cdecl CRTDLL__strncnt( LPSTR str, LONG max );
-LPSTR  __cdecl CRTDLL__strspnp( LPSTR str1, LPSTR str2 );
-VOID   __cdecl CRTDLL__swab( LPSTR src, LPSTR dst, INT len );
-
-/* CRTDLL_time.c */
-LPSTR   __cdecl CRTDLL__strdate ( LPSTR date );
-LPSTR   __cdecl CRTDLL__strtime ( LPSTR date );
-clock_t __cdecl CRTDLL_clock ( void );
-double  __cdecl CRTDLL_difftime ( time_t time1, time_t time2 );
-time_t  __cdecl CRTDLL_time ( time_t *timeptr );
-
-/* mbstring.c */
-LPSTR  __cdecl CRTDLL__mbsinc( LPCSTR str );
-INT    __cdecl CRTDLL__mbslen( LPCSTR str );
-INT    __cdecl CRTDLL_mbtowc( WCHAR *dst, LPCSTR str, INT n );
-LPWSTR __cdecl CRTDLL__wcsdup( LPCWSTR str );
-INT    __cdecl CRTDLL__wcsicoll( LPCWSTR str1, LPCWSTR str2 );
-LPWSTR __cdecl CRTDLL__wcsnset( LPWSTR str, WCHAR c, INT n );
-LPWSTR __cdecl CRTDLL__wcsrev( LPWSTR str );
-LPWSTR __cdecl CRTDLL__wcsset( LPWSTR str, WCHAR c );
-DWORD  __cdecl CRTDLL_wcscoll( LPCWSTR str1, LPCWSTR str2 );
-LPWSTR __cdecl CRTDLL_wcspbrk( LPCWSTR str, LPCWSTR accept );
-INT    __cdecl CRTDLL_wctomb( LPSTR dst, WCHAR ch );
-
-/* wcstring.c */
-INT    __cdecl CRTDLL_iswalnum( WCHAR wc );
-INT    __cdecl CRTDLL_iswalpha( WCHAR wc );
-INT    __cdecl CRTDLL_iswcntrl( WCHAR wc );
-INT    __cdecl CRTDLL_iswdigit( WCHAR wc );
-INT    __cdecl CRTDLL_iswgraph( WCHAR wc );
-INT    __cdecl CRTDLL_iswlower( WCHAR wc );
-INT    __cdecl CRTDLL_iswprint( WCHAR wc );
-INT    __cdecl CRTDLL_iswpunct( WCHAR wc );
-INT    __cdecl CRTDLL_iswspace( WCHAR wc );
-INT    __cdecl CRTDLL_iswupper( WCHAR wc );
-INT    __cdecl CRTDLL_iswxdigit( WCHAR wc );
-
-/* INTERNAL: Shared internal functions */
-void   __CRTDLL__set_errno(ULONG err);
-LPSTR  __CRTDLL__strndup(LPSTR buf, INT size);
-VOID   __CRTDLL__init_io(VOID);
-
-#endif /* __WINE_CRTDLL_H */
Index: trunk/src/crtdll/crtdll_main.c
===================================================================
--- trunk/src/crtdll/crtdll_main.c	(revision 9655)
+++ 	(revision )
@@ -1,1043 +1,0 @@
-/*
- * The C RunTime DLL
- * 
- * Implements C run-time functionality as known from UNIX.
- *
- * Copyright 1996,1998 Marcus Meissner
- * Copyright 1996 Jukka Iivonen
- * Copyright 1997,2000 Uwe Bonnes
- * Copyright 2000 Jon Griffiths
- */
-
-/*
-Unresolved issues Uwe Bonnes 970904:
-- tested with ftp://ftp.remcomp.com/pub/remcomp/lcc-win32.zip, a C-Compiler
- 		for Win32, based on lcc, from Jacob Navia
-UB 000416:
-- probably not thread safe
-*/
-
-/* NOTE: This file also implements the wcs* functions. They _ARE_ in 
- * the newer Linux libcs, but use 4 byte wide characters, so are unusable,
- * since we need 2 byte wide characters. - Marcus Meissner, 981031
- */
-
-#include <string.h>
-#include <errno.h>
-
-#include <float.h>
-#include <libc\locale.h>
-#include <setjmp.h>
-#include "signal.h"
-
-
-#include "crtdll.h"
-#include <ctype.h>
-#define __USE_ISOC9X 1 /* for isfinite */
-#include <math.h>
-#include <errno.h>
-#include <stdlib.h>
-#include "ntddk.h"
-#include "wingdi.h"
-#include "winuser.h"
-
-
-DEFAULT_DEBUG_CHANNEL(crtdll);
-
-
-UINT CRTDLL_argc_dll;         /* CRTDLL.23 */
-LPSTR *CRTDLL_argv_dll;       /* CRTDLL.24 */
-LPSTR  CRTDLL_acmdln_dll;     /* CRTDLL.38 */
-UINT CRTDLL_basemajor_dll;    /* CRTDLL.42 */
-UINT CRTDLL_baseminor_dll;    /* CRTDLL.43 */
-UINT CRTDLL_baseversion_dll;  /* CRTDLL.44 */
-UINT CRTDLL_commode_dll;      /* CRTDLL.59 */
-LPSTR  CRTDLL_environ_dll;    /* CRTDLL.75 */
-UINT CRTDLL_fmode_dll;        /* CRTDLL.104 */
-UINT CRTDLL_osmajor_dll;      /* CRTDLL.241 */
-UINT CRTDLL_osminor_dll;      /* CRTDLL.242 */
-UINT CRTDLL_osmode_dll;       /* CRTDLL.243 */
-UINT CRTDLL_osver_dll;        /* CRTDLL.244 */
-UINT CRTDLL_osversion_dll;    /* CRTDLL.245 */
-UINT CRTDLL_winmajor_dll;     /* CRTDLL.329 */
-UINT CRTDLL_winminor_dll;     /* CRTDLL.330 */
-UINT CRTDLL_winver_dll;       /* CRTDLL.331 */
-INT  CRTDLL_doserrno = 0; 
-INT  CRTDLL_errno = 0;
-const INT  CRTDLL__sys_nerr = 43;
-
-
-
-
-#define FS_OS2   unsigned short sel = RestoreOS2FS();
-#define FS_WIN32 SetFS(sel);
-
-
-/*********************************************************************
- *                  CRTDLL_MainInit  (CRTDLL.init)
- */
- 
-BOOL WINAPI CRTDLL_Init(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
-{
-  FS_OS2
-    
-    // call i/o initializer in file.c
-    if (fdwReason == DLL_PROCESS_ATTACH) 
-    {
-      __CRTDLL__init_io();
-    }
-    
-  /*
-    PH 2000/11/21 this code doesn't look very useful
-    
-    if (fdwReason == DLL_PROCESS_ATTACH) {
-      _fdopen(0,"r");
-      _fdopen(1,"w");
-      _fdopen(2,"w");
-      CRTDLL_hHeap = HeapCreate(0, 0x10000, 0);
-    }
-    else
-      if (fdwReason == DLL_PROCESS_DETACH) {
-        HeapDestroy(CRTDLL_hHeap);
-        CRTDLL_hHeap = 0;
-      }
-  */
-  
-  FS_WIN32
-  return TRUE;
-}
-
-
-/* INTERNAL: Set the crt and dos errno's from the OS error given. */
-void __CRTDLL__set_errno(ULONG err)
-{
-  /* FIXME: not MT safe */
-  CRTDLL_doserrno = err;
-
-  switch(err)
-  {
-#define ERR_CASE(oserr) case oserr:
-#define ERR_MAPS(oserr,crterr) case oserr:CRTDLL_errno = crterr;break;
-    ERR_CASE(ERROR_ACCESS_DENIED)
-    ERR_CASE(ERROR_NETWORK_ACCESS_DENIED)
-    ERR_CASE(ERROR_CANNOT_MAKE)
-    ERR_CASE(ERROR_SEEK_ON_DEVICE)
-    ERR_CASE(ERROR_LOCK_FAILED)
-    ERR_CASE(ERROR_FAIL_I24)
-    ERR_CASE(ERROR_CURRENT_DIRECTORY)
-    ERR_CASE(ERROR_DRIVE_LOCKED)
-    ERR_CASE(ERROR_NOT_LOCKED)
-    ERR_CASE(ERROR_INVALID_ACCESS)
-    ERR_MAPS(ERROR_LOCK_VIOLATION,       EACCES);
-    ERR_CASE(ERROR_FILE_NOT_FOUND)
-    ERR_CASE(ERROR_NO_MORE_FILES)
-    ERR_CASE(ERROR_BAD_PATHNAME)
-    ERR_CASE(ERROR_BAD_NETPATH)
-    ERR_CASE(ERROR_INVALID_DRIVE)
-    ERR_CASE(ERROR_BAD_NET_NAME)
-    ERR_CASE(ERROR_FILENAME_EXCED_RANGE)
-    ERR_MAPS(ERROR_PATH_NOT_FOUND,       ENOENT);
-/* @@@PH     ERR_MAPS(ERROR_IO_DEVICE,            EIO); */
-    ERR_MAPS(ERROR_BAD_FORMAT,           ENOEXEC);
-    ERR_MAPS(ERROR_INVALID_HANDLE,       EBADF);
-    ERR_CASE(ERROR_OUTOFMEMORY)
-    ERR_CASE(ERROR_INVALID_BLOCK)
-    ERR_CASE(ERROR_NOT_ENOUGH_QUOTA);
-    ERR_MAPS(ERROR_ARENA_TRASHED,        ENOMEM);
-/* @@@PH    ERR_MAPS(ERROR_BUSY,                 EBUSY); */
-    ERR_CASE(ERROR_ALREADY_EXISTS)
-    ERR_MAPS(ERROR_FILE_EXISTS,          EEXIST);
-/* @@@PH    ERR_MAPS(ERROR_BAD_DEVICE,           ENODEV); */
-    ERR_MAPS(ERROR_TOO_MANY_OPEN_FILES,  EMFILE);
-    ERR_MAPS(ERROR_DISK_FULL,            ENOSPC);
-/* @@@PH   ERR_MAPS(ERROR_BROKEN_PIPE,          EPIPE); */
-/* @@@PH   ERR_MAPS(ERROR_POSSIBLE_DEADLOCK,    EDEADLK); */
-/* @@@PH   ERR_MAPS(ERROR_DIR_NOT_EMPTY,        ENOTEMPTY); */
-    ERR_MAPS(ERROR_BAD_ENVIRONMENT,      E2BIG);
-    ERR_CASE(ERROR_WAIT_NO_CHILDREN)
-    ERR_MAPS(ERROR_CHILD_NOT_COMPLETE,   ECHILD);
-    ERR_CASE(ERROR_NO_PROC_SLOTS)
-    ERR_CASE(ERROR_MAX_THRDS_REACHED)
-    ERR_MAPS(ERROR_NESTING_NOT_ALLOWED,  EAGAIN);
-  default:
-    /*  Remaining cases map to EINVAL */
-    /* FIXME: may be missing some errors above */
-    CRTDLL_errno = EINVAL;
-  }
-}
-
-
-/*********************************************************************
- *                  _GetMainArgs  (CRTDLL.022)
- */
-LPSTR * CDECL CRTDLL__GetMainArgs(LPDWORD argc,LPSTR **argv,
-                                LPSTR *environ,DWORD flag)
-{
-        char *cmdline;
-        char  **xargv;
-	int	xargc,end,last_arg,afterlastspace;
-	DWORD	version;
-
-	TRACE("(%p,%p,%p,%ld).\n",
-		argc,argv,environ,flag
-	);
-
-	if (CRTDLL_acmdln_dll != NULL)
-		HeapFree(GetProcessHeap(), 0, CRTDLL_acmdln_dll);
-
-	CRTDLL_acmdln_dll = cmdline = CRTDLL__strdup( GetCommandLineA() );
- 	TRACE("got '%s'\n", cmdline);
-
-	version	= GetVersion();
-	CRTDLL_osver_dll       = version >> 16;
-	CRTDLL_winminor_dll    = version & 0xFF;
-	CRTDLL_winmajor_dll    = (version>>8) & 0xFF;
-	CRTDLL_baseversion_dll = version >> 16;
-	CRTDLL_winver_dll      = ((version >> 8) & 0xFF) + ((version & 0xFF) << 8);
-	CRTDLL_baseminor_dll   = (version >> 16) & 0xFF;
-	CRTDLL_basemajor_dll   = (version >> 24) & 0xFF;
-	CRTDLL_osversion_dll   = version & 0xFFFF;
-	CRTDLL_osminor_dll     = version & 0xFF;
-	CRTDLL_osmajor_dll     = (version>>8) & 0xFF;
-
-	/* missing threading init */
-
-	end=0;last_arg=0;xargv=NULL;xargc=0;afterlastspace=0;
-	while (1)
-	{
-	    if ((cmdline[end]==' ') || (cmdline[end]=='\0'))
-	    {
-		if (cmdline[end]=='\0')
-		    last_arg=1;
-		else
-		    cmdline[end]='\0';
-		/* alloc xargc + NULL entry */
-			xargv=(char**)HeapReAlloc( GetProcessHeap(), 0, xargv,
-		                             sizeof(char*)*(xargc+1));
-		if (strlen(cmdline+afterlastspace))
-		{
-		    xargv[xargc] = CRTDLL__strdup(cmdline+afterlastspace);
-		    xargc++;
-                    if (!last_arg) /* need to seek to the next arg ? */
-		    {
-			end++;
-			while (cmdline[end]==' ')
-			    end++;
-	}
-		    afterlastspace=end;
-		}
-		else
-		{
-		    xargv[xargc] = NULL; /* the last entry is NULL */
-		    break;
-		}
-	    }
-	    else
-		end++;
-	}
-	CRTDLL_argc_dll	= xargc;
-	*argc		= xargc;
-	CRTDLL_argv_dll	= xargv;
-	*argv		= xargv;
-
-	TRACE("found %d arguments\n",
-		CRTDLL_argc_dll);
-	CRTDLL_environ_dll = *environ = GetEnvironmentStringsA();
-	return environ;
-}
-
-
-/*********************************************************************
- *                  _initterm     (CRTDLL.135)
- */
-DWORD CDECL CRTDLL__initterm(_INITTERMFUN *start,_INITTERMFUN *end)
-{
-	_INITTERMFUN	*current;
-
-	TRACE("(%p,%p)\n",start,end);
-	current=start;
-	while (current<end) {
-		if (*current) (*current)();
-		current++;
-	}
-	return 0;
-}
-
-
-/*******************************************************************
- *         _global_unwind2  (CRTDLL.129)
- */
-void CDECL CRTDLL__global_unwind2( PEXCEPTION_FRAME frame )
-{
-    RtlUnwind( frame, 0, NULL, 0 );
-}
-
-
-/*******************************************************************
- *         _local_unwind2  (CRTDLL.173)
- */
-void CDECL CRTDLL__local_unwind2( PEXCEPTION_FRAME endframe, DWORD nr )
-{
-    dprintf2(("CRTDLL: _local_unwind2\n"));
-    TRACE("(%p,%ld)\n",endframe,nr);
-}
-
-
-/*********************************************************************
- *                  _beep          (CRTDLL.045)
- *
- * Output a tone using the PC speaker.
- *
- * PARAMS
- * freq [in]     Frequency of the tone
- *
- * duration [in] Length of time the tone should sound
- *
- * RETURNS
- * None.
- */
-void CDECL CRTDLL__beep( UINT freq, UINT duration)
-{
-    TRACE(":Freq %d, Duration %d\n",freq,duration);
-    Beep(freq, duration);
-}
-
-
-/*********************************************************************
- *                  rand          (CRTDLL.446)
- */
-INT CDECL CRTDLL_rand()
-{
-    return (rand() & CRTDLL_RAND_MAX); 
-}
-
-
-/*********************************************************************
- *                  _rotl          (CRTDLL.259)
- */
-UINT CDECL CRTDLL__rotl(UINT x,INT shift)
-{
-  // return (_rotl(value, shift));
-  
-    shift &= 31;
-    return (x << shift) | (x >> (32-shift));
-}
-
-
-/*********************************************************************
- *                  _lrotl          (CRTDLL.175)
- */
-DWORD CDECL CRTDLL__lrotl(DWORD x,INT shift)
-{
-  // return (_lrotl(value, shift));
-  
-    shift &= 31;
-    return (x << shift) | (x >> (32-shift));
-}
-
-
-/*********************************************************************
- *                  _lrotr          (CRTDLL.176)
- */
-DWORD CDECL CRTDLL__lrotr(DWORD x,INT shift)
-{
-  // return (_lrotr(value, shift));
-  
-    shift &= 0x1f;
-    return (x >> shift) | (x << (32-shift));
-}
-
-
-/*********************************************************************
- *                  _rotr          (CRTDLL.258)
- */
-DWORD CDECL CRTDLL__rotr(UINT x,INT shift)
-{
-  // return (_rotr(value, shift));
-  
-    shift &= 0x1f;
-    return (x >> shift) | (x << (32-shift));
-}
-
-
-/*********************************************************************
- *                  vswprintf      (CRTDLL.501)
- */
-INT CDECL CRTDLL_vswprintf( LPWSTR buffer, LPCWSTR spec, va_list args )
-{
-  // return (vswprintf(s, t, format, arg));
-  
-    return wvsprintfW( buffer, spec, args );
-}
-
-
-/*********************************************************************
- *                  longjmp        (CRTDLL.426)
- */
-VOID CDECL CRTDLL_longjmp(jmp_buf env, int val)
-{
-    FIXME("CRTDLL_longjmp semistub, expect crash\n");
-    longjmp(env, val);
-}
-
-
-/*********************************************************************
- *                  setlocale           (CRTDLL.453)
- */
-LPSTR CDECL CRTDLL_setlocale(INT category,LPCSTR locale)
-{
-  return (setlocale(category, locale));
-  
-  /*
-    LPSTR categorystr;
-
-    switch (category) {
-    case CRTDLL_LC_ALL: categorystr="LC_ALL";break;
-    case CRTDLL_LC_COLLATE: categorystr="LC_COLLATE";break;
-    case CRTDLL_LC_CTYPE: categorystr="LC_CTYPE";break;
-    case CRTDLL_LC_MONETARY: categorystr="LC_MONETARY";break;
-    case CRTDLL_LC_NUMERIC: categorystr="LC_NUMERIC";break;
-    case CRTDLL_LC_TIME: categorystr="LC_TIME";break;
-    default: categorystr = "UNKNOWN?";break;
-    }
-    FIXME("(%s,%s),stub!\n",categorystr,locale);
-    return "C";
-  */
-}
-
-
-/*********************************************************************
- *                  _isctype           (CRTDLL.138)
- */
-BOOL CDECL CRTDLL__isctype(CHAR x,CHAR type)
-{
-    if ((type & CRTDLL_SPACE) && isspace(x))
-        return TRUE;
-    if ((type & CRTDLL_PUNCT) && ispunct(x))
-        return TRUE;
-    if ((type & CRTDLL_LOWER) && islower(x))
-        return TRUE;
-    if ((type & CRTDLL_UPPER) && isupper(x))
-        return TRUE;
-    if ((type & CRTDLL_ALPHA) && isalpha(x))
-        return TRUE;
-    if ((type & CRTDLL_DIGIT) && isdigit(x))
-        return TRUE;
-    if ((type & CRTDLL_CONTROL) && iscntrl(x))
-        return TRUE;
-    /* check CRTDLL_LEADBYTE */
-    return FALSE;
-}
-
-
-/*********************************************************************
- *                  _fullpath           (CRTDLL.114)
- */
-LPSTR CDECL CRTDLL__fullpath(LPSTR buf, LPCSTR name, INT size)
-{
-  // return (_fullpath(buf, path, size));
-  
-  if (!buf)
-  {
-      size = 256;
-      if(!(buf = CRTDLL_malloc(size))) return NULL;
-  }
-  if (!GetFullPathNameA( name, size, buf, NULL )) return NULL;
-  TRACE("CRTDLL_fullpath got %s\n",buf);
-  return buf;
-}
-
-
-/*********************************************************************
- *                  _splitpath           (CRTDLL.279)
- */
-VOID CDECL CRTDLL__splitpath(LPCSTR path, LPSTR drive, LPSTR directory, LPSTR filename, LPSTR extension )
-{
-  // _splitpath( path, drive, dir, fname, ext);
-  
-  /* drive includes :
-     directory includes leading and trailing (forward and backward slashes)
-     filename without dot and slashes
-     extension with leading dot
-     */
-  char * drivechar,*dirchar,*namechar;
-
-  TRACE("CRTDLL__splitpath got %s\n",path);
-
-  drivechar  = strchr(path,':');
-  dirchar    = strrchr(path,'/');
-  namechar   = strrchr(path,'\\');
-  dirchar = max(dirchar,namechar);
-  if (dirchar)
-    namechar   = strrchr(dirchar,'.');
-  else
-    namechar   = strrchr(path,'.');
-
-  if (drive)
-    {
-      *drive = 0x00;
-      if (drivechar)
-      {
-          strncat(drive,path,drivechar-path+1);
-          path = drivechar+1;
-      }
-    }
-  if (directory)
-    {
-      *directory = 0x00;
-      if (dirchar)
-      {
-          strncat(directory,path,dirchar-path+1);
-          path = dirchar+1;
-      }
-    }
-  if (filename)
-    {
-      *filename = 0x00;
-      if (namechar)
-      {
-          strncat(filename,path,namechar-path);
-          if (extension)
-          {
-              *extension = 0x00;
-              strcat(extension,namechar);
-          }
-      }
-    }
-
-  TRACE("CRTDLL__splitpath found %s %s %s %s\n",drive,directory,filename,extension);
-}
-
-
-/*********************************************************************
- *                  _makepath           (CRTDLL.182)
- */
-
-VOID CDECL CRTDLL__makepath(LPSTR path, LPCSTR drive,
-                              LPCSTR directory, LPCSTR filename,
-                              LPCSTR extension )
-{
-  // _makepath(path, drive, dir, fname, ext);
-  
-    char ch;
-    TRACE("CRTDLL__makepath got %s %s %s %s\n", drive, directory,
-          filename, extension);
-
-    if ( !path )
-        return;
-
-    path[0] = 0;
-    if (drive && drive[0])
-    {
-        path[0] = drive[0];
-        path[1] = ':';
-        path[2] = 0;
-    }
-    if (directory && directory[0])
-    {
-        strcat(path, directory);
-        ch = path[strlen(path)-1];
-        if (ch != '/' && ch != '\\')
-            strcat(path,"\\");
-    }
-    if (filename && filename[0])
-    {
-        strcat(path, filename);
-        if (extension && extension[0])
-        {
-            if ( extension[0] != '.' ) {
-                strcat(path,".");
-            }
-            strcat(path,extension);
-        }
-    }
-
-    TRACE("CRTDLL__makepath returns %s\n",path);
-}
-
-
-/*********************************************************************
- *                  _errno           (CRTDLL.52)
- * Return the address of the CRT errno (Not the libc errno).
- * @@@PH Note: veeeery strange ...
- * BUGS
- * Not MT safe.
- */
-LPINT CDECL CRTDLL__errno( VOID )
-{
-  // return (_errno());
-  
-  return &CRTDLL_errno;
-}
-
-
-/*********************************************************************
- *                  __doserrno       (CRTDLL.26)
- * 
- * Return the address of the DOS errno (holding the last OS error).
- * @@@PH Note: veeeery strange ...
- * BUGS
- * Not MT safe.
- */
-LPINT CDECL CRTDLL___doserrno( VOID )
-{
-  // return (__doserrno());
-  
-  return &CRTDLL_doserrno;
-}
-
-
-/**********************************************************************
- *                  _strerror       (CRTDLL.284)
- *
- * Return a formatted system error message.
- *
- * NOTES
- * The caller does not own the string returned.
- */
-extern int sprintf(char *str, const char *format, ...);
-
-LPSTR CDECL CRTDLL__strerror (LPCSTR err)
-{
-  // return (_strerror((char*)s));
-  
-  static char strerrbuff[256];
-  sprintf(strerrbuff,"%s: %s\n",err,CRTDLL_strerror(CRTDLL_errno));
-  return strerrbuff;
-}
-
-
-/*********************************************************************
- *                  perror       (CRTDLL.435)
- *
- * Print a formatted system error message to stderr.
- */
-VOID CDECL CRTDLL_perror (LPCSTR err)
-{
-  // perror( s );
-  
-  char *err_str = CRTDLL_strerror(CRTDLL_errno);
-  CRTDLL_fprintf(CRTDLL_stderr,"%s: %s\n",err,err_str);
-  CRTDLL_free(err_str);
-}
- 
-
-/*********************************************************************
- *                  strerror       (CRTDLL.465)
- *
- * Return the text of an error.
- *
- * NOTES
- * The caller does not own the string returned.
- */
-extern char *strerror(int errnum); 
-
-LPSTR CDECL CRTDLL_strerror (INT err)
-{
-  return strerror(err);
-}
-
-
-/*********************************************************************
- *                  signal           (CRTDLL.455)
- */
-LPVOID CDECL CRTDLL_signal(INT sig, sig_handler_type ptr)
-{
-  //return (signal(sig, ptr));
-  
-  FIXME("(%d %p):stub.\n", sig, ptr);
-  return (void*)-1;
-}
-
-
-/*********************************************************************
- *                  _sleep           (CRTDLL.267)
- */
-VOID CDECL CRTDLL__sleep(ULONG timeout)
-{
-  TRACE("CRTDLL__sleep for %ld milliseconds\n",timeout);
-  Sleep((timeout)?timeout:1);
-}
-
-
-/*********************************************************************
- *                  getenv           (CRTDLL.437)
- */
-LPSTR CDECL CRTDLL_getenv(LPCSTR name)
-{
-  // return (getenv(name));
-  
-     LPSTR environ = GetEnvironmentStringsA();
-     LPSTR pp,pos = NULL;
-     unsigned int length;
-
-     for (pp = environ; (*pp); pp = pp + strlen(pp) +1)
-       {
-	 pos =strchr(pp,'=');
-	 if (pos)
-	   length = pos -pp;
-	 else
-	   length = strlen(pp);
-	 if (!strncmp(pp,name,length)) break;
-       }
-     if ((pp)&& (pos)) 
-       {
-	 pp = pos+1;
-	 TRACE("got %s\n",pp);
-       }
-     FreeEnvironmentStringsA( environ );
-     return pp;
-}
-
-
-/*********************************************************************
- *                  _except_handler2  (CRTDLL.78)
- */
-INT CDECL CRTDLL__except_handler2 (
-	PEXCEPTION_RECORD rec,
-	PEXCEPTION_FRAME frame,
-	PCONTEXT context,
-	PEXCEPTION_FRAME  *dispatcher)
-{
-	FIXME ("exception %lx flags=%lx at %p handler=%p %p %p stub\n",
-	rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress,
-	frame->Handler, context, dispatcher);
-	return ExceptionContinueSearch;
-}
-
-
-/*********************************************************************
- *                  __isascii           (CRTDLL.028)
- *
- */
-INT CDECL CRTDLL___isascii(INT c)
-{
-  return isascii(c);
-}
-
-
-/*********************************************************************
- *                  __toascii           (CRTDLL.035)
- *
- */
-INT CDECL CRTDLL___toascii(INT c)
-{
-  // return (_toascii(c));
-  
-  return c & 0x7f;
-}
-
-
-/*********************************************************************
- *                  iswascii           (CRTDLL.404)
- *
- */
-INT CDECL CRTDLL_iswascii(LONG c)
-{
-  // return  (!((c)&(~0x7f)));
-  return ((unsigned)c < 0x80);
-}
-
-
-/*********************************************************************
- *                  __iscsym           (CRTDLL.029)
- *
- * Is a character valid in a C identifier (a-Z,0-9,_).
- *
- * PARAMS
- *   c       [I]: Character to check
- *
- * RETURNS
- * Non zero if c is valid as t a C identifier.
- */
-INT CDECL CRTDLL___iscsym(LONG c)
-{
-  // return (_iscsym(c));
-  
-  return (isalnum(c) || c == '_');
-}
-
-
-/*********************************************************************
- *                  __iscsymf           (CRTDLL.030)
- *
- * Is a character valid as the first letter in a C identifier (a-Z,_).
- *
- * PARAMS
- *   c [in]  Character to check
- *
- * RETURNS
- *   Non zero if c is valid as the first letter in a C identifier.
- */
-INT CDECL CRTDLL___iscsymf(LONG c)
-{
-  // return (_iscsymf(c));
-  
-  return (isalpha(c) || c == '_');
-}
-
-
-/*********************************************************************
- *                  _loaddll        (CRTDLL.171)
- *
- * Get a handle to a DLL in memory. The DLL is loaded if it is not already.
- *
- * PARAMS
- * dll [in]  Name of DLL to load.
- *
- * RETURNS
- * Success: A handle to the loaded DLL.
- *
- * Failure: FIXME.
- */
-INT CDECL CRTDLL__loaddll(LPSTR dllname)
-{
-  return LoadLibraryA(dllname);
-}
-
-
-/*********************************************************************
- *                  _unloaddll        (CRTDLL.313)
- *
- * Free reference to a DLL handle from loaddll().
- *
- * PARAMS
- *   dll [in] Handle to free.
- *
- * RETURNS
- * Success: 0.
- *
- * Failure: Error number.
- */
-INT CDECL CRTDLL__unloaddll(HANDLE dll)
-{
-  INT err;
-  if (FreeLibrary(dll))
-    return 0;
-  err = GetLastError();
-  __CRTDLL__set_errno(err);
-  return err;
-}
-
-
-/*********************************************************************
- *                  _lsearch        (CRTDLL.177)
- *
- * Linear search of an array of elements. Adds the item to the array if
- * not found.
- *
- * PARAMS
- *   match [in]      Pointer to element to match
- *   start [in]      Pointer to start of search memory
- *   array_size [in] Length of search array (element count)
- *   elem_size [in]  Size of each element in memory
- *   comp_func [in]  Pointer to comparason function (like qsort()).
- *
- * RETURNS
- *   Pointer to the location where element was found or added.
- */
-LPVOID CDECL CRTDLL__lsearch(LPVOID match,LPVOID start, LPUINT array_size,
-                               UINT elem_size, comp_func cf)
-{
-  LPBYTE pStart = (LPBYTE)start;
-  UINT size = *array_size;
-  if (size)
-    do
-    {
-      if (cf((LPVOID*)match, (LPVOID*)pStart) == 0)
-	return pStart; /* found */
-      pStart += elem_size;
-    } while (--size);
-
-  /* not found, add to end */
-  memcpy(pStart, match, elem_size);
-  array_size[0]++;
-  return pStart;
-}
-
-
-/*********************************************************************
- *                  _itow           (CRTDLL.164)
- *
- * Convert an integer to a wide char string.
- */
-/* @@@PH extern LPSTR  CDECL _itoa( long , LPSTR , INT);*/ /* ntdll */
-
-WCHAR* CDECL CRTDLL__itow(INT value,WCHAR* out,INT base)
-{
-  char buff[64]; /* FIXME: Whats the maximum buffer size for INT_MAX? */
-
-  _itoa(value, buff, base);
-  MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, buff, -1, out, 64);
-  return out;
-}
-
-
-/*********************************************************************
- *                  _ltow           (CRTDLL.??)
- *
- * Convert a long to a wide char string.
- */
-/* @@@PH extern LPSTR  CDECL _ltoa( long , LPSTR , INT); */ /* ntdll */
-
-WCHAR* CDECL CRTDLL__ltow(LONG value,WCHAR* out,INT base)
-{
-  char buff[64]; /* FIXME: Whats the maximum buffer size for LONG_MAX? */
-
-  _ltoa(value, buff, base);
-  MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, buff, -1, out, 64);
-  return out;
-}
-
-
-/*********************************************************************
- *                  _ultow           (CRTDLL.??)
- *
- * Convert an unsigned long to a wide char string.
- */
-/* @@@PH extern LPSTR  CDECL _ultoa( long , LPSTR , INT); */ /* ntdll */
-
-WCHAR* CDECL CRTDLL__ultow(ULONG value,WCHAR* out,INT base)
-{
-  char buff[64]; /* FIXME: Whats the maximum buffer size for ULONG_MAX? */
-
-  _ultoa(value, buff, base);
-  MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, buff, -1, out, 64);
-  return out;
-}
-
-
-/*********************************************************************
- *                  _toupper           (CRTDLL.489)
- */
-CHAR CDECL CRTDLL__toupper(CHAR c)
-{
-  // return (_toupper(n));
-  
-  return toupper(c);
-}
-
-
-/*********************************************************************
- *                  _tolower           (CRTDLL.490)
- */
-CHAR CDECL CRTDLL__tolower(CHAR c)
-{
-  // return (_tolower(n));
-  
-  return tolower(c);
-}
-
-
-/* FP functions */
-
-/*********************************************************************
- *                  _cabs           (CRTDLL.048)
- *
- * Return the absolue value of a complex number.
- *
- * PARAMS
- *   c [in] Structure containing real and imaginary parts of complex number.
- *
- * RETURNS
- *   Absolute value of complex number (always a positive real number).
- */
-double CDECL CRTDLL__cabs(struct __CRTDLL_complex c)
-{
-  // return (_cabs(c));
-  
-  return sqrt(c.real * c.real + c.imaginary * c.imaginary);
-}
-
-
-/*********************************************************************
- *                  _chgsign    (CRTDLL.053)
- *
- * Change the sign of an IEEE double.
- *
- * PARAMS
- *   d [in] Number to invert.
- *
- * RETURNS
- *   Number with sign inverted.
- */
-double CDECL CRTDLL__chgsign(double d)
-{
-  /* FIXME: +-infinity,Nan not tested */
-  return -d;
-}
-
-
-/*********************************************************************
- *                  _copysign           (CRTDLL.062)
- *
- * Return the number x with the sign of y.
- */
-double CDECL CRTDLL__copysign(double x, double y)
-{
-  /* FIXME: Behaviour for Nan/Inf etc? */
-  if (y < 0.0)
-    return x < 0.0 ? x : -x;
-
-  return x < 0.0 ? -x : x;
-}
-
-
-/*********************************************************************
- *                  _finite           (CRTDLL.101)
- *
- * Determine if an IEEE double is finite (i.e. not +/- Infinity).
- *
- * PARAMS
- *   d [in]  Number to check.
- *
- * RETURNS
- *   Non zero if number is finite.
- */
-INT CDECL  CRTDLL__finite(double d)
-{
-  return 0;
-  //@@@PH return (isfinite(d)?1:0); /* See comment for CRTDLL__isnan() */
-}
-
-
-/*********************************************************************
- *                  _fpreset           (CRTDLL.107)
- *
- * Reset the state of the floating point processor.
- * 
- * PARAMS
- *   None.
- *
- * RETURNS
- *   None.
- *
- * BUGS
- * Unimplemented.
- */
-VOID CDECL CRTDLL__fpreset(void)
-{
-  //FIXME(":stub!\n");
-  _fpreset();
-}
-
-
-/*********************************************************************
- *                  _isnan           (CRTDLL.164)
- *
- * Determine if an IEEE double is unrepresentable (NaN).
- *
- * PARAMS
- *   d [in]  Number to check.
- *
- * RETURNS
- *   Non zero if number is NaN.
- */
-INT CDECL  CRTDLL__isnan(double d)
-{
-  /* some implementations return -1 for true(glibc), crtdll returns 1.
-   * Do the same, as the result may be used in calculations.
-   */
-   return 0;
-  //@@@PH return isnan(d)?1:0;
-}
Index: trunk/src/crtdll/crtimps.h
===================================================================
--- trunk/src/crtdll/crtimps.h	(revision 9655)
+++ 	(revision )
@@ -1,18 +1,0 @@
-/* $Id: crtimps.h,v 1.1 2000-02-03 21:37:49 sandervl Exp $ */
-
-/* Definitions for the CRTDLL internal imports 
- *
- * Copyright 1999-2000 Jens Wiessner
- *
- */
-
-#ifndef _CRTINTIMP_H
-#define _CRTINTIMP_H
-
-
-int 		CDECL CRTDLL__getch(void);
-VOID* 		CDECL CRTDLL_malloc(DWORD size);
-int    		CDECL CRTDLL__wcsnicmp(LPCWSTR, LPCWSTR, int);
-extern USHORT 	*CRTDLL_pwctype_dll;
-
-#endif
Index: trunk/src/crtdll/crtinc.h
===================================================================
--- trunk/src/crtdll/crtinc.h	(revision 9655)
+++ 	(revision )
@@ -1,181 +1,0 @@
-/* $Id: crtinc.h,v 1.14 2000-02-03 21:37:49 sandervl Exp $ */
-
-/* Definitions for the CRTDLL library (CRTDLL.DLL)
- *
- * Copyright 1999-2000 Jens Wiessner
- *
- */
-
-
-#ifndef MAX_PATHNAME_LEN 
-#define MAX_PATHNAME_LEN 260 
-#endif 
-
-//SvL: Internal heap allocation definitions for NTDLL
-extern HANDLE CRTDLL_hHeap;
-#define Heap_Alloc(a)	HeapAlloc(CRTDLL_hHeap, HEAP_ZERO_MEMORY, a)
-#define Heap_Free(a)	HeapFree(CRTDLL_hHeap, 0, (PVOID)a)
-
-//SvL: per process heap for CRTDLL
-HANDLE CRTDLL_hHeap = 0;
-int __fileno_alloc(HANDLE hFile, int mode);
-
-// Defs
-#define DOSFS_GetFullName(a,b,c) strcpy(c,a) 
-
-
-#if (__IBMCPP__ > 300)
-#define exception _exception
-#endif
-
-typedef struct
-{
-    HANDLE handle;
-    int      pad[7];
-} CRTDLL_FILE, *PCRTDLL_FILE;
-
-
-/* Definition of a full DOS file name */
-typedef struct
-{
-    char  long_name[MAX_PATHNAME_LEN];  /* Long pathname in Unix format */
-    char  short_name[MAX_PATHNAME_LEN]; /* Short pathname in DOS 8.3 format */
-    int   drive;
-} DOS_FULL_NAME;
-
-/* Definition for _cabs */
-struct complex
-{
-	double	x;	/* Real part */
-	double	y;	/* Imaginary part */
-};
-
-typedef VOID (*new_handler_type)(VOID);
-typedef void (*_INITTERMFUN)();
-
-
-CRTDLL_FILE CRTDLL_iob[3];
-
-static CRTDLL_FILE * const CRTDLL_stdin  = &CRTDLL_iob[0];
-static CRTDLL_FILE * const CRTDLL_stdout = &CRTDLL_iob[1];
-static CRTDLL_FILE * const CRTDLL_stderr = &CRTDLL_iob[2];
-static new_handler_type new_handler;
-
-
-// CRTDLL Exports
-double  *CRTDLL_HUGE_dll;        /* CRTDLL.20 */
-UINT 	CRTDLL_argc_dll;         /* CRTDLL.23 */
-LPSTR 	*CRTDLL_argv_dll;        /* CRTDLL.24 */
-int     CRTDLL_mb_cur_max_dll;   /* CRTDLL.31 */
-LPSTR  	CRTDLL_acmdln_dll;       /* CRTDLL.38 */
-UINT 	CRTDLL_basemajor_dll;    /* CRTDLL.42 */
-UINT 	CRTDLL_baseminor_dll;    /* CRTDLL.43 */
-UINT 	CRTDLL_baseversion_dll;  /* CRTDLL.44 */
-UINT 	CRTDLL_commode_dll;      /* CRTDLL.59 */
-UCHAR   *CRTDLL_cpumode_dll;     /* CRTDLL.64 */
-USHORT  *CRTDLL_ctype;	         /* CRTDLL.68 */
-UINT 	CRTDLL_daylight_dll;	 /* CRTDLL.70 */
-LPSTR	CRTDLL_environ_dll;      /* CRTDLL.75 */
-LPSTR	CRTDLL_fileinfo_dll;     /* CRTDLL.95 */
-UINT 	CRTDLL_fmode_dll;        /* CRTDLL.104 */
-LPSTR	CRTDLL_mbctype;	         /* CRTDLL.193 */
-UINT 	CRTDLL_osmajor_dll;      /* CRTDLL.239 */
-UINT 	CRTDLL_osminor_dll;      /* CRTDLL.240 */
-UINT 	CRTDLL_osmode_dll;       /* CRTDLL.241 */
-UINT 	CRTDLL_osver_dll;        /* CRTDLL.242 */
-UINT 	CRTDLL_osversion_dll;    /* CRTDLL.243 */
-USHORT CRTDLL_pctype_dll[] = {0,0}; /* CRTDLL.245 */
-LPSTR  	CRTDLL_pgmptr_dll;       /* CRTDLL.246 */
-USHORT *CRTDLL_pwctype_dll;	 /* CRTDLL.253 */
-UINT 	CRTDLL_timezone_dll;	 /* CRTDLL.304 */
-LPSTR	CRTDLL_tzname;		 /* CRTDLL.307 */
-UINT 	CRTDLL_winmajor_dll;     /* CRTDLL.326 */
-UINT 	CRTDLL_winminor_dll;     /* CRTDLL.327 */
-UINT 	CRTDLL_winver_dll;       /* CRTDLL.328 */
-
-
-//
-// Definitions for internal functions
-//
-void 		qsort1 (char*, char*, size_t,
-                    int (* CDECL)(const void*, const void*));
-
-
-// syserr / sysnerr Defs
-const char *CRTDLL_sys_errlist[] = {
-  /*  0 EZERO          */ "Error 0",
-  /*  1 EPERM          */ "Operation not permitted",
-  /*  2 ENOENT         */ "No such file or directory",
-  /*  3 ESRCH          */ "No such process",
-  /*  4 EINTR          */ "Interrupted system call",
-  /*  5 EIO            */ "I/O error",
-  /*  6 ENXIO          */ "No such device or address",
-  /*  7 E2BIG          */ "Arguments or environment too big",
-  /*  8 ENOEXEC        */ "Invalid executable file format",
-  /*  9 EBADF          */ "Bad file number",
-  /* 10 ECHILD         */ "No children",
-  /* 11 EAGAIN         */ "Resource temporarily unavailable",
-  /* 12 ENOMEM         */ "Not enough memory",
-  /* 13 EACCES         */ "Permission denied",
-  /* 14 EFAULT         */ "Bad address",
-  /* 15 ENOLCK         */ "No locks available",
-  /* 16 EBUSY          */ "Resource busy",
-  /* 17 EEXIST         */ "File exists",
-  /* 18 EXDEV          */ "Cross-device link",
-  /* 19 ENODEV         */ "No such device",
-  /* 20 ENOTDIR        */ "Not a directory",
-  /* 21 EISDIR         */ "Is a directory",
-  /* 22 EINVAL         */ "Invalid argument",
-  /* 23 ENFILE         */ "Too many open files in system",
-  /* 24 EMFILE         */ "Too many open files",
-  /* 25 ENOTTY         */ "Inappropriate ioctl",
-  /* 26 EDEADLK        */ "Resource deadlock avoided",
-  /* 27 EFBIG          */ "File too large",
-  /* 28 ENOSPC         */ "Disk full",
-  /* 29 ESPIPE         */ "Invalid seek",
-  /* 30 EROFS          */ "Read-only file system",
-  /* 31 EMLINK         */ "Too many links",
-  /* 32 EPIPE          */ "Broken pipe",
-  /* 33 EDOM           */ "Domain error",
-  /* 34 ERANGE         */ "Result too large",
-  /* 35 ENOTEMPTY      */ "Directory not empty",
-  /* 36 EINPROGRESS    */ "Operation now in progress",
-  /* 37 ENOSYS         */ "Function not implemented",
-  /* 38 ENAMETOOLONG   */ "File name too long",
-  /* 39 EDESTADDRREQ   */ "Destination address required",
-  /* 40 EMSGSIZE       */ "Message too long",
-  /* 41 EPROTOTYPE     */ "Protocol wrong type for socket",
-  /* 42 ENOPROTOOPT    */ "Option not supported by protocol",
-  /* 43 EPROTONOSUPPORT */ "Protocol not supported",
-  /* 44 ESOCKTNOSUPPORT */ "Socket type not supported",
-  /* 45 EOPNOTSUPP     */ "Operation not supported on socket",
-  /* 46 EPFNOSUPPORT   */ "Protocol family not supported",
-  /* 47 EAFNOSUPPORT   */ "Address family not supported by protocol family",
-  /* 48 EADDRINUSE     */ "Address already in use",
-  /* 49 EADDRNOTAVAIL  */ "Can't assign requested address",
-  /* 50 ENETDOWN       */ "Network is down",
-  /* 51 ENETUNREACH    */ "Network is unreachable",
-  /* 52 ENETRESET      */ "Network dropped connection on reset",
-  /* 53 ECONNABORTED   */ "Software caused connection abort",
-  /* 54 ECONNRESET     */ "Connection reset by peer",
-  /* 55 ENOBUFS        */ "No buffer space available",
-  /* 56 EISCONN        */ "Socket is already connected",
-  /* 57 ENOTCONN       */ "Socket is not connected",
-  /* 58 ESHUTDOWN      */ "Can't send after socket shutdown",
-  /* 59 ETOOMANYREFS   */ "Too many references: can't splice",
-  /* 60 ETIMEDOUT      */ "Connection timed out",
-  /* 61 ECONNREFUSED   */ "Connection refused",
-  /* 62 ELOOP          */ "Too many levels of symbolic links",
-  /* 63 ENOTSOCK       */ "Socket operation on non-socket",
-  /* 64 EHOSTDOWN      */ "Host is down",
-  /* 65 EHOSTUNREACH   */ "No route to host",
-  /* 66 EALREADY       */ "Operation already in progress"
-};
-
-int __sys_nerr = sizeof(CRTDLL_sys_errlist) / sizeof(CRTDLL_sys_errlist[0]);
-int*	CRTDLL_sys_nerr_dll = &__sys_nerr;
-
-
-// atexit
-void (*_atexit_v[64])(void);
-int _atexit_n = 0;
Index: trunk/src/crtdll/dir.c
===================================================================
--- trunk/src/crtdll/dir.c	(revision 9655)
+++ 	(revision )
@@ -1,384 +1,0 @@
-/*
- * CRTDLL drive/directory functions
- *
- * Copyright 1996,1998 Marcus Meissner
- * Copyright 1996 Jukka Iivonen
- * Copyright 1997,2000 Uwe Bonnes
- * Copyright 2000 Jon Griffiths
- *
- *
- * Implementation Notes:
- * MT Safe.
- */
-
-#include "crtdll.h"
-#include <errno.h>
-
-#include "ntddk.h"
-#include <time.h>
-
-#include <string.h>
-#include <ctype.h>                      /* toupper proto */
-
-DEFAULT_DEBUG_CHANNEL(crtdll);
-
-/* INTERNAL: Translate find_t to PWIN32_FIND_DATAA */
-static void __CRTDLL__fttofd(LPWIN32_FIND_DATAA fd, find_t* ft);
-static void __CRTDLL__fttofd(LPWIN32_FIND_DATAA fd, find_t* ft)
-{
-  DWORD dw;
-
-  /* Tested with crtdll.dll Version 2.50.4170 (NT) from win98 SE:
-   * attrib 0x80 (FILE_ATTRIBUTE_NORMAL)is returned as 0.
-   */
-  if (fd->dwFileAttributes  == FILE_ATTRIBUTE_NORMAL)
-    ft->attrib = 0;
-  else
-    ft->attrib = fd->dwFileAttributes;
-
-  RtlTimeToSecondsSince1970( &fd->ftCreationTime, &dw );
-  ft->time_create = dw;
-  RtlTimeToSecondsSince1970( &fd->ftLastAccessTime, &dw );
-  ft->time_access = dw;
-  RtlTimeToSecondsSince1970( &fd->ftLastWriteTime, &dw );
-  ft->time_write = dw;
-  ft->size = fd->nFileSizeLow;
-  strcpy(ft->name, fd->cFileName);
-}
-
-
-/*********************************************************************
- *                  _chdir           (CRTDLL.51)
- *
- * Change the current directory.
- *
- * PARAMS
- *   newdir [in] Directory to change to
- *
- * RETURNS
- * Sucess:  0
- *
- * Failure: -1
- */
-INT CDECL CRTDLL__chdir(LPCSTR newdir)
-{
-  dprintf(("CRTDLL: _chdir(%s)\n",
-          newdir));
-
-  if (!SetCurrentDirectoryA(newdir))
-  {
-    __CRTDLL__set_errno(newdir?GetLastError():0);
-    return -1;
-  }
-  return 0;
-}
-
-
-/*********************************************************************
- *                  _chdrive           (CRTDLL.52)
- *
- * Change the current drive.
- *
- * PARAMS
- *   newdrive [in] new drive to change to, A: =1, B: =2, etc
- *
- * RETURNS
- * Sucess:  0
- *
- * Failure: 1
- */
-BOOL CDECL CRTDLL__chdrive(INT newdrive)
-{
-  char buffer[3] = "A:";
-  buffer[0] += newdrive - 1;
-
-  dprintf(("CRTDLL: _chdrive(%s)\n",
-          buffer));
-
-  if (!SetCurrentDirectoryA( buffer ))
-  {
-    __CRTDLL__set_errno(GetLastError());
-    if (newdrive <= 0)
-      CRTDLL_errno = EACCES;
-    return -1;
-  }
-  return 0;
-}
-
-
-/*********************************************************************
- *                  _findclose     (CRTDLL.098)
- *
- * Free the resources from a search handle created from _findfirst.
- *
- * PARAMS
- *   hand [in]: Search handle to close
- *
- * RETURNS
- * Success:  0
- *
- * Failure:  -1
- */
-INT CDECL CRTDLL__findclose(DWORD hand)
-{
-  dprintf(("CRTDLL: _findclose(%08xh)\n",
-          hand));
-
-  if (!FindClose((HANDLE)hand))
-  {
-    __CRTDLL__set_errno(GetLastError());
-    return -1;
-  }
-  return 0;
-}
-
-
- /*********************************************************************
- *                  _findfirst    (CRTDLL.099)
- *
- * Create and return a search handle for iterating through a file and
- * directory list.
- *
- * PARAMS
- *   fspec [in]  File specification string for search, e.g "C:\*.BAT"
- *
- *   ft [out]    A pointer to a find_t structure to populate.
- *
- * RETURNS
- * Success:  A handle for the search, suitable for passing to _findnext
- *           or _findclose. Populates the members of ft with the details
- *           of the first matching file.
- *
- * Failure:  -1.
- */
-DWORD CDECL CRTDLL__findfirst(LPCSTR fspec, find_t* ft)
-{
-  WIN32_FIND_DATAA find_data;
-  HANDLE hfind;
-
-  dprintf(("CRTDLL: _findfirst(%s)\n",
-          fspec));
-
-  hfind  = FindFirstFileA(fspec, &find_data);
-  if (hfind == INVALID_HANDLE_VALUE)
-  {
-    __CRTDLL__set_errno(GetLastError());
-    return -1;
-  }
-  __CRTDLL__fttofd(&find_data,ft);
-  TRACE(":got handle %d\n",hfind);
-  return hfind;
-}
-
-
-/*********************************************************************
- *                  _findnext     (CRTDLL.100)
- *
- * Return the next matching file/directory from a search hadle.
- *
- * PARAMS
- *   hand [in] Search handle from a pervious call to _findfirst
- *
- *   ft [out]  A pointer to a find_t structure to populate.
- *
- * RETURNS
- * Success:  0. Populates the members of ft with the details
- *           of the first matching file
- *
- * Failure:  -1
- */
-INT CDECL CRTDLL__findnext(DWORD hand, find_t * ft)
-{
-  WIN32_FIND_DATAA find_data;
-
-  dprintf(("CRTDLL: _findnext(%08xh)\n",
-          hand));
-
-  if (!FindNextFileA(hand, &find_data))
-  {
-    SetLastError(ERROR_INVALID_DRIVE);
-    __CRTDLL__set_errno(GetLastError());
-    return -1;
-  }
-
-  __CRTDLL__fttofd(&find_data,ft);
-  return 0;
-}
-
-
-/*********************************************************************
- *                  _getcwd           (CRTDLL.120)
- *
- * Get the current directory.
- *
- * PARAMS
- * buf [out]  A buffer to place the current directory name in
- *
- * size [in]  The size of buf.
- *
- * RETURNS
- * Success: buf, or if buf is NULL, an allocated buffer
- *
- * Failure: NULL
- */
-CHAR* CDECL CRTDLL__getcwd(LPSTR buf, INT size)
-{
-  // return (_getcwd(buf, size));
-
-  char dir[_MAX_PATH];
-  int dir_len = GetCurrentDirectoryA(_MAX_PATH,dir);
-
-  dprintf(("CRTDLL: _getcwd()\n"));
-
-  if (dir_len < 1)
-    return NULL; /* FIXME: Real return value untested */
-
-  if (!buf)
-  {
-    if (size < 0)
-      return CRTDLL__strdup(dir);
-        return __CRTDLL__strndup(dir,size);
-  }
-  if (dir_len >= size)
-  {
-    CRTDLL_errno = ERANGE;
-    return NULL; /* buf too small */
-  }
-  strcpy(buf,dir);
-  return buf;
-}
-
-
-/*********************************************************************
- *                  _getdcwd           (CRTDLL.121)
- *
- * Get the current directory on a drive. A: =1, B: =2, etc.
- * Passing drive 0 means the current drive.
- */
-CHAR* CDECL CRTDLL__getdcwd(INT drive,LPSTR buf, INT size)
-{
-  // return (_getdcwd(drive, buffer, maxlen));
-
-  static CHAR* dummy;
-
-  dprintf(("CRTDLL: _getdcwd()\n"));
-
-  if (!drive || drive == CRTDLL__getdrive())
-    return CRTDLL__getcwd(buf,size); /* current */
-  else
-  {
-    char dir[_MAX_PATH];
-    char drivespec[4] = {'A', ':', '\\', 0};
-    int dir_len;
-
-    drivespec[0] += drive - 1;
-    if (GetDriveTypeA(drivespec) < DRIVE_REMOVABLE)
-    {
-      CRTDLL_errno = EACCES;
-      return NULL;
-    }
-
-    dir_len = GetFullPathNameA(drivespec,_MAX_PATH,dir,&dummy);
-    if (dir_len >= size || dir_len < 1)
-    {
-      CRTDLL_errno = ERANGE;
-      return NULL; /* buf too small */
-    }
-
-    if (!buf)
-      return CRTDLL__strdup(dir); /* allocate */
-
-    strcpy(buf,dir);
-  }
-  return buf;
-}
-
-
-/*********************************************************************
- *                  _getdiskfree     (CRTDLL.122)
- *
- * Get free disk space on given drive or the current drive.
- *
- */
-UINT CDECL CRTDLL__getdiskfree(UINT disk, diskfree_t* d)
-{
-  char drivespec[4] = {'@', ':', '\\', 0};
-  DWORD ret[4];
-  UINT err;
-
-  dprintf(("CRTDLL: _getdiskfree(%08xh)\n", disk));
-
-  if (disk > 26)
-    return ERROR_INVALID_PARAMETER; /* CRTDLL doesn't set errno here */
-
-  drivespec[0] += disk; /* make a drive letter */
-
-  if (GetDiskFreeSpaceA(disk==0?NULL:drivespec,ret,ret+1,ret+2,ret+3))
-  {
-    d->cluster_sectors = (unsigned)ret[0];
-    d->sector_bytes = (unsigned)ret[1];
-    d->available = (unsigned)ret[2];
-    d->num_clusters = (unsigned)ret[3];
-    return 0;
-  }
-  err = GetLastError();
-  __CRTDLL__set_errno(err);
-  return err;
-}
-
-
-/*********************************************************************
- *                  _getdrive           (CRTDLL.124)
- *
- *  Return current drive, A: =1, B: =2, etc
- */
-INT CDECL CRTDLL__getdrive(VOID)
-{
-  // return DRIVE_GetCurrentDrive() + 1;
-
-  char buffer[MAX_PATH];
-
-  dprintf(("CRTDLL: _getdrive()\n"));
-
-  if (!GetCurrentDirectoryA( sizeof(buffer), buffer ))
-    return 0;
-  if (buffer[1] != ':')
-    return 0;
-  return toupper(buffer[0]) - 'A' + 1;
-}
-
-
-/*********************************************************************
- *                  _mkdir           (CRTDLL.234)
- *
- * Create a directory.
- */
-INT CDECL CRTDLL__mkdir(LPCSTR newdir)
-{
-  dprintf(("CRTDLL: _mkdir(%s)\n",
-          newdir));
-
-  if (CreateDirectoryA(newdir,NULL))
-    return 0;
-
-  __CRTDLL__set_errno(GetLastError());
-  return -1;
-}
-
-/*********************************************************************
- *                  _rmdir           (CRTDLL.255)
- *
- * Delete a directory
- *
- */
-INT CDECL CRTDLL__rmdir(LPSTR dir)
-{
-  dprintf(("CRTDLL: _rmdir(%s)\n",
-          dir));
-
-  if (RemoveDirectoryA(dir))
-    return 0;
-
-  __CRTDLL__set_errno(GetLastError());
-  return -1;
-}
Index: trunk/src/crtdll/exit.c
===================================================================
--- trunk/src/crtdll/exit.c	(revision 9655)
+++ 	(revision )
@@ -1,234 +1,0 @@
-/*
- * CRTDLL exit/abort/atexit functions
- * 
- * Copyright 1996,1998 Marcus Meissner
- * Copyright 1996 Jukka Iivonen
- * Copyright 1997,2000 Uwe Bonnes
- * Copyright 2000 Jon Griffiths
- *
- * exit functions differ in whether they perform cleanup
- * and whether they return to the caller (really!).
- *            return      do
- *  Name      to caller?  cleanup? 
- *  _c_exit     Y           N
- *  _cexit      Y           Y
- *  _exit       N           N
- *  exit        N           Y
- *
- * Implementation Notes:
- * Not MT Safe - Adding/Executing exit() functions should be locked
- * for MT safety.
- *
- * FIXME:
- * Need a better way of printing errors for GUI programs(MsgBox?).
- * Is there really a difference between onexit/atexit?
- */
-#include "crtdll.h"
-#include <errno.h>
-#include "process.h"
-
-
-DEFAULT_DEBUG_CHANNEL(crtdll);
-
-/* INTERNAL: Table of registered atexit() functions */
-/* FIXME: This should be dynamically allocated */
-#define CRTDLL_ATEXIT_TABLE_SIZE 16
-
-static atexit_function atexit_table[CRTDLL_ATEXIT_TABLE_SIZE];
-static int atexit_registered = 0; /* Points to free slot */
-
-
-/* INTERNAL: call atexit functions */
-void __CRTDLL__call_atexit(VOID);
-void __CRTDLL__call_atexit(VOID)
-{
-  /* Last registered gets executed first */
-  while (atexit_registered > 0)
-  {
-    atexit_registered--;
-    TRACE(":call function (%p)\n",atexit_table[atexit_registered]);
-    (*atexit_table[atexit_registered])();
-  }
-}
-
-
-/*********************************************************************
- *	__dllonexit           			(CRTDLL.25)
- */
-VOID CDECL CRTDLL___dllonexit ()
-{	
-  dprintf(("__dllonexit not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-}
-
-
-/*********************************************************************
- *	_abnormal_termination			(CRTDLL.36)
- */
-int CDECL CRTDLL__abnormal_termination(void)
-{
-  dprintf(("CRTDLL: _abnormal_termination  not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;  /* FIXME: Can we determine if we are in an exception? */
-}
-
-
-/*********************************************************************
- *                  _amsg_exit     (CRTDLL.040)
- *
- * Print an error message and terminate execution. Returns 255 to the
- * host OS.
- */
-VOID CDECL CRTDLL__amsg_exit(int errnum)
-{
-  dprintf2(("CRTDLL: _amsg_exit\n"));
-  
-  // fprintf(stderr,strerror(errnum));
-  // ExitProcess(-1);
-  
-  CRTDLL_fprintf(CRTDLL_stderr,"\nrun-time error:\nError Code %d\n",errnum);
-  CRTDLL__exit(255);
-}
-
-
-/*********************************************************************
- *                  _assert     (CRTDLL.041)
- *
- * Print an assertion message and call abort(). Really only present 
- * for win binaries. Winelib programs would typically use libc's
- * version.
- */
-VOID CDECL CRTDLL__assert(LPVOID str, LPVOID file, UINT line)
-{
-  dprintf2(("CRTDLL: _assert\n"));
-  
-  CRTDLL_fprintf(CRTDLL_stderr,"Assertion failed: %s, file %s, line %d\n\n",
-                 (char*)str,(char*)file, line);
-  CRTDLL_abort();
-  
-  // _assert(str, file, line);
-}
-
-
-/*********************************************************************
- *                  _c_exit           (CRTDLL.047)
- * @@@PH verify if argument ret is correct, or void is correct (WINE)
- */
-VOID CDECL CRTDLL__c_exit(INT ret)
-{
-  dprintf2(("_c_exit(%d)\n",ret));
-  FIXME("not calling CRTDLL cleanup\n");
-  
-  /* dont exit, return to caller */
-  
-  ExitProcess(ret);
-}
-
-
-/*********************************************************************
- *                  _cexit           (CRTDLL.049)
- * @@@PH verify if argument ret is correct, or void is correct (WINE)
- */
-VOID CDECL CRTDLL__cexit(INT ret)
-{
-  dprintf2(("_cexit(%d)\n",ret));
-  FIXME("not calling CRTDLL cleanup\n");
-  /* dont exit, return to caller */
-  
-  ExitProcess(ret);
-}
-
-
-/*********************************************************************
- *                  _exit           (CRTDLL.087)
- */
-VOID CDECL CRTDLL__exit(LONG ret)
-{
-  dprintf2(("CRTDLL: _exit (%08xh)\n", 
-            ret));
-  TRACE(":exit code %ld\n",ret);
-  CRTDLL__c_exit(ret);
-  ExitProcess(ret);
-}
-
-
-/*********************************************************************
- *                  _onexit           (CRTDLL.236)
- *
- * Register a function to be called when the process terminates.
- */
-atexit_function CDECL CRTDLL__onexit( atexit_function func)
-{
-  TRACE("registering function (%p)\n",func);
-  if (func && atexit_registered <= CRTDLL_ATEXIT_TABLE_SIZE - 1)
-  {
-    atexit_table[atexit_registered] = (atexit_function)func;
-    atexit_registered++;
-    return func; /* successful */
-  }
-  ERR(":Too many onexit() functions, or NULL function - not registered!\n");
-  return NULL;
-
-  // onexit_t CDECL CRTDLL__onexit(onexit_t t)
-  // {
-  //   dprintf2(("CRTDLL: _onexit\n"));
-  //   return (_onexit(t));
-  // }
-}
-
-
-/*********************************************************************
- *                  exit          (CRTDLL.359)
- */
-VOID CDECL CRTDLL_exit(DWORD ret)
-{
-  TRACE(":exit code %ld\n",ret);
-  __CRTDLL__call_atexit();
-  CRTDLL__cexit(ret);
-  ExitProcess(ret);
-}
-
-
-/*********************************************************************
- *                   abort     (CRTDLL.335)
- *
- * Terminate the progam with an abnormal termination message. Returns
- * 3 to the host OS.
- */
-VOID CDECL CRTDLL_abort()
-{
-  dprintf2(("CRTDLL: abort\n"));
-  
-  CRTDLL_fprintf(CRTDLL_stderr,"\nabnormal program termination\n");
-  CRTDLL__exit(3);
-  //abort();
-}
-
-
-/*********************************************************************
- *                  atexit	(CRTDLL.342)
- *
- * Register a function to be called when the process terminates.
- */
-INT CDECL CRTDLL_atexit(void (*func)(void))
-{
-  dprintf(("CRTDLL: atexit\n"));
-  
-  return CRTDLL__onexit(func) == func ? 0 : -1;
-  
-  // if (_atexit_n >= sizeof (_atexit_v) / sizeof (_atexit_v[0]))
-  //   return -1;
-  // _atexit_v[_atexit_n++] = func;
-  // return 0;
-}
-
-
-/*********************************************************************
- *                  _aexit_rtn_dll    (CRTDLL.39)
- */
-VOID CDECL CRTDLL__aexit_rtn_dll(int exitcode)
-{
-  dprintf2(("CRTDLL: _aexit_rtn_dll\n"));
-  ExitProcess(exitcode);
-}
-
Index: trunk/src/crtdll/file.c
===================================================================
--- trunk/src/crtdll/file.c	(revision 9655)
+++ 	(revision )
@@ -1,1613 +1,0 @@
-/*
- * CRTDLL file functions
- * 
- * Copyright 1996,1998 Marcus Meissner
- * Copyright 1996 Jukka Iivonen
- * Copyright 1997,2000 Uwe Bonnes
- * Copyright 2000 Jon Griffiths
- *
- * Implementation Notes:
- * Mapping is performed between FILE*, fd and HANDLE's. This allows us to 
- * implement all calls using the Win32 API, support remapping fd's to 
- * FILES and do some other tricks as well (like closeall, _get_osfhandle).
- * For mix and matching with the host libc, processes can use the Win32 HANDLE
- * to get a real unix fd from the wineserver. Or we could do this once
- * on create, and provide a function to return it quickly (store it
- * in the mapping table). Note that If you actuall _do_ this, you should
- * call rewind() before using any other crt functions on the file. To avoid
- * the confusion I got when reading the API docs, fd is always refered
- * to as a file descriptor here. In the API docs its called a file handle
- * which is confusing with Win32 HANDLES.
- * M$ CRT includes inline versions of some of these functions (like feof()).
- * These inlines check/modify bitfields in the FILE structure, so we set
- * _flags/_file/_cnt in the FILE* to be binary compatable with the win dll.
- * lcc defines _IOAPPEND as one of the flags for a FILE*, but testing shows
- * that M$ CRT never sets it. So we keep the flag in our mapping table but
- * mask it out when we populate a FILE* with it. Then when we write we seek
- * to EOF if _IOAPPEND is set for the underlying fd.
- *
- * FIXME:
- * Not MT safe. Need locking around file access and allocation for this.
- * NT has no effective limit on files - neither should we. This will be fixed
- * with dynamic allocation of the file mapping array.
- * Buffering is handled differently. Have to investigate a) how much control
- * we have over buffering in win32, and b) if we care ;-)
- */
-
-#include <odin.h>
-
-#include "crtdll.h"
-#include <stdarg.h>
-#include <string.h>
-#include <ctype.h>
-#include <errno.h>
-#include "ntddk.h"
-
-DEFAULT_DEBUG_CHANNEL(crtdll);
-
-/* FIXME: Make this dynamic */
-#define CRTDLL_MAX_FILES 257
-
-HANDLE __CRTDLL_handles[CRTDLL_MAX_FILES];
-CRTDLL_FILE* __CRTDLL_files[CRTDLL_MAX_FILES];
-INT  __CRTDLL_flags[CRTDLL_MAX_FILES];
-CRTDLL_FILE __CRTDLL_iob[3];
-
-static int __CRTDLL_fdstart = 3; /* first unallocated fd */
-static int __CRTDLL_fdend = 3; /* highest allocated fd */
-
-/* INTERNAL: process umask */
-static INT __CRTDLL_umask = 0;
-
-/* INTERNAL: Static buffer for temp file name */
-static char CRTDLL_tmpname[MAX_PATH];
-
-/* file extentions recognised as executables */
-static const unsigned int EXE = 'e' << 16 | 'x' << 8 | 'e';
-static const unsigned int BAT = 'b' << 16 | 'a' << 8 | 't';
-static const unsigned int CMD = 'c' << 16 | 'm' << 8 | 'd';
-static const unsigned int COM = 'c' << 16 | 'o' << 8 | 'm';
-
-/* for stat mode, permissions apply to all,owner and group */
-#define CRTDLL_S_IREAD  (_S_IREAD  | (_S_IREAD  >> 3) | (_S_IREAD  >> 6))
-#define CRTDLL_S_IWRITE (_S_IWRITE | (_S_IWRITE >> 3) | (_S_IWRITE >> 6))
-#define CRTDLL_S_IEXEC  (_S_IEXEC  | (_S_IEXEC  >> 3) | (_S_IEXEC  >> 6))
-
-
-/* INTERNAL: Get the HANDLE for a fd */
-static HANDLE __CRTDLL__fdtoh(INT fd);
-static HANDLE __CRTDLL__fdtoh(INT fd)
-{
-  if (fd < 0 || fd >= __CRTDLL_fdend ||
-      __CRTDLL_handles[fd] == INVALID_HANDLE_VALUE)
-  {
-    WARN(":fd (%d) - no handle!\n",fd);
-    CRTDLL_doserrno = 0;
-    CRTDLL_errno = EBADF;
-   return INVALID_HANDLE_VALUE;
-  }
-  return __CRTDLL_handles[fd];
-}
-
-
-/* INTERNAL: free a file entry fd */
-static void __CRTDLL__free_fd(INT fd);
-static void __CRTDLL__free_fd(INT fd)
-{
-  __CRTDLL_handles[fd] = INVALID_HANDLE_VALUE;
-  __CRTDLL_files[fd] = 0;
-  __CRTDLL_flags[fd] = 0;
-  TRACE(":fd (%d) freed\n",fd);
-  if (fd < 3)
-    return; /* dont use 0,1,2 for user files */
-  if (fd == __CRTDLL_fdend - 1)
-    __CRTDLL_fdend--;
-  if (fd < __CRTDLL_fdstart)
-    __CRTDLL_fdstart = fd;
-}
-
-
-/* INTERNAL: Allocate an fd slot from a Win32 HANDLE */
-static INT __CRTDLL__alloc_fd(HANDLE hand, INT flag);
-static INT __CRTDLL__alloc_fd(HANDLE hand, INT flag)
-{
-  INT fd = __CRTDLL_fdstart;
-
-  TRACE(":handle (%d) allocating fd (%d)\n",hand,fd);
-  if (fd >= CRTDLL_MAX_FILES)
-  {
-    WARN(":files exhausted!\n");
-    return -1;
-  }
-  __CRTDLL_handles[fd] = hand;
-  __CRTDLL_flags[fd] = flag;
-
-  /* locate next free slot */
-  if (fd == __CRTDLL_fdend)
-    __CRTDLL_fdstart = ++__CRTDLL_fdend;
-  else
-    while(__CRTDLL_fdstart < __CRTDLL_fdend &&
-	  __CRTDLL_handles[__CRTDLL_fdstart] != INVALID_HANDLE_VALUE)
-      __CRTDLL_fdstart++;
-
-  return fd;
-}
-
-
-/* INTERNAL: Allocate a FILE* for an fd slot
- * This is done lazily to avoid memory wastage for low level open/write
- * usage when a FILE* is not requested (but may be later).
- */
-static CRTDLL_FILE* __CRTDLL__alloc_fp(INT fd);
-static CRTDLL_FILE* __CRTDLL__alloc_fp(INT fd)
-{
-  TRACE(":fd (%d) allocating FILE*\n",fd);
-  if (fd < 0 || fd >= __CRTDLL_fdend || 
-      __CRTDLL_handles[fd] == INVALID_HANDLE_VALUE)
-  {
-    WARN(":invalid fd %d\n",fd);
-    CRTDLL_doserrno = 0;
-    CRTDLL_errno = EBADF;
-    return NULL;
-  }
-  if (!__CRTDLL_files[fd])
-  {
-    if ((__CRTDLL_files[fd] = CRTDLL_calloc(sizeof(CRTDLL_FILE),1)))
-    {
-      __CRTDLL_files[fd]->_file = fd;
-      __CRTDLL_files[fd]->_flag = __CRTDLL_flags[fd];
-      __CRTDLL_files[fd]->_flag &= ~_IOAPPEND; /* mask out, see above */
-    }
-  }
-  TRACE(":got FILE* (%p)\n",__CRTDLL_files[fd]);
-  return __CRTDLL_files[fd];
-}
-
-
-/* INTERNAL: Set up stdin, stderr and stdout */
-VOID __CRTDLL__init_io(VOID)
-{
-  int i;
-  memset(__CRTDLL_iob,0,3*sizeof(CRTDLL_FILE));
-  __CRTDLL_handles[0] = GetStdHandle(STD_INPUT_HANDLE);
-  __CRTDLL_flags[0] = __CRTDLL_iob[0]._flag = _IOREAD;
-  __CRTDLL_handles[1] = GetStdHandle(STD_OUTPUT_HANDLE);
-  __CRTDLL_flags[1] = __CRTDLL_iob[1]._flag = _IOWRT;
-  __CRTDLL_handles[2] = GetStdHandle(STD_ERROR_HANDLE);
-  __CRTDLL_flags[2] = __CRTDLL_iob[2]._flag = _IOWRT;
-
-  TRACE(":handles (%d)(%d)(%d)\n",__CRTDLL_handles[0],
-	__CRTDLL_handles[1],__CRTDLL_handles[2]);
-
-  for (i = 0; i < 3; i++)
-  {
-    /* FILE structs for stdin/out/err are static and never deleted */
-    __CRTDLL_files[i] = &__CRTDLL_iob[i];
-    __CRTDLL_iob[i]._file = i;
-  }
-}
-
-
-/*********************************************************************
- *                  _access          (CRTDLL.37)
- */
-INT CDECL CRTDLL__access(LPCSTR filename, INT mode)
-{
-  // return (_access(path, mode));
-  
-  DWORD attr = GetFileAttributesA(filename);
-
-  if (attr == -1)
-  {
-    if (!filename)
-    {
-	/* FIXME: Should GetFileAttributesA() return this? */
-      __CRTDLL__set_errno(ERROR_INVALID_DATA);
-      return -1;
-    }
-    __CRTDLL__set_errno(GetLastError());
-    return -1;
-  }
-  if ((attr & FILE_ATTRIBUTE_READONLY) && (mode & W_OK))
-  {
-    __CRTDLL__set_errno(ERROR_ACCESS_DENIED);
-    return -1;
-  }
-  TRACE(":file %s, mode (%d) ok\n",filename,mode);
-  return 0;
-}
-
-
-/*********************************************************************
- *                  _close           (CRTDLL.57)
- *
- * Close an open file descriptor.
- */
-INT CDECL CRTDLL__close(INT fd)
-{
-  HANDLE hand = __CRTDLL__fdtoh(fd);
-
-  TRACE(":fd (%d) handle (%d)\n",fd,hand);
-  if (hand == INVALID_HANDLE_VALUE)
-    return -1;
-
-  /* Dont free std FILE*'s, they are not dynamic */
-  if (fd > 2 && __CRTDLL_files[fd])
-    CRTDLL_free(__CRTDLL_files[fd]);
-
-  __CRTDLL__free_fd(fd);
-
-  if (!CloseHandle(hand))
-  {
-    WARN(":failed-last error (%ld)\n",GetLastError());
-    __CRTDLL__set_errno(GetLastError());
-    return -1;
-  }
-  TRACE(":ok\n");
-  return 0;
-}
-
-
-/*********************************************************************
- *                  _commit           (CRTDLL.58)
- *
- * Ensure all file operations have been flushed to the drive.
- */
-INT CDECL CRTDLL__commit(INT fd)
-{
-  HANDLE hand = __CRTDLL__fdtoh(fd);
-
-  TRACE(":fd (%d) handle (%d)\n",fd,hand);
-  if (hand == INVALID_HANDLE_VALUE)
-    return -1;
-
-  if (!FlushFileBuffers(hand))
-  {
-    if (GetLastError() == ERROR_INVALID_HANDLE)
-    {
-      /* FlushFileBuffers fails for console handles
-       * so we ignore this error.
-       */
-      return 0;
-    }
-    TRACE(":failed-last error (%ld)\n",GetLastError());
-    __CRTDLL__set_errno(GetLastError());
-    return -1;
-  }
-  TRACE(":ok\n");
-  return 0;
-}
-
-
-/*********************************************************************
- *                  _creat         (CRTDLL.066)
- *
- * Open a file, creating it if it is not present.
- */
-INT CDECL CRTDLL__creat(LPCSTR path, INT flags)
-{
-  // return (_creat(s, i));
-
-  INT usedFlags = (flags & _O_TEXT)| _O_CREAT| _O_WRONLY| _O_TRUNC;
-  return CRTDLL__open(path, usedFlags);
-}
-
-
-/*********************************************************************
- *                  _eof           (CRTDLL.076)
- *
- * Determine if the file pointer is at the end of a file.
- */
-/* FIXME: Care for large files */
-INT CDECL CRTDLL__eof( INT fd )
-{
-  // return (__eof(_fd));
-  
-  DWORD curpos,endpos;
-  HANDLE hand = __CRTDLL__fdtoh(fd);
-
-  TRACE(":fd (%d) handle (%d)\n",fd,hand);
-
-  if (hand == INVALID_HANDLE_VALUE)
-    return -1;
-
-  /* If we have a FILE* for this file, the EOF flag
-   * will be set by the read()/write() functions.
-   */
-  if (__CRTDLL_files[fd])
-    return __CRTDLL_files[fd]->_flag & _IOEOF;
-
-  /* Otherwise we do it the hard way */
-  curpos = SetFilePointer( hand, 0, NULL, SEEK_CUR );
-  endpos = SetFilePointer( hand, 0, NULL, FILE_END );
-
-  if (curpos == endpos)
-    return TRUE;
-
-  SetFilePointer( hand, curpos, 0, FILE_BEGIN);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *                  _fcloseall     (CRTDLL.089)
- *
- * Close all open files except stdin/stdout/stderr.
- */
-INT CDECL CRTDLL__fcloseall(VOID)
-{
-  // return (_fcloseall());
-  
-  int num_closed = 0, i = 3;
-
-  while(i < __CRTDLL_fdend)
-    if (__CRTDLL_handles[i] != INVALID_HANDLE_VALUE)
-    {
-      CRTDLL__close(i);
-      num_closed++;
-    }
-
-  TRACE(":closed (%d) handles\n",num_closed);
-  return num_closed;
-}
-
-
-/*********************************************************************
- *                  _fdopen     (CRTDLL.091)
- *
- * Get a FILE* from a low level file descriptor.
- */
-CRTDLL_FILE* CDECL CRTDLL__fdopen(INT fd, LPCSTR mode)
-{
-  // return (_fdopen(handle, mode));
-  
-  CRTDLL_FILE* file = __CRTDLL__alloc_fp(fd);
-
-  TRACE(":fd (%d) mode (%s) FILE* (%p)\n",fd,mode,file);
-  if (file)
-    CRTDLL_rewind(file);
-
-  return file;
-}
-
-
-/*********************************************************************
- *                  _fgetchar       (CRTDLL.092)
- */
-INT CDECL CRTDLL__fgetchar( VOID )
-{
-  // return (_fgetchar());
-  
-  return CRTDLL_fgetc(CRTDLL_stdin);
-}
-
-
-/*********************************************************************
- *                  _filbuf     (CRTDLL.094)
- *
- * NOTES
- * The macro version of getc calls this function whenever FILE->_cnt
- * becomes negative. We ensure that _cnt is always 0 after any read
- * so this function is always called. Our implementation simply calls
- * fgetc as all the underlying buffering is handled by Wines 
- * implementation of the Win32 file I/O calls.
- */
-INT CDECL CRTDLL__filbuf(CRTDLL_FILE* file)
-{
-  return CRTDLL_fgetc(file);
-}
-
-
-/*********************************************************************
- *                  _fileno     (CRTDLL.097)
- *
- * Get the file descriptor from a FILE*.
- *
- * NOTES
- * This returns the CRTDLL fd, _not_ the underlying *nix fd.
- */
-INT CDECL CRTDLL__fileno(CRTDLL_FILE* file)
-{
-  // return (_fileno(f));
-  
-  TRACE(":FILE* (%p) fd (%d)\n",file,file->_file);
-  return file->_file;
-}
-
-
-/*********************************************************************
- *                  _flsbuf     (CRTDLL.102)
- *
- * NOTES
- * The macro version of putc calls this function whenever FILE->_cnt
- * becomes negative. We ensure that _cnt is always 0 after any write
- * so this function is always called. Our implementation simply calls
- * fputc as all the underlying buffering is handled by Wines
- * implementation of the Win32 file I/O calls.
- */
-INT CDECL CRTDLL__flsbuf(INT c, CRTDLL_FILE* file)
-{
-  return CRTDLL_fputc(c,file);
-}
-
-
-/*********************************************************************
- *                  _flushall     (CRTDLL.103)
- *
- * Flush all open files.
- */
-INT CDECL CRTDLL__flushall(VOID)
-{
-  // return (_flushall());
-  
-  int num_flushed = 0, i = 3;
-
-  while(i < __CRTDLL_fdend)
-    if (__CRTDLL_handles[i] != INVALID_HANDLE_VALUE)
-    {
-      if (CRTDLL__commit(i) == -1)
-	if (__CRTDLL_files[i])
-	  __CRTDLL_files[i]->_flag |= _IOERR;
-      num_flushed++;
-    }
-
-  TRACE(":flushed (%d) handles\n",num_flushed);
-  return num_flushed;
-}
-
-
-/*********************************************************************
- *                  _fputchar     (CRTDLL.108)
- *
- * Put a character to a file.
- */
-INT CDECL CRTDLL__fputchar(INT c)
-{
-  // return(_fputchar(c));
-  
-  return CRTDLL_fputc(c, CRTDLL_stdout);
-}
-
-
-/*********************************************************************
- *                  _fsopen     (CRTDLL.110)
- *
- * Open a FILE* with sharing.
- */
-CRTDLL_FILE*  CDECL CRTDLL__fsopen(LPCSTR path, LPCSTR mode, INT share)
-{
-  FIXME(":(%s,%s,%d),ignoring share mode!\n",path,mode,share);
-  return CRTDLL_fopen(path,mode);
-}
-
-
-/*********************************************************************
- *                  _fstat        (CRTDLL.111)
- * 
- * Get information about an open file.
- */
-int CDECL CRTDLL__fstat(int fd, struct _stat* buf)
-{
-  // return (_fstat(file, buf));
-  
-  DWORD dw;
-  BY_HANDLE_FILE_INFORMATION hfi;
-  HANDLE hand = __CRTDLL__fdtoh(fd);
-
-  TRACE(":fd (%d) stat (%p)\n",fd,buf);
-  if (hand == INVALID_HANDLE_VALUE)
-    return -1;
-
-  if (!buf)
-  {
-    WARN(":failed-NULL buf\n");
-    __CRTDLL__set_errno(ERROR_INVALID_PARAMETER);
-    return -1;
-  }
-
-  memset(&hfi, 0, sizeof(hfi));
-  memset(buf, 0, sizeof(struct _stat));
-  if (!GetFileInformationByHandle(hand, &hfi))
-  {
-    WARN(":failed-last error (%ld)\n",GetLastError());
-    __CRTDLL__set_errno(ERROR_INVALID_PARAMETER);
-    return -1;
-  }
-  FIXME(":dwFileAttributes = %d, mode set to 0",hfi.dwFileAttributes);
-  buf->st_nlink = hfi.nNumberOfLinks;
-  buf->st_size  = hfi.nFileSizeLow;
-  RtlTimeToSecondsSince1970( &hfi.ftLastAccessTime, &dw );
-  buf->st_atime = dw;
-  RtlTimeToSecondsSince1970( &hfi.ftLastWriteTime, &dw );
-  buf->st_mtime = buf->st_ctime = dw;
-  return 0;
-}
-
-
-/*********************************************************************
- *                  _get_osfhandle     (CRTDLL.117)
- *
- * Return a Win32 HANDLE from a file descriptor.
- *
- * PARAMS
- * fd [in] A valid file descriptor
- *
- * RETURNS
- * Success: A Win32 HANDLE
- *
- * Failure: INVALID_HANDLE_VALUE.
- *
- */
-HANDLE CRTDLL__get_osfhandle(INT fd)
-{
-  HANDLE hand = __CRTDLL__fdtoh(fd);
-  HANDLE newhand = hand;
-  TRACE(":fd (%d) handle (%d)\n",fd,hand);
-
-  if (hand != INVALID_HANDLE_VALUE)
-  {
-    /* FIXME: I'm not convinced that I should be copying the
-     * handle here - it may be leaked if the app doesn't 
-     * close it (and the API docs dont say that it should)
-     * Not duplicating it means that it can't be inherited
-     * and so lcc's wedit doesn't cope when it passes it to
-     * child processes. I've an idea that it should either
-     * be copied by CreateProcess, or marked as inheritable
-     * when initialised, or maybe both? JG 21-9-00.
-     */
-    DuplicateHandle(GetCurrentProcess(),hand,GetCurrentProcess(),
-		    &newhand,0,TRUE,DUPLICATE_SAME_ACCESS );
-  }
-  return newhand;
-}
-
-
-/*********************************************************************
- *                  _isatty       (CRTDLL.137)
- *
- * Return non zero if fd is a character device (e.g console).
- */
-INT CDECL CRTDLL__isatty(INT fd)
-{
-  HANDLE hand = __CRTDLL__fdtoh(fd);
-
-  TRACE(":fd (%d) handle (%d)\n",fd,hand);
-  if (hand == INVALID_HANDLE_VALUE)
-    return 0;
-
-  return GetFileType(fd) == FILE_TYPE_CHAR? 1 : 0;
-}
-
-
-/*********************************************************************
- *                  _lseek     (CRTDLL.179)
- *
- * Move the file pointer within a file.
- */
-LONG CDECL CRTDLL__lseek( INT fd, LONG offset, INT whence)
-{
-  // return (_lseek(handle, offset, origin));
-  
-  LONG ret;
-  HANDLE hand = __CRTDLL__fdtoh(fd);
-
-  TRACE(":fd (%d) handle (%d)\n",fd,hand);
-  if (hand == INVALID_HANDLE_VALUE)
-    return -1;
-
-  if (whence < 0 || whence > 2)
-  {
-    CRTDLL_errno = EINVAL;
-    return -1;
-  }
-
-  TRACE(":fd (%d) to 0x%08lx pos %s\n",
-        fd,offset,(whence==SEEK_SET)?"SEEK_SET":
-        (whence==SEEK_CUR)?"SEEK_CUR":
-        (whence==SEEK_END)?"SEEK_END":"UNKNOWN");
-
-  if ((ret = SetFilePointer( hand, offset, NULL, whence )) != 0xffffffff)
-  {
-    if ( __CRTDLL_files[fd])
-      __CRTDLL_files[fd]->_flag &= ~_IOEOF;
-    /* FIXME: What if we seek _to_ EOF - is EOF set? */
-    return ret;
-  }
-  TRACE(":error-last error (%ld)\n",GetLastError());
-  if ( __CRTDLL_files[fd])
-    switch(GetLastError())
-    {
-    case ERROR_NEGATIVE_SEEK:
-    case ERROR_SEEK_ON_DEVICE:
-      __CRTDLL__set_errno(GetLastError());
-      __CRTDLL_files[fd]->_flag |= _IOERR;
-      break;
-    default:
-      break;
-    }
-  return -1;
-}
-
-
-/*********************************************************************
- *                  _open           (CRTDLL.239)
- * Open a file.
- */
-INT CDECL CRTDLL__open(LPCSTR path,INT flags)
-{
-  DWORD access = 0, creation = 0;
-  INT ioflag = 0, fd;
-  HANDLE hand;
-
-  TRACE(":file (%s) mode 0x%04x\n",path,flags);
-
-  switch(flags & (_O_RDONLY | _O_WRONLY | _O_RDWR))
-  {
-  case _O_RDONLY:
-    access |= GENERIC_READ;
-    ioflag |= _IOREAD;
-    break;
-  case _O_WRONLY:
-    access |= GENERIC_WRITE;
-    ioflag |= _IOWRT;
-    break;
-  case _O_RDWR:
-    access |= GENERIC_WRITE | GENERIC_READ;
-    ioflag |= _IORW;
-    break;
-  }
-
-  if (flags & _O_CREAT)
-  {
-    if (flags & _O_EXCL)
-      creation = CREATE_NEW;
-    else if (flags & _O_TRUNC)
-      creation = CREATE_ALWAYS;
-    else
-      creation = OPEN_ALWAYS;
-  }
-  else  /* no _O_CREAT */
-  {
-    if (flags & _O_TRUNC)
-      creation = TRUNCATE_EXISTING;
-    else
-      creation = OPEN_EXISTING;
-  }
-  if (flags & _O_APPEND)
-    ioflag |= _IOAPPEND;
-
-
-  flags |= _O_BINARY; /* FIXME: Default to text */
-
-  if (flags & _O_TEXT)
-  {
-    /* Dont warn when writing */
-    if (ioflag & GENERIC_READ)
-      FIXME(":TEXT node not implemented\n");
-    flags &= ~_O_TEXT;
-  }
-
-  if (flags & ~(_O_BINARY|_O_TEXT|_O_APPEND|_O_TRUNC|_O_EXCL|_O_CREAT|_O_RDWR))
-    TRACE(":unsupported flags 0x%04x\n",flags);
-
-  /* clear those pesky flags ;-) */
-  flags &= (_O_BINARY|_O_TEXT|_O_APPEND|_O_TRUNC|_O_EXCL|_O_CREAT|_O_RDWR);
-
-  hand = CreateFileA( path, access, FILE_SHARE_READ | FILE_SHARE_WRITE,
-                      NULL, creation, FILE_ATTRIBUTE_NORMAL, -1);
-
-  if (hand == INVALID_HANDLE_VALUE)
-  {
-    WARN(":failed-last error (%ld)\n",GetLastError());
-    __CRTDLL__set_errno(GetLastError());
-    return -1;
-  }
-
-  fd = __CRTDLL__alloc_fd(hand,ioflag);
-
-  TRACE(":fd (%d) handle (%d)\n",fd, hand);
-
-  if (flags & _IOAPPEND && fd > 0)
-    CRTDLL__lseek(fd, 0, FILE_END );
-
-  return fd;
-}
-
-
-/*********************************************************************
- *                  _open_osfhandle         (CRTDLL.240)
- *
- * Create a file descriptor for a file HANDLE.
- */
-INT CDECL CRTDLL__open_osfhandle(HANDLE hand, INT flags)
-{
-  INT fd = __CRTDLL__alloc_fd(hand,flags);
-  TRACE(":handle (%d) fd (%d)\n",hand,fd);
-  return fd;
-}
-
-
-/*********************************************************************
- *                  _read     (CRTDLL.256)
- *
- * Read data from a file.
- */
-INT CDECL CRTDLL__read(INT fd, LPVOID buf, UINT count)
-{
-  DWORD num_read;
-  HANDLE hand = __CRTDLL__fdtoh(fd);
-
-  /* Dont trace small reads, it gets *very* annoying */
-  if (count > 4)
-    TRACE(":fd (%d) handle (%d) buf (%p) len (%d)\n",fd,hand,buf,count);
-  if (hand == INVALID_HANDLE_VALUE)
-    return -1;
-
-  /* Set _cnt to 0 so optimised binaries will call our implementation
-   * of putc/getc. See _filbuf/_flsbuf comments.
-   */
-  if (__CRTDLL_files[fd])
-    __CRTDLL_files[fd]->_cnt = 0;
-
-  if (ReadFile(hand, buf, count, &num_read, NULL))
-  {
-    if (num_read != count && __CRTDLL_files[fd])
-    {
-      TRACE(":EOF\n");
-      __CRTDLL_files[fd]->_flag |= _IOEOF;
-    }
-    return num_read;
-  }
-  TRACE(":failed-last error (%ld)\n",GetLastError());
-  if ( __CRTDLL_files[fd])
-     __CRTDLL_files[fd]->_flag |= _IOERR;
-  return -1;
-}
-
-
-/*********************************************************************
- *                  _setmode           (CRTDLL.265)
- *
- * FIXME: At present we ignore the request to translate CR/LF to LF.
- *
- * We always translate when we read with fgets, we never do with fread
- *
- */
-INT CDECL CRTDLL__setmode(INT fd,INT mode)
-{
-  // return (_setmode(fh, mode));
-  
-  if (mode & _O_TEXT)
-    FIXME("fd (%d) mode (%d) TEXT not implemented\n",fd,mode);
-  return 0;
-}
-
-
-/*********************************************************************
- *                  _stat          (CRTDLL.280)
- */
-INT CDECL CRTDLL__stat(const char* path, struct _stat * buf)
-{
-  // return(_stat(s1, n));
-  
-  DWORD dw;
-  WIN32_FILE_ATTRIBUTE_DATA hfi;
-  unsigned short mode = CRTDLL_S_IREAD;
-  int plen;
-
-  TRACE(":file (%s) buf(%p)\n",path,buf);
-
-  if (!GetFileAttributesExA( path, GetFileExInfoStandard, &hfi ))
-  {
-      TRACE("failed-last error (%ld)\n",GetLastError());
-      __CRTDLL__set_errno(ERROR_FILE_NOT_FOUND);
-      return -1;
-  }
-
-  memset(buf,0,sizeof(struct _stat));
-
-  /* FIXME: rdev isnt drive num,despite what the docs say-what is it? */
-  if (isalpha(*path))
-    buf->st_dev = buf->st_rdev = toupper(*path - 'A'); /* drive num */
-  else
-    buf->st_dev = buf->st_rdev = CRTDLL__getdrive() - 1;
-
-  plen = strlen(path);
-
-  /* Dir, or regular file? */
-  if ((hfi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ||
-      (path[plen-1] == '\\'))
-    mode |= (_S_IFDIR | CRTDLL_S_IEXEC);
-  else
-  {
-    mode |= _S_IFREG;
-    /* executable? */
-    if (plen > 6 && path[plen-4] == '.')  /* shortest exe: "\x.exe" */
-    {
-      unsigned int ext = tolower(path[plen-1]) | (tolower(path[plen-2]) << 8)
-	| (tolower(path[plen-3]) << 16);
-      if (ext == EXE || ext == BAT || ext == CMD || ext == COM)
-	mode |= CRTDLL_S_IEXEC;
-    }
-  }
-
-  if (!(hfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY))
-    mode |= CRTDLL_S_IWRITE;
-
-  buf->st_mode  = mode;
-  buf->st_nlink = 1;
-  buf->st_size  = hfi.nFileSizeLow;
-  RtlTimeToSecondsSince1970( &hfi.ftLastAccessTime, &dw );
-  buf->st_atime = dw;
-  RtlTimeToSecondsSince1970( &hfi.ftLastWriteTime, &dw );
-  buf->st_mtime = buf->st_ctime = dw;
-  TRACE("\n%d %d %d %d %d %d\n", buf->st_mode,buf->st_nlink,buf->st_size,
-	buf->st_atime,buf->st_mtime, buf->st_ctime);
-  return 0;
-}
-
-
-/*********************************************************************
- *                  _tell           (CRTDLL.302)
- *
- * Get current file position.
- */
-LONG CDECL CRTDLL__tell(INT fd)
-{
-  // return (_tell(i));
-  
-  return CRTDLL__lseek(fd, 0, SEEK_CUR);
-}
-
-
-/*********************************************************************
- *                  _tempnam           (CRTDLL.305)
- * 
- */
-LPSTR CDECL CRTDLL__tempnam(LPCSTR dir, LPCSTR prefix)
-{
-  // return (_tempnam(dir, prefix));
-  
-  char tmpbuf[MAX_PATH];
-
-  TRACE("dir (%s) prefix (%s)\n",dir,prefix);
-  if (GetTempFileNameA(dir,prefix,0,tmpbuf))
-  {
-    TRACE("got name (%s)\n",tmpbuf);
-    return CRTDLL__strdup(tmpbuf);
-  }
-  TRACE("failed-last error (%ld)\n",GetLastError());
-  return NULL;
-}
-
-
-/*********************************************************************
- *                  _umask           (CRTDLL.310)
- *
- * Set the process-wide umask.
- */
-INT CDECL CRTDLL__umask(INT umask)
-{
-  // return (_umask(i));
-  
-  INT old_umask = __CRTDLL_umask;
-  TRACE("umask (%d)\n",umask);
-  __CRTDLL_umask = umask;
-  return old_umask;
-}
-
-
-/*********************************************************************
- *                  _unlink           (CRTDLL.315)
- *
- * Delete a file.
- */
-INT CDECL CRTDLL__unlink(LPCSTR path)
-{
-  TRACE("path (%s)\n",path);
-  if(DeleteFileA( path ))
-    return 0;
-
-  TRACE("failed-last error (%ld)\n",GetLastError());
-  __CRTDLL__set_errno(GetLastError());
-  return -1;
-}
-
-
-/*********************************************************************
- *                  _write        (CRTDLL.332)
- *
- * Write data to a file.
- */
-UINT CDECL CRTDLL__write(INT fd, LPCVOID buf, UINT count)
-{
-  DWORD num_written;
-  HANDLE hand = __CRTDLL__fdtoh(fd);
-
-  /* Dont trace small writes, it gets *very* annoying */
-  if (count > 4)
-    TRACE(":fd (%d) handle (%d) buf (%p) len (%d)\n",fd,hand,buf,count);
-  if (hand == INVALID_HANDLE_VALUE)
-    return -1;
-
-  /* If appending, go to EOF */
-  /** @@@PH this seems to be slow and wrong. Only seek at opening the file? */
-  if (__CRTDLL_flags[fd] & _IOAPPEND)
-    CRTDLL__lseek(fd, 0, FILE_END );
-
-  /* Set _cnt to 0 so optimised binaries will call our implementation
-   * of putc/getc. See _filbuf/_flsbuf comments.
-   */
-  if (__CRTDLL_files[fd])
-    __CRTDLL_files[fd]->_cnt = 0;
-
-  if (WriteFile(hand, buf, count, &num_written, NULL)
-      &&  (num_written == count))
-    return num_written;
-
-  TRACE(":failed-last error (%ld)\n",GetLastError());
-  if ( __CRTDLL_files[fd])
-     __CRTDLL_files[fd]->_flag |= _IOERR;
-
-  return -1;
-}
-
-
-/*********************************************************************
- *                  clearerr     (CRTDLL.349)
- *
- * Clear a FILE's error indicator.
- */
-VOID CDECL CRTDLL_clearerr(CRTDLL_FILE* file)
-{
-  // clearerr(fp);
-
-  TRACE(":file (%p) fd (%d)\n",file,file->_file);
-  file->_flag &= ~(_IOERR | _IOEOF);
-}
-
-
-/*********************************************************************
- *                  fclose           (CRTDLL.362)
- *
- * Close an open file.
- */
-INT CDECL CRTDLL_fclose( CRTDLL_FILE* file )
-{
-  // return (fclose(fp));
-  
-  return CRTDLL__close(file->_file);
-}
-
-
-/*********************************************************************
- *                  feof           (CRTDLL.363)
- *
- * Check the eof indicator on a file.
- */
-INT CDECL CRTDLL_feof( CRTDLL_FILE* file )
-{
-  // return (feof(fp));
-  
-  return file->_flag & _IOEOF;
-}
-
-
-/*********************************************************************
- *                  ferror         (CRTDLL.361)
- *
- * Check the error indicator on a file.
- */
-INT CDECL CRTDLL_ferror( CRTDLL_FILE* file )
-{
-  // return (ferror(fp));
-  
-  return file->_flag & _IOERR;
-}
-
-
-/*********************************************************************
- *                  fflush        (CRTDLL.362)
- */
-INT CDECL CRTDLL_fflush( CRTDLL_FILE* file )
-{
-  //  return (fflush(fp));
-
-  return CRTDLL__commit(file->_file);
-}
-
-
-/*********************************************************************
- *                  fgetc       (CRTDLL.363)
- */
-INT CDECL CRTDLL_fgetc( CRTDLL_FILE* file )
-{
-  // return (fgetc(fp));
-  
-  char c;
-  if (CRTDLL__read(file->_file,&c,1) != 1)
-    return EOF;
-  return c;
-}
-
-
-/*********************************************************************
- *                  fgetpos       (CRTDLL.364)
- */
-INT CDECL CRTDLL_fgetpos( CRTDLL_FILE* file, __CRTDLL_fpos_t *pos)
-{
-  // return (fgetpos(fp, pos));
-
-  *pos = CRTDLL__tell(file->_file);
-  return (*pos == -1? -1 : 0);
-}
-
-
-/*********************************************************************
- *                  fgets       (CRTDLL.365)
- */
-CHAR* CDECL CRTDLL_fgets(LPSTR s, INT size, CRTDLL_FILE* file)
-{
-  // return (fgets(s, n, fp));
-  
-  int    cc;
-  LPSTR  buf_start = s;
-
-  TRACE(":file(%p) fd (%d) str (%p) len (%d)\n",
-	file,file->_file,s,size);
-
-  /* BAD, for the whole WINE process blocks... just done this way to test
-   * windows95's ftp.exe.
-   * JG - Is this true now we use ReadFile() on stdin too?
-   */
-  for(cc = CRTDLL_fgetc(file); cc != EOF && cc != '\n';
-      cc = CRTDLL_fgetc(file))
-    if (cc != '\r')
-    {
-      if (--size <= 0) break;
-      *s++ = (char)cc;
-    }
-  if ((cc == EOF) && (s == buf_start)) /* If nothing read, return 0*/
-  {
-    TRACE(":nothing read\n");
-    return 0;
-  }
-  if (cc == '\n')
-    if (--size > 0)
-      *s++ = '\n';
-  *s = '\0';
-  TRACE(":got '%s'\n", buf_start);
-  return buf_start;
-}
-
-
-/*********************************************************************
- *                  fputs       (CRTDLL.375)
- */
-INT CDECL CRTDLL_fputs( LPCSTR s, CRTDLL_FILE* file )
-{
-  // return (fputs(s, fp));
-  
-  return CRTDLL_fwrite(s,strlen(s),1,file);
-}
-
-
-/*********************************************************************
- *                  fprintf       (CRTDLL.370)
- */
-INT CDECL CRTDLL_fprintf( CRTDLL_FILE* file, LPCSTR format, ... )
-{
-    // return (fprintf(file, format, arg));
-  
-    va_list valist;
-    INT res;
-
-    va_start( valist, format );
-    res = CRTDLL_vfprintf( file, format, valist );
-    va_end( valist );
-    return res;
-}
-
-
-/*********************************************************************
- *                  fopen     (CRTDLL.372)
- *
- * Open a file.
- */
-CRTDLL_FILE* CDECL CRTDLL_fopen(LPCSTR path, LPCSTR mode)
-{
-  // return (fopen( filename, mode));
-  
-  CRTDLL_FILE* file;
-  INT flags = 0, plus = 0, fd;
-  const char* search = mode;
-
-  TRACE(":path (%s) mode (%s)\n",path,mode);
-
-  while (*search)
-    if (*search++ == '+')
-      plus = 1;
-
-  /* map mode string to open() flags. "man fopen" for possibilities. */
-  switch(*mode++)
-  {
-  case 'R': case 'r':
-    flags = (plus ? _O_RDWR : _O_RDONLY);
-    break;
-  case 'W': case 'w':
-    flags = _O_CREAT | _O_TRUNC | (plus  ? _O_RDWR : _O_WRONLY);
-    break;
-  case 'A': case 'a':
-    flags = _O_CREAT | _O_APPEND | (plus  ? _O_RDWR : _O_WRONLY);
-    break;
-  default:
-    return NULL;
-  }
-
-  while (*mode)
-    switch (*mode++)
-    {
-    case 'B': case 'b':
-      flags |=  _O_BINARY;
-      flags &= ~_O_TEXT;
-      break;
-    case 'T': case 't':
-      flags |=  _O_TEXT;
-      flags &= ~_O_BINARY;
-      break;
-    case '+':
-      break;
-    default:
-      FIXME(":unknown flag %c not supported\n",mode[-1]);
-    }
-
-  fd = CRTDLL__open(path, flags);
-
-  if (fd < 0)
-    return NULL;
-
-  file = __CRTDLL__alloc_fp(fd);
-  TRACE(":get file (%p)\n",file);
-  if (!file)
-    CRTDLL__close(fd);
-
-  return file;
-}
-
-
-/*********************************************************************
- *                  fputc       (CRTDLL.374)
- */
-INT CDECL CRTDLL_fputc( INT c, CRTDLL_FILE* file )
-{
-  // return (fputc(c, fp));
-  
-  return CRTDLL__write(file->_file, &c, 1) == 1? c : EOF;
-}
-
-
-/*********************************************************************
- *                  fread     (CRTDLL.377)
- */
-DWORD CDECL CRTDLL_fread(LPVOID ptr, INT size, INT nmemb, CRTDLL_FILE* file)
-{
-  // return (fread(ptr, size, n, fp));
-  
-  DWORD read = CRTDLL__read(file->_file,ptr, size * nmemb);
-  if (read <= 0)
-    return 0;
-  return read / size;
-}
-
-
-/*********************************************************************
- *                  freopen    (CRTDLL.379)
- * 
- */
-CRTDLL_FILE* CDECL CRTDLL_freopen(LPCSTR path, LPCSTR mode,CRTDLL_FILE* file)
-{
-  // return (freopen(filename, mode, fp));
-  
-  CRTDLL_FILE* newfile;
-  INT fd;
-
-  TRACE(":path (%p) mode (%s) file (%p) fd (%d)\n",path,mode,file,file->_file);
-  if (!file || ((fd = file->_file) < 0) || fd > __CRTDLL_fdend)
-    return NULL;
-
-  if (fd > 2)
-  {
-    FIXME(":reopen on user file not implemented!\n");
-    __CRTDLL__set_errno(ERROR_CALL_NOT_IMPLEMENTED);
-    return NULL;
-  }
-
-  /* first, create the new file */
-  if ((newfile = CRTDLL_fopen(path,mode)) == NULL)
-    return NULL;
-
-  if (fd < 3 && SetStdHandle(fd == 0 ? STD_INPUT_HANDLE :
-     (fd == 1? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE),
-      __CRTDLL_handles[newfile->_file]))
-  {
-    /* Redirecting std handle to file , copy over.. */
-    __CRTDLL_handles[fd] = __CRTDLL_handles[newfile->_file];
-    __CRTDLL_flags[fd] = __CRTDLL_flags[newfile->_file];
-    memcpy(&__CRTDLL_iob[fd], newfile, sizeof (CRTDLL_FILE));
-    __CRTDLL_iob[fd]._file = fd;
-    /* And free up the resources allocated by fopen, but
-     * not the HANDLE we copied. */
-    CRTDLL_free(__CRTDLL_files[fd]);
-    __CRTDLL__free_fd(newfile->_file);
-    return &__CRTDLL_iob[fd];
-  }
-
-  WARN(":failed-last error (%ld)\n",GetLastError());
-  CRTDLL_fclose(newfile);
-  __CRTDLL__set_errno(GetLastError());
-  return NULL;
-}
-
-
-/*********************************************************************
- *                  fsetpos       (CRTDLL.380)
- */
-INT CDECL CRTDLL_fsetpos( CRTDLL_FILE* file, __CRTDLL_fpos_t *pos)
-{
-  // return (fsetpos(fp, pos));
-  
-  return CRTDLL__lseek(file->_file,*pos,SEEK_SET);
-}
-
-
-/*********************************************************************
- *                  fscanf     (CRTDLL.381)
- */
-INT CDECL CRTDLL_fscanf( CRTDLL_FILE* file, LPSTR format, ... )
-{
-  //  return (fscanf(fp, format, arg));
-
-    INT rd = 0;
-    int nch;
-    va_list ap;
-    if (!*format) return 0;
-    WARN("%p (\"%s\"): semi-stub\n", file, format);
-    nch = CRTDLL_fgetc(file);
-    va_start(ap, format);
-    while (*format) {
-        if (*format == ' ') {
-            /* skip whitespace */
-            while ((nch!=EOF) && isspace(nch))
-                nch = CRTDLL_fgetc(file);
-        }
-        else if (*format == '%') {
-            int st = 0;
-            format++;
-            switch(*format) {
-            case 'd': { /* read an integer */
-                    int*val = va_arg(ap, int*);
-                    int cur = 0;
-                    /* skip initial whitespace */
-                    while ((nch!=EOF) && isspace(nch))
-                        nch = CRTDLL_fgetc(file);
-                    /* get sign and first digit */
-                    if (nch == '-') {
-                        nch = CRTDLL_fgetc(file);
-                        if (isdigit(nch))
-                            cur = -(nch - '0');
-                        else break;
-                    } else {
-                        if (isdigit(nch))
-                            cur = nch - '0';
-                        else break;
-                    }
-                    nch = CRTDLL_fgetc(file);
-                    /* read until no more digits */
-                    while ((nch!=EOF) && isdigit(nch)) {
-                        cur = cur*10 + (nch - '0');
-                        nch = CRTDLL_fgetc(file);
-                    }
-                    st = 1;
-                    *val = cur;
-                }
-                break;
-            case 'f': { /* read a float */
-                    float*val = va_arg(ap, float*);
-                    float cur = 0;
-                    /* skip initial whitespace */
-                    while ((nch!=EOF) && isspace(nch))
-                        nch = CRTDLL_fgetc(file);
-                    /* get sign and first digit */
-                    if (nch == '-') {
-                        nch = CRTDLL_fgetc(file);
-                        if (isdigit(nch))
-                            cur = -(nch - '0');
-                        else break;
-                    } else {
-                        if (isdigit(nch))
-                            cur = nch - '0';
-                        else break;
-                    }
-                    /* read until no more digits */
-                    while ((nch!=EOF) && isdigit(nch)) {
-                        cur = cur*10 + (nch - '0');
-                        nch = CRTDLL_fgetc(file);
-                    }
-                    if (nch == '.') {
-                        /* handle decimals */
-                        float dec = 1;
-                        nch = CRTDLL_fgetc(file);
-                        while ((nch!=EOF) && isdigit(nch)) {
-                            dec /= 10;
-                            cur += dec * (nch - '0');
-                            nch = CRTDLL_fgetc(file);
-                        }
-                    }
-                    st = 1;
-                    *val = cur;
-                }
-                break;
-            case 's': { /* read a word */
-                    char*str = va_arg(ap, char*);
-                    char*sptr = str;
-                    /* skip initial whitespace */
-                    while ((nch!=EOF) && isspace(nch))
-                        nch = CRTDLL_fgetc(file);
-                    /* read until whitespace */
-                    while ((nch!=EOF) && !isspace(nch)) {
-                        *sptr++ = nch; st++;
-                        nch = CRTDLL_fgetc(file);
-                    }
-                    /* terminate */
-                    *sptr = 0;
-                    TRACE("read word: %s\n", str);
-                }
-                break;
-            default: FIXME("unhandled: %%%c\n", *format);
-            }
-            if (st) rd++;
-            else break;
-        }
-        else {
-            /* check for character match */
-            if (nch == *format)
-               nch = CRTDLL_fgetc(file);
-            else break;
-        }
-        format++;
-    }
-    va_end(ap);
-    if (nch!=EOF) {
-        WARN("need ungetch\n");
-    }
-    TRACE("returning %d\n", rd);
-    return rd;
-}
-
-
-/*********************************************************************
- *                  fseek     (CRTDLL.382)
- */
-LONG CDECL CRTDLL_fseek( CRTDLL_FILE* file, LONG offset, INT whence)
-{
-  // return (fseek(file, offset, whence));
-  
-  return CRTDLL__lseek(file->_file,offset,whence);
-}
-
-
-/*********************************************************************
- *                  ftell     (CRTDLL.381)
- */
-LONG CDECL CRTDLL_ftell( CRTDLL_FILE* file )
-{
-  // return (ftell(fp));
-  
-  return CRTDLL__tell(file->_file);
-}
-
-
-/*********************************************************************
- *                  fwrite     (CRTDLL.383)
- */
-UINT CDECL CRTDLL_fwrite( LPCVOID ptr, INT size, INT nmemb, CRTDLL_FILE* file )
-{
-  // return (fwrite( ptr, size, nmemb, file));
-
-  UINT written = CRTDLL__write(file->_file, ptr, size * nmemb);
-  if (written <= 0)
-    return 0;
-  return written / size;
-}
-
-
-/*********************************************************************
- *                  getchar       (CRTDLL.386)
- */
-INT CDECL CRTDLL_getchar( VOID )
-{
-  // return (getchar());
-  
-  return CRTDLL_fgetc(CRTDLL_stdin);
-}
-
-
-/*********************************************************************
- *                  getc       (CRTDLL.388)
- */
-INT CDECL CRTDLL_getc( CRTDLL_FILE* file )
-{
-  //  return (getc(fp));
-
-    return CRTDLL_fgetc( file );
-}
-
-
-/*********************************************************************
- *                  gets          (CRTDLL.391)
- */
-LPSTR CDECL CRTDLL_gets(LPSTR buf)
-{
-  //  return (gets(s));
-
-    int    cc;
-    LPSTR  buf_start = buf;
-
-    /* BAD, for the whole WINE process blocks... just done this way to test
-     * windows95's ftp.exe.
-     * JG 19/9/00: Is this still true, now we are using ReadFile?
-     */
-    for(cc = CRTDLL_fgetc(CRTDLL_stdin); cc != EOF && cc != '\n';
-	cc = CRTDLL_fgetc(CRTDLL_stdin))
-	if(cc != '\r') *buf++ = (char)cc;
-
-    *buf = '\0';
-
-    TRACE("got '%s'\n", buf_start);
-    return buf_start;
-}
-
-
-/*********************************************************************
- *                  putc       (CRTDLL.441)
- */
-INT CDECL CRTDLL_putc( INT c, CRTDLL_FILE* file )
-{
-  // return putc( c, fp );
-
-  return CRTDLL_fputc( c, file );
-}
-
-
-/*********************************************************************
- *                  putchar       (CRTDLL.442)
- */
-void CDECL CRTDLL_putchar( INT c )
-{
-  // return putchar( c );
-
-  CRTDLL_fputc(c, CRTDLL_stdout);
-}
-
-
-/*********************************************************************
- *                  puts       (CRTDLL.443)
- */
-INT CDECL CRTDLL_puts(LPCSTR s)
-{
-  // return puts( s );
-  
-  return CRTDLL_fputs(s, CRTDLL_stdout);
-}
-
-
-/*********************************************************************
- *                  rewind     (CRTDLL.447)
- *
- * Set the file pointer to the start of a file and clear any error
- * indicators.
- */
-VOID CDECL CRTDLL_rewind(CRTDLL_FILE* file)
-{
-  // rewind(fp);
-  
-  TRACE(":file (%p) fd (%d)\n",file,file->_file);
-  CRTDLL__lseek(file->_file,0,SEEK_SET);
-  file->_flag &= ~(_IOEOF | _IOERR);
-}
-
-
-/*********************************************************************
- *                  remove           (CRTDLL.448)
- */
-INT CDECL CRTDLL_remove(LPCSTR path)
-{
-  // return (remove(file));
-  
-  TRACE(":path (%s)\n",path);
-  if (DeleteFileA(path))
-    return 0;
-  TRACE(":failed-last error (%ld)\n",GetLastError());
-  __CRTDLL__set_errno(GetLastError());
-  return -1;
-}
-
-
-/*********************************************************************
- *                  rename           (CRTDLL.449)
- */
-INT CDECL CRTDLL_rename(LPCSTR oldpath,LPCSTR newpath)
-{
-  // return (rename(old, new2));
-  
-  TRACE(":from %s to %s\n",oldpath,newpath);
-  if (MoveFileExA( oldpath, newpath, MOVEFILE_REPLACE_EXISTING))
-    return 0;
-  TRACE(":failed-last error (%ld)\n",GetLastError());
-  __CRTDLL__set_errno(GetLastError());
-  return -1;
-}
-
-
-/*********************************************************************
- *                  setbuf     (CRTDLL.452)
- */
-INT CDECL CRTDLL_setbuf(CRTDLL_FILE* file, LPSTR buf)
-{
-  // setbuf(fp, buf);
-  
-  TRACE(":file (%p) fd (%d) buf (%p)\n", file, file->_file,buf);
-  if (buf)
-    WARN(":user buffer will not be used!\n");
-  /* FIXME: no buffering for now */
-  return 0;
-}
-
-
-/*********************************************************************
- *                  tmpnam           (CRTDLL.490)
- *
- * lcclnk from lcc-win32 relies on a terminating dot in the name returned
- * 
- */
-LPSTR CDECL CRTDLL_tmpnam(LPSTR s)
-{
-  // return (tmpnam(s));
-  
-  char tmpbuf[MAX_PATH];
-  char* prefix = "TMP";
-  if (!GetTempPathA(MAX_PATH,tmpbuf) ||
-      !GetTempFileNameA(tmpbuf,prefix,0,CRTDLL_tmpname))
-  {
-    TRACE(":failed-last error (%ld)\n",GetLastError());
-    return NULL;
-  }
-  TRACE(":got tmpnam %s\n",CRTDLL_tmpname);
-  return CRTDLL_tmpname;
-}
-
-
-/*********************************************************************
- *                  vfprintf       (CRTDLL.494)
- *
- * Write formatted output to a file.
- */
-/* we have avoided libc stdio.h so far, lets not start now */
-/* @@@PH extern int vsprintf(void *, const void *, va_list); */
-
-INT CDECL CRTDLL_vfprintf( CRTDLL_FILE* file, LPCSTR format, va_list args )
-{
-  // return (vfprintf(file, format, args));
-  
-  /* FIXME: We should parse the format string, calculate the maximum,
-   * length of each arg, malloc a buffer, print to it, and fwrite that.
-   * Yes this sucks, but not as much as crashing 1/2 way through an
-   * app writing to a file :-(
-   */
-  char buffer[2048];
-  TRACE(":file (%p) fd (%d) fmt (%s)\n",file,file->_file,format);
-
-  vsprintf( buffer, format, args );
-  return CRTDLL_fwrite( buffer, 1, strlen(buffer), file );
-}
-
Index: trunk/src/crtdll/initterm.cpp
===================================================================
--- trunk/src/crtdll/initterm.cpp	(revision 9655)
+++ 	(revision )
@@ -1,113 +1,0 @@
-/*
- * DLL entry point
- *
- * Copyright 1998 Sander van Leeuwen
- * Copyright 1998 Peter Fitzsimmons
- *
- *
- * Project Odin Software License can be found in LICENSE.TXT
- *
- */
-
-/*-------------------------------------------------------------*/
-/* INITERM.C -- Source for a custom dynamic link library       */
-/*              initialization and termination (_DLL_InitTerm) */
-/*              function.                                      */
-/*                                                             */
-/* When called to perform initialization, this sample function */
-/* gets storage for an array of integers, and initializes its  */
-/* elements with random integers.  At termination time, it     */
-/* frees the array.  Substitute your own special processing.   */
-/*-------------------------------------------------------------*/
-
-
-/* Include files */
-#define  INCL_DOSMODULEMGR
-#define  INCL_DOSPROCESS
-#include <os2wrap.h>    //Odin32 OS/2 api wrappers
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <odin.h>
-#include <misc.h>       /*PLF Wed  98-03-18 23:18:15*/
-#include <win32type.h>
-#include <winconst.h>
-#include <odinlx.h>
-#include <initdll.h>
-
-extern "C" {
-
- //Win32 resource table (produced by wrc)
- extern DWORD _Resource_PEResTab;
-}
-
-BOOL WIN32API CRTDLL_Init(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
-
-static HMODULE dllHandle = 0;
-
-//******************************************************************************
-//******************************************************************************
-BOOL WINAPI LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
-{
-   switch (fdwReason)
-   {
-   case DLL_PROCESS_ATTACH:
-   case DLL_THREAD_ATTACH:
-   case DLL_THREAD_DETACH:
-	return CRTDLL_Init(hinstDLL, fdwReason, fImpLoad);
-
-   case DLL_PROCESS_DETACH:
-	CRTDLL_Init(hinstDLL, fdwReason, fImpLoad);
-	ctordtorTerm();
-	return TRUE;
-   }
-   return FALSE;
-}
-/****************************************************************************/
-/* _DLL_InitTerm is the function that gets called by the operating system   */
-/* loader when it loads and frees this DLL for each process that accesses   */
-/* this DLL.  However, it only gets called the first time the DLL is loaded */
-/* and the last time it is freed for a particular process.  The system      */
-/* linkage convention MUST be used because the operating system loader is   */
-/* calling this function.                                                   */
-/****************************************************************************/
-unsigned long SYSTEM _DLL_InitTerm(unsigned long hModule, unsigned long
-                                   ulFlag)
-{
-   size_t i;
-   APIRET rc;
-
-   /*-------------------------------------------------------------------------*/
-   /* If ulFlag is zero then the DLL is being loaded so initialization should */
-   /* be performed.  If ulFlag is 1 then the DLL is being freed so            */
-   /* termination should be performed.                                        */
-   /*-------------------------------------------------------------------------*/
-
-   switch (ulFlag) {
-      case 0 :
-         ctordtorInit();
-
-         CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
-
-	 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab);
-         if(dllHandle == 0)
-		return 0UL;
-
-         break;
-      case 1 :
-         if(dllHandle) {
-	 	UnregisterLxDll(dllHandle);
-         }
-         break;
-
-      default  :
-         return 0UL;
-   }
-
-   /***********************************************************/
-   /* A non-zero value must be returned to indicate success.  */
-   /***********************************************************/
-   return 1UL;
-}
-//******************************************************************************
-//******************************************************************************
Index: trunk/src/crtdll/internal.cpp
===================================================================
--- trunk/src/crtdll/internal.cpp	(revision 9655)
+++ 	(revision )
@@ -1,102 +1,0 @@
-/* $Id: internal.cpp,v 1.1 2000-02-03 21:37:49 sandervl Exp $ */
-
-/*
- * The C RunTime DLL
- * 
- * Implements C run-time functionality as known from UNIX.
- *
- * Partialy based on Wine
- *
- * Copyright 1996,1998 Marcus Meissner
- * Copyright 1996 Jukka Iivonen
- * Copyright 1997 Uwe Bonnes
- * Copyright 1999-2000 Jens Wiessner
- *
- * CRTDLL - internal functions
- *
- */
-
-#include <odin.h>
-#include <os2win.h>
-#include <ctype.h>
-#include <memory.h>
-#include <stdio.h>
-#include <wchar.h>
-
-
-/*********************************************************************
- *	_memswap				(INTERNAL-#1)
- */
-void _memswap (void *s1, void *s2, size_t n)
-{
-   char *c1, *c2, c;
-   int *i1, *i2, i;
- 
-   i1 = (int*)s1; i2 = (int*)s2;
-   while (n >= sizeof (int))
-     {
-       i = *i1; *i1++ = *i2; *i2++ = i;
-       n -= sizeof (int);
-       }
-   c1 = (char *)i1; c2 = (char *)i2;
-   while (n >= 1)
-     {
-       c = *c1; *c1++ = *c2; *c2++ = c;
-       --n;
-     }
- }
-
-
-/*********************************************************************
- *	qsort1 					(INTERNAL-#2)
- */
-void qsort1 (char *l, char *r, size_t width,
-                    int (* CDECL compare)(const void *x1, const void *x2))
-{
-  char *i, *j, *x;
-
-redo:
-  i = l; j = r;
-  x = l + width * (((r-l) / width) >> 1);
-  do
-    {
-      while (i != x && compare ((void *)i, (void *)x) < 0)
-        i += width;
-      while (j != x && compare ((void *)j, (void *)x) > 0)
-        j -= width;
-      if (i < j)
-        {
-          _memswap (i, j, width);
-          if (x == i)
-            x = j;
-          else if (x == j)
-            x = i;
-        }
-      if (i <= j)
-        {
-          i += width;           /* (almost) no danger */
-          if (j > l)
-            j -= width;         /* avoid wrap-around */
-        }
-    } while (i <= j);
-  if (j-l < r-i)
-    {
-      if (l < j)
-        qsort1 (l, j, width, compare);
-      if (i < r)
-        {
-          l = i;
-          goto redo;            /* qsort1 (i, r, width, compare) */
-        }
-    }
-  else
-    {
-      if (i < r)
-        qsort1 (i, r, width, compare);
-      if (l < j)
-        {
-          r = j;                /* qsort1 (l, j, width, compare) */
-          goto redo;
-        }
-    }
-}
Index: trunk/src/crtdll/makefile
===================================================================
--- trunk/src/crtdll/makefile	(revision 9655)
+++ 	(revision )
@@ -1,62 +1,0 @@
-# $Id: makefile,v 1.17 2001-07-09 08:08:00 bird Exp $
-
-#
-# Odin32 API
-#
-#       crtdll.dll makefile
-#
-
-
-#
-# Compiler, tools, and interference rules.
-#
-!include ../../makefile.inc
-
-
-#
-# Object files. Prefix with OBJDIR and one space before the '\'.
-#
-OBJS = \
-$(OBJDIR)\crtdll_main.obj \
-$(OBJDIR)\dir.obj \
-$(OBJDIR)\exit.obj \
-$(OBJDIR)\file.obj \
-$(OBJDIR)\mbstring.obj \
-$(OBJDIR)\memory.obj \
-$(OBJDIR)\spawn.obj \
-                     \
-$(OBJDIR)\crtdll.obj \
-$(OBJDIR)\asmhlp.obj \
-$(OBJDIR)\stubs.obj \
-$(OBJDIR)\internal.obj \
-$(OBJDIR)\string.obj \
-$(OBJDIR)\crt_memory.obj \
-$(OBJDIR)\crt_wc.obj \
-$(OBJDIR)\initterm.obj \
-$(OBJDIR)\crtdllrsrc.obj
-
-
-#
-# Libraries. One space before the '\'.
-#
-LIBS = \
-$(ODIN32_LIB)/kernel32.lib \
-$(ODIN32_LIB)/$(ODINCRT).lib \
-$(ODIN32_LIB)/user32.lib \
-$(ODIN32_LIB)/pmwinx.lib \
-os2386.lib \
-$(RTLLIB_O)
-
-
-#
-# Target name - name of the dll without extention and path.
-# Original target
-#
-TARGET      = crtdll32
-ORGTARGET   = crtdll
-
-
-#
-# Includes the common rules.
-#
-!include $(ODIN32_POST_INC)
Index: trunk/src/crtdll/memory.c
===================================================================
--- trunk/src/crtdll/memory.c	(revision 9655)
+++ 	(revision )
@@ -1,237 +1,0 @@
-/*
- * CRTDLL memory functions
- * 
- * Copyright 1996,1998 Marcus Meissner
- * Copyright 1996 Jukka Iivonen
- * Copyright 1997,2000 Uwe Bonnes
- * Copyright 2000 Jon Griffiths
- *
- * Implementation Notes:
- * MT Safe.
- * heapwalk from win does not work. This is most likely due to internal
- * differences between wine and win (see memory/heap.c comments). This
- * version works fine, however.
- */
-
-#include <string.h>
-#include "crtdll.h"
-
-
-DEFAULT_DEBUG_CHANNEL(crtdll);
-
-static new_handler_type new_handler;
-
-
-/*********************************************************************
- *                  new           (CRTDLL.001)
- *
- * Allocate memory.
- */
-LPVOID CDECL CRTDLL_new(DWORD size)
-{
-    VOID* result;
-    if(!(result = HeapAlloc(GetProcessHeap(),0,size)) && new_handler)
-	(*new_handler)();
-    return result;
-}
-
-
-/*********************************************************************
- *                  delete       (CRTDLL.002)
- *
- * Free memory created with new.
- */
-VOID CDECL CRTDLL_delete(LPVOID ptr)
-{
-    HeapFree(GetProcessHeap(),0,ptr);
-}
-
-
-/*********************************************************************
- *                  set_new_handler(CRTDLL.003)
- */
-new_handler_type CDECL CRTDLL_set_new_handler(new_handler_type func)
-{
-    new_handler_type old_handler = new_handler;
-    new_handler = func;
-    return old_handler;
-}
-
-
-/*********************************************************************
- *                  _expand        (CRTDLL.088)
- *
- * Increase the size of a block of memory allocated with malloc()
- * or realloc().
- */
-LPVOID CDECL CRTDLL__expand(LPVOID ptr, INT size)
-{
-    return HeapReAlloc( GetProcessHeap(), HEAP_REALLOC_IN_PLACE_ONLY, ptr, size );
-}
-
-
-/*********************************************************************
- *                  _heapchk        (CRTDLL.130)
- *
- * Check the consistency of the process heap.
- */
-INT CDECL CRTDLL__heapchk(VOID)
-{
-  // return (_heapchk());
-  
-  if (!HeapValidate( GetProcessHeap(), 0, NULL))
-  {
-    __CRTDLL__set_errno(GetLastError());
-    return _HEAPBADNODE;
-  }
-  return _HEAPOK;
-}
-
-
-/*********************************************************************
- *                  _heapmin        (CRTDLL.131)
- *
- * Minimise the size of the heap.
- */
-INT CDECL CRTDLL__heapmin(VOID)
-{
-  // return (_heapmin());
-  
-  if (!HeapCompact( GetProcessHeap(), 0 ))
-  {
-    if (GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
-      __CRTDLL__set_errno(GetLastError());
-    return -1;
-  }
-  return 0;
-}
-
-
-/*********************************************************************
- *                  _heapset        (CRTDLL.132)
- *
- * Fill free memory in the heap with a given value.
- */
-INT CDECL CRTDLL__heapset(UINT value)
-{
-  // return (_heapset(fill));
-  
-  INT retVal;
-  struct _heapinfo heap;
-
-  memset( &heap, 0, sizeof(heap) );
-
-  while ((retVal = CRTDLL__heapwalk(&heap)) == _HEAPOK)
-  {
-    if (heap._useflag == _FREEENTRY)
-      memset(heap._pentry, value, heap._size);
-  }
-  return retVal == _HEAPEND? _HEAPOK : retVal;
-}
-
-
-/*********************************************************************
- *                  _heapwalk        (CRTDLL.133)
- *
- * Walk the heap block by block.
- */
-INT CDECL CRTDLL__heapwalk(struct _heapinfo *next)
-{
-  PROCESS_HEAP_ENTRY phe;
-
-  phe.lpData = next->_pentry;
-  phe.cbData = next->_size;
-  phe.wFlags = next->_useflag == _USEDENTRY ? PROCESS_HEAP_ENTRY_BUSY : 0;
-
-  if (phe.lpData && phe.wFlags & PROCESS_HEAP_ENTRY_BUSY && 
-      !HeapValidate( GetProcessHeap(), 0, phe.lpData ))
-  {
-    __CRTDLL__set_errno(GetLastError());
-    return _HEAPBADNODE;
-  }
-
-  do
-  {
-    if (!HeapWalk( GetProcessHeap(), &phe ))
-    {
-      if (GetLastError() == ERROR_NO_MORE_ITEMS)
-        return _HEAPEND;
-      __CRTDLL__set_errno(GetLastError());
-      if (!phe.lpData)
-        return _HEAPBADBEGIN;
-      return _HEAPBADNODE;
-    }
-  } while (phe.wFlags & (PROCESS_HEAP_REGION|PROCESS_HEAP_UNCOMMITTED_RANGE));
-
-  next->_pentry = phe.lpData;
-  next->_size = phe.cbData;
-  next->_useflag = phe.wFlags & PROCESS_HEAP_ENTRY_BUSY ? _USEDENTRY : _FREEENTRY;
-  return _HEAPOK;
-}
-
-
-/*********************************************************************
- *                  _msize     (CRTDLL.234)
- *
- * Return the actual used size of an allocated block of memory.
- *
- */
-LONG CDECL CRTDLL__msize(LPVOID mem)
-{
-  // return (_msize(ptr));
-  
-  LONG size = HeapSize(GetProcessHeap(),0,mem);
-  if (size == -1)
-  {
-    WARN(":Probably called with non wine-allocated memory, ret = -1\n");
-    /* At least the win98/nt crtdlls also return -1 in this case */
-  }
-  return size;
-}
-
-
-/*********************************************************************
- *                  calloc        (CRTDLL.350)
- *
- * Allocate memory from the heap and initialise it to zero.
- */
-LPVOID CDECL CRTDLL_calloc(DWORD size, DWORD count)
-{
-    return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, size * count );
-}
-
-
-/*********************************************************************
- *                  free          (CRTDLL.375)
- *
- * Free a block of memory allocated with malloc()
- */
-VOID CDECL CRTDLL_free(LPVOID ptr)
-{
-    HeapFree(GetProcessHeap(),0,ptr);
-}
-
-
-/*********************************************************************
- *                  malloc        (CRTDLL.424)
- * 
- * Alocate memory from the heap.
- */
-LPVOID CDECL CRTDLL_malloc(DWORD size)
-{
-  LPVOID ret = HeapAlloc(GetProcessHeap(),0,size);
-  if (!ret)
-    __CRTDLL__set_errno(GetLastError());
-  return ret;
-}
-
-
-/*********************************************************************
- *                  realloc        (CRTDLL.444)
- *
- * Resize a block of memory allocated with malloc() or realloc().
- */
-LPVOID CDECL CRTDLL_realloc( VOID *ptr, DWORD size )
-{
-    return HeapReAlloc( GetProcessHeap(), 0, ptr, size );
-}
Index: trunk/src/crtdll/spawn.c
===================================================================
--- trunk/src/crtdll/spawn.c	(revision 9655)
+++ 	(revision )
@@ -1,191 +1,0 @@
-/*
- * CRTDLL spawn functions
- * 
- * Copyright 1996,1998 Marcus Meissner
- * Copyright 1996 Jukka Iivonen
- * Copyright 1997,2000 Uwe Bonnes
- * Copyright 2000 Jon Griffiths
- *
- * These functions differ in whether they pass arguments as an array
- * (v in the name) or as varags (l in the name), whether they
- * seach the path (p in the name) and/or whether they take an
- * environment (e in the name) or pass the parents environment.
- *                  Args as   Search   Take
- * Name             varargs?  path?    environment?
- * spawnl              N         N        N
- * spawnle             N         N        Y
- * spawnlp             N         Y        N
- * spawnlpe            N         Y        Y
- * spawnv              Y         N        N
- * spawnve             Y         N        Y
- * spawnvp             Y         Y        N
- * spawnvpe            Y         Y        Y
- *
- * Implementation Notes:
- * MT Safe - But only because of missing functionality.
- * 
- * After translating input arguments into the required format for
- * CreateProcess(), the internal function __CRTDLL__spawn() is
- * called to perform the actual spawning.
- *
- * FIXME:
- * -File handles need some special handling. Sometimes children get
- *  open file handles, sometimes not. The docs are confusing.
- * -No check for maximum path/argument/environment size is done.
- * -Wine has a "process.h" which is not the same as any crt version.
- * Unresolved issues Uwe Bonnes 970904:
- * -system-call calls another wine process, but without debugging arguments
- *  and uses the first wine executable in the path
- */
-
-#include "crtdll.h"
-#include <errno.h>
-#include "process.h"
-#include <stdlib.h>
-#include <string.h>
-
-
-DEFAULT_DEBUG_CHANNEL(crtdll);
-
-/* Process creation flags */
-#define _P_WAIT    0
-#define _P_NOWAIT  1
-#define _P_OVERLAY 2
-#define _P_NOWAITO 3
-#define _P_DETACH  4
-
-
-extern void __CRTDLL__set_errno(ULONG err);
-extern LPVOID CDECL CRTDLL_calloc(DWORD size, DWORD count);
-extern VOID CDECL CRTDLL_free(void *ptr);
-extern VOID CDECL CRTDLL__exit(LONG ret);
-extern INT CRTDLL_doserrno;
-
-
-/* INTERNAL: Spawn a child process */
-static int __CRTDLL__spawn(INT flags, LPSTR exe, LPSTR args, LPSTR env);
-static int __CRTDLL__spawn(INT flags, LPSTR exe, LPSTR args, LPSTR env)
-{
-  STARTUPINFOA si;
-  PROCESS_INFORMATION pi;
-
-  if ((unsigned)flags > _P_DETACH)
-  {
-    CRTDLL_errno = EINVAL;
-    return -1;
-  }
-
-  FIXME(":must dup/kill streams for child process\n");
-
-  memset(&si, 0, sizeof(si));
-  si.cb = sizeof(si);
-
-  if (!CreateProcessA(exe, args, NULL, NULL, TRUE,
-		      flags == _P_DETACH ? DETACHED_PROCESS : 0,
-		      env, NULL, &si, &pi))
-  {
-    __CRTDLL__set_errno(GetLastError());
-    return -1;
-  }
-
-  switch(flags)
-  {
-  case _P_WAIT:
-    WaitForSingleObject(pi.hProcess,-1); /* wait forvever */
-    GetExitCodeProcess(pi.hProcess,&pi.dwProcessId);
-    CloseHandle(pi.hProcess);
-    CloseHandle(pi.hThread);
-    return pi.dwProcessId;
-  case _P_DETACH:
-    CloseHandle(pi.hProcess);
-    pi.hProcess = 0;
-    /* fall through */
-  case _P_NOWAIT:
-  case _P_NOWAITO:
-    CloseHandle(pi.hThread);
-    return pi.hProcess;
-  case  _P_OVERLAY:
-    CRTDLL__exit(0);
-  }
-  return -1; /* cant reach here */
-}
-
-
-/* INTERNAL: Convert argv list to a single 'delim'-seperated string */
-static LPSTR __CRTDLL__argvtos(LPSTR *arg, CHAR delim);
-static LPSTR __CRTDLL__argvtos(LPSTR *arg, CHAR delim)
-{
-  LPSTR *search = arg;
-  LONG size = 0;
-  LPSTR ret;
-
-  if (!arg && !delim)
-    return NULL;
-
-  /* get length */
-  while(*search)
-  {
-    size += strlen(*search) + 1;
-    search++;
-  }
-
-  if (!(ret = (LPSTR)CRTDLL_calloc(size + 1, 1)))
-    return NULL;
-
-  /* fill string */
-  search = arg;
-  size = 0;
-  while(*search)
-  {
-    int strsize = strlen(*search);
-    memcpy(ret+size,*search,strsize);
-    ret[size+strsize] = delim;
-    size += strsize + 1;
-    search++;
-  }
-  return ret;
-}
-
-
-/*********************************************************************
- *                  _spawnve    (CRTDLL.274)
- *
- * Spawn a process.
- *
- */
-HANDLE CDECL CRTDLL__spawnve(INT flags, LPSTR name, LPSTR *argv, LPSTR *envv)
-{
-  // return (_spawnve(i, s1, s2, s3));
-  
-  LPSTR args = __CRTDLL__argvtos(argv,' ');
-  LPSTR envs = __CRTDLL__argvtos(envv,0);
-  LPSTR fullname = name;
-
-  FIXME(":not translating name %s to locate program\n",fullname);
-  TRACE(":call (%s), params (%s), env (%s)\n",name,args,envs?"Custom":"Null");
-
-  if (args)
-  {
-    HANDLE ret = __CRTDLL__spawn(flags, fullname, args, envs);
-    CRTDLL_free(args);
-    CRTDLL_free(envs);
-    return ret;
-  }
-  if (envs)
-    CRTDLL_free(envs);
-
-  WARN(":No argv[0] passed - process will not be executed");
-  return -1;
-}
-
-
-/*********************************************************************
- *                  system       (CRTDLL.485)
- */
-INT CDECL CRTDLL_system(LPSTR x)
-{
-  // return system(string);
-  
-    /* FIXME: should probably launch cmd interpreter in COMSPEC */
-    return __CRTDLL__spawn(_P_WAIT, NULL, x, NULL);
-}
Index: trunk/src/crtdll/string.c
===================================================================
--- trunk/src/crtdll/string.c	(revision 9655)
+++ 	(revision )
@@ -1,582 +1,0 @@
-/* $Id: string.c,v 1.2 2001-12-01 23:06:23 bird Exp $ */
-
-/*
- * The C RunTime DLL
- *
- * Implements C run-time functionality as known from UNIX.
- *
- * Partialy based on Wine
- *
- * Copyright 1996,1998 Marcus Meissner
- * Copyright 1996 Jukka Iivonen
- * Copyright 1997 Uwe Bonnes
- * Copyright 1999-2000 Jens Wiessner
- *
- * Implementation Notes:
- * MT Safe.
- */
-
-//#include <odin.h>
-//#include <os2win.h>
-#include <ctype.h>                      /* toupper proto */
-//#include <heapstring.h>
-#include <string.h>
-
-
-#include "crtdll.h"
-#include "winuser.h"
-
-
-DEFAULT_DEBUG_CHANNEL(crtdll);
-
-/*********************************************************************
- *           _strcmpi   	 (CRTDLL.280)
- */
-void CDECL CRTDLL__strcmpi( LPCSTR s1, LPCSTR s2 )
-{
-  dprintf2(("CRTDLL: _strcmpi(%08xh, %08xh)\n",
-           s1,
-           s2));
-
-  lstrcmpiA( s1, s2 );
-}
-
-
-/*********************************************************************
- *           CRTDLL__strdate   	 (CRTDLL.281)
- */
-char * CDECL CRTDLL__strdate( char *buf )
-{
-  dprintf2(("CRTDLL: _strdate\n"));
-  return(_strdate(buf));
-}
-
-
-/*********************************************************************
- *           _stricmp  	 (CRTDLL.285)
- */
-int CDECL CRTDLL__stricmp(const LPSTR str1,
-                      const LPSTR str2)
-{
-  dprintf2(("CRTDLL: _stricmp(%s,%s)\n",
-           str1,
-           str2));
-
-  return (stricmp(str1, str2));
-}
-
-
-
-/*********************************************************************
- *           CRTDLL__stricoll  	 (CRTDLL.286)
- */
-int CDECL CRTDLL__stricoll( const char *s1, const char *s2 )
-{
-  dprintf2(("CRTDLL: _stricoll\n"));
-  return stricmp(s1,s2);
-}
-
-
-/*********************************************************************
- *           _strlwr  	 (CRTDLL.288)
- */
-CHAR * CDECL CRTDLL__strlwr(char *x)
-{
-  char *y =x;
-
-  dprintf2(("CRTDLL: _strlwr got %s\n", x));
-  while (*y) {
-    if ((*y > 0x40) && (*y< 0x5b))
-      *y = *y + 0x20;
-    y++;
-  }
-  dprintf2(("   returned %s\n", x));
-		
-  return x;
-}
-
-
-/*********************************************************************
- *           CRTDLL__strnicmp	 (CRTDLL.291)
- */
-int  CDECL CRTDLL__strnicmp( LPCSTR s1, LPCSTR s2, INT n )
-{
-  dprintf2(("CRTDLL: _strnicmp (%s,%s,%d)\n",
-           s1,
-           s2,
-           n));
-
-  // @@@PH: sure it's not a UNICODE API?
-  return (lstrncmpiA(s1,s2,n));
-}
-
-
-
-/*********************************************************************
- *           CRTDLL__strtime	 (CRTDLL.297)
- */
-char * CDECL CRTDLL__strtime( char *buf )
-{
-  dprintf2(("CRTDLL: _strtime\n"));
-  return (_strtime(buf));
-}
-
-
-/*********************************************************************
- *           _strupr 	 (CRTDLL.298)
- */
-LPSTR CDECL CRTDLL__strupr(LPSTR x)
-{
-  LPSTR y=x;
-
-  dprintf2(("CRTDLL: _strupr(%s)\n",
-           x));
-
-  while (*y)
-  {
-    *y=toupper(*y);
-    y++;
-  }
-  return x;
-}
-
-
-/*********************************************************************
- *                  strcat         (CRTDLL.459)
- */
-LPSTR CDECL CRTDLL_strcat(      LPSTR str1,
-                      const LPSTR str2)
-{
-  dprintf2(("CRTDLL: strcat\n"));
-
-  return (strcat(str1, str2));
-}
-
-
-/*********************************************************************
- *                  strchr         (CRTDLL.460)
- */
-LPSTR CDECL CRTDLL_strchr(const LPSTR str,
-                       int         i)
-{
-  dprintf2(("CRTDLL: strchr(%s,%08xh)\n",
-           str,
-           i));
-
-  return (strchr(str, i));
-}
-
-
-/*********************************************************************
- *                  strcmp         (CRTDLL.461)
- */
-int CDECL CRTDLL_strcmp(const LPSTR str1,
-                      const LPSTR str2)
-{
-  dprintf2(("CRTDLL: strcmp(%s,%s)\n",
-           str1,
-           str2));
-
-  return (strcmp(str1, str2));
-}
-
-
-/*********************************************************************
- *                  strcoll        (CRTDLL.462)
- */
-int CDECL CRTDLL_strcoll( const char *s1, const char *s2 )
-{
-  dprintf2(("CRTDLL: strcoll\n"));
-  return strcoll(s1, s2);
-}
-
-
-/*********************************************************************
- *                  strcpy         (CRTDLL.463)
- */
-LPSTR CDECL CRTDLL_strcpy(      LPSTR str1,
-                       const LPSTR str2)
-{
-  dprintf2(("CRTDLL: strcpy\n"));
-
-  return (strcpy(str1, str2));
-}
-
-
-/*********************************************************************
- *                  strcspn         (CRTDLL.464)
- */
-size_t CDECL CRTDLL_strcspn(const LPSTR str1,
-                                LPSTR str2)
-{
-  dprintf2(("CRTDLL: strcspn(%s,%s)\n",
-           str1,
-           str2));
-
-  return (strcspn(str1, str2));
-}
-
-
-/*********************************************************************
- *                  strftime        (CRTDLL.466)
- */
-size_t CDECL CRTDLL_strftime( char *s, size_t maxsiz, const char *fmt, const struct tm *tp )
-{
-  dprintf2(("CRTDLL: strftime\n"));
-  return strftime(s, maxsiz, fmt, tp);
-}
-
-
-/*********************************************************************
- *                  strlen          (CRTDLL.467)
- */
-size_t CDECL CRTDLL_strlen(const LPSTR str)
-{
-  dprintf2(("CRTDLL: strlen(%s)\n",
-           str));
-
-  return (strlen(str));
-}
-
-
-/*********************************************************************
- *                  strncat        (CRTDLL.468)
- */
-LPSTR CDECL CRTDLL_strncat(      LPSTR str1,
-                        const LPSTR str2,
-                        size_t      i)
-{
-  dprintf2(("CRTDLL: strncat(%s,%s,%08xh)\n",
-           str1,
-           str2,
-           i));
-
-  return (strncat(str1, str2, i));
-}
-
-
-/*********************************************************************
- *                  strncmp        (CRTDLL.469)
- */
-int CDECL CRTDLL_strncmp(const LPSTR str1,
-                       const LPSTR str2,
-                       size_t      i)
-{
-  dprintf2(("CRTDLL: strncmp(%s,%s,%08xh)\n",
-           str1,
-           str2,
-           i));
-
-  return (strncmp(str1, str2, i));
-}
-
-
-/*********************************************************************
- *                  strncpy        (CRTDLL.470)
- */
-LPSTR CDECL CRTDLL_strncpy(const LPSTR str1,
-                        const LPSTR str2,
-                        size_t      i)
-{
-  dprintf2(("CRTDLL: strncpy(%s,%s,%08xh)\n",
-           str1,
-           str2,
-           i));
-
-  return (strncpy(str1, str2, i));
-}
-
-
-/*********************************************************************
- *                  strpbrk        (CRTDLL.471)
- */
-LPSTR CDECL CRTDLL_strpbrk(const LPSTR str1,
-                      const LPSTR str2)
-{
-  dprintf2(("CRTDLL: strpbrk(%s,%s)\n",
-           str1,
-           str2));
-
-  return (strpbrk(str1, str2));
-}
-
-
-/*********************************************************************
- *                  strrchr        (CRTDLL.472)
- */
-LPSTR CDECL CRTDLL_strrchr(const LPSTR str,
-                        size_t      i)
-{
-  dprintf2(("CRTDLL: strrchr(%s,%08xh)\n",
-           str,
-           i));
-
-  return (strrchr(str, i));
-}
-
-
-/*********************************************************************
- *                  strspn        (CRTDLL.473)
- */
-size_t CDECL CRTDLL_strspn(const LPSTR str1,
-                       const LPSTR str2)
-{
-  dprintf2(("CRTDLL: strspn(%s,%s)\n",
-           str1,
-           str2));
-
-  return (strspn(str1, str2));
-}
-
-
-/*********************************************************************
- *                  strstr        (CRTDLL.474)
- */
-LPSTR CDECL CRTDLL_strstr(const LPSTR str1,
-                       const LPSTR str2)
-{
-  dprintf2(("CRTDLL: strstr(%s,%s)\n",
-           str1,
-           str2));
-
-  return (strstr(str1, str2));
-}
-
-
-/*********************************************************************
- *                  strtod        (CRTDLL.475)
- */
-double CDECL CRTDLL_strtod( const char *nptr, char **endptr )
-{
-  dprintf2(("CRTDLL: strtod\n"));
-  return strtod(nptr, endptr);
-}
-
-
-/*********************************************************************
- *                  strtok        (CRTDLL.476)
- */
-char * CDECL CRTDLL_strtok( char *s1, const char *s2 )
-{
-  dprintf2(("CRTDLL: strtok\n"));
-  return strtok(s1, s2);
-}
-
-
-/*********************************************************************
- *                  strtol        (CRTDLL.477)
- */
-long int CDECL CRTDLL_strtol( const char *nptr, char **endptr, int base )
-{
-  dprintf2(("CRTDLL: strtol\n"));
-  return strtol(nptr, endptr, base);
-}
-
-
-/*********************************************************************
- *                  strtoul        (CRTDLL.478)
- */
-unsigned long CDECL CRTDLL_strtoul( const char *nptr, char **endptr, int base )
-{
-  dprintf2(("CRTDLL: strtoul\n"));
-  return strtoul(nptr, endptr, base);
-}
-
-
-/*********************************************************************
- *                  strxfrm        (CRTDLL.479)
- */
-size_t CDECL CRTDLL_strxfrm( char *s1, const char *s2, size_t n )
-{
-  dprintf2(("CRTDLL: strxfrm\n"));
-  return strxfrm(s1, s2, n);
-}
-
-
-/* INTERNAL: CRTDLL_malloc() based strndup */
-LPSTR __CRTDLL__strndup(LPSTR buf, INT size)
-{
-  char* ret;
-  int len = strlen(buf);
-  int max_len;
-
-  max_len = size <= len? size : len + 1;
-
-  ret = (char*)CRTDLL_malloc(max_len);
-  if (ret)
-  {
-    memcpy(ret,buf,max_len);
-    ret[max_len] = 0;
-  }
-  return ret;
-}
-
-
-/*********************************************************************
- *                  _strdec           (CRTDLL.282)
- *
- * Return the byte before str2 while it is >= to str1.
- *
- * PARAMS
- *   str1 [in]  Terminating string
- *
- *   sre2 [in]  string to start searching from
- *
- * RETURNS
- *   The byte before str2, or str1, whichever is greater
- *
- * NOTES
- * This function is implemented as tested with windows, which means
- * it does not have a terminating condition. It always returns
- * the byte before str2. Use with extreme caution!
- */
-LPSTR CDECL CRTDLL__strdec(LPSTR str1, LPSTR str2)
-{
-  /* Hmm. While the docs suggest that the following should work... */
-  /*  return (str2<=str1?0:str2-1); */
-  /* ...Version 2.50.4170 (NT) from win98 constantly decrements! */
-  return str2-1;
-}
-
-
-/*********************************************************************
- *                  _strdup          (CRTDLL.285)
- *
- * Duplicate a string.
- */
-LPSTR CDECL CRTDLL__strdup(LPCSTR ptr)
-{
-    LPSTR ret = (LPSTR)CRTDLL_malloc(strlen(ptr)+1);
-    if (ret) strcpy( ret, ptr );
-    return ret;
-}
-
-
-/*********************************************************************
- *                  _strinc           (CRTDLL.287)
- *
- * Return a pointer to the next character in a string
- */
-LPSTR CDECL CRTDLL__strinc(LPSTR str)
-{
-  return str+1;
-}
-
-
-/*********************************************************************
- *                   _strnextc         (CRTDLL.290)
- *
- * Return an unsigned int from a string.
- */
-UINT CDECL CRTDLL__strnextc(LPCSTR str)
-{
-  return (UINT)*str;
-}
-
-
-/*********************************************************************
- *                  _strninc           (CRTDLL.292)
- *
- * Return a pointer to the 'n'th character in a string
- */
-LPSTR CDECL CRTDLL__strninc(LPSTR str, INT n)
-{
-  return str+n;
-}
-
-
-/*********************************************************************
- *                  _strnset           (CRTDLL.293)
- *
- * Fill a string with a character up to a certain length
- */
-LPSTR CDECL CRTDLL__strnset(LPSTR str, INT c, INT len)
-{
-  if (len > 0 && str)
-    while (*str && len--)
-      *str++ = c;
-  return str;
-}
-
-
-/*********************************************************************
- *                  _strrev              (CRTDLL.294)
- *
- * Reverse a string in place
- */
-LPSTR CDECL CRTDLL__strrev (LPSTR str)
-{
-  LPSTR p1;
-  LPSTR p2;
-
-  if (str && *str)
-    for (p1 = str, p2 = str + strlen(str) - 1; p2 > p1; ++p1, --p2)
-    {
-      *p1 ^= *p2;
-      *p2 ^= *p1;
-      *p1 ^= *p2;
-    }
-
-  return str;
-}
-
-/*********************************************************************
- *                  _strset          (CRTDLL.295)
- *
- * Fill a string with a value.
- */
-LPSTR  CDECL CRTDLL__strset (LPSTR str, INT set)
-{
-  char *ptr = str;
-
-  while (*ptr)
-    *ptr++ = set;
-
-  return str;
-}
-
-
-/*********************************************************************
- *                  _strncnt           (CRTDLL.289)
- *
- * Return the length of a string or the maximum given length.
- */
-LONG CDECL CRTDLL__strncnt(LPSTR str, LONG max)
-{
-  LONG len = strlen(str);
-  return (len > max? max : len);
-}
-
-
-/*********************************************************************
- *                  _strspnp           (CRTDLL.296)
- *
- */
-LPSTR CDECL CRTDLL__strspnp(LPSTR str1, LPSTR str2)
-{
-  str1 += strspn(str1,str2);
-  return *str1? str1 : 0;
-}
-
-
-/*********************************************************************
- *                  _swab           (CRTDLL.299)
- *
- * Copy from source to dest alternating bytes (i.e 16 bit big-to-little
- * endian or vice versa).
- */
-void CDECL CRTDLL__swab(LPSTR src, LPSTR dst, INT len)
-{
-  //_swab(s1, s2, i);
-
-  if (len > 1)
-  {
-    len = (unsigned)len >> 1;
-
-    while (len--) {
-      *dst++ = src[1];
-      *dst++ = *src++;
-      src++;
-    }
-  }
-}
Index: trunk/src/crtdll/stubs.cpp
===================================================================
--- trunk/src/crtdll/stubs.cpp	(revision 9655)
+++ 	(revision )
@@ -1,999 +1,0 @@
-/* $Id: stubs.cpp,v 1.4 2000-11-21 23:48:53 phaller Exp $ */
-
-/*
- * The C RunTime DLL
- * 
- * Implements C run-time functionality as known from UNIX.
- *
- * Partialy based on Wine
- *
- * Copyright 1996,1998 Marcus Meissner
- * Copyright 1996 Jukka Iivonen
- * Copyright 1997 Uwe Bonnes
- * Copyright 1999-2000 Jens Wiessner
- *
- * CRTDLL - Stubs
- *
- */
-
-#include <odin.h>
-#include <os2win.h>
-#include <conio.h>
-#include <stdio.h>
-#include <wchar.h>
-#include <wctype.h>
-
-
-/*********************************************************************
- *                  __fpecode            (CRTDLL.27)
- */
-int * CDECL CRTDLL___fpecode ( void )
-{	
-  dprintf(("CRTDLL: __fpecode not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return 0;
-}
-
-
-/*********************************************************************
- *	__pxcptinfoptrs		   		(CRTDLL.32)
- */
-void ** CDECL CRTDLL___pxcptinfoptrs (void)
-{
-  dprintf(("CRTDLL: __pxcptinfoptrs not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return NULL;
-}
-
-
-/*********************************************************************
- *                  _fpclass     (CRTDLL.105)
- */
-INT CDECL CRTDLL__fpclass( double d )
-{
-  dprintf(("CRTDLL: _fpclass not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *	_fpieee_flt				(CRTDLL.106)
- */
-INT CDECL CRTDLL__fpieee_flt( unsigned long exc_code, struct _EXCEPTION_POINTERS *exc_info, int handler)
-{
-  dprintf(("CRTDLL: _fpieee_flt not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return 0;
-}
-
-
-/*********************************************************************
- *	_fputwchar				(CRTDLL.109)
- */
-wint_t CDECL CRTDLL__fputwchar( wint_t )
-{
-  dprintf(("CRTDLL: _fputwchar not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *	_futime					(CRTDLL.115)
- */
-int CDECL CRTDLL__futime( int handle, struct _utimbuf *filetime )
-{
-  dprintf(("CRTDLL: _futime not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *                  _getdllprocaddr     (CRTDLL.123)
- */
-FARPROC CDECL  CRTDLL__getdllprocaddr(HMODULE hModule,char * lpProcName, int iOrdinal)
-{
-  dprintf(("CRTDLL: _getdllprocaddr not implemented.\n"));   
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return 0;
-}
-
-
-/*********************************************************************
- *                  _ismbbalnum     (CRTDLL.139)
- */
-int CDECL CRTDLL__ismbbalnum( unsigned int c )
-{
-  dprintf(("CRTDLL: _ismbbalnum\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return 0;
-}
-
-
-/*********************************************************************
- *                  _ismbbalpha     (CRTDLL.140)
- */
-int CDECL CRTDLL__ismbbalpha( unsigned int c )
-{
-  dprintf(("CRTDLL: _ismbbalpha\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return 0;
-}
-
-
-/*********************************************************************
- *                  _ismbbgraph     (CRTDLL.141)
- */
-int CDECL CRTDLL__ismbbgraph( unsigned int c )
-{
-  dprintf(("CRTDLL: _ismbbgraph\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return 0;
-}
-
-
-/*********************************************************************
- *                  _ismbbkalnum     (CRTDLL.142)
- */
-int CDECL CRTDLL__ismbbkalnum( unsigned int c )
-{
-  dprintf(("CRTDLL: _ismbbkalnum\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return 0;
-}
-
-
-/*********************************************************************
- *                  _ismbbkana     (CRTDLL.143)
- */
-int CDECL CRTDLL__ismbbkana( unsigned int c )
-{
-  dprintf(("CRTDLL: _ismbbkana\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return 0;
-}
-
-
-/*********************************************************************
- *                  _ismbbkpunct     (CRTDLL.144)
- */
-int CDECL CRTDLL__ismbbkpunct( unsigned int c )
-{
-  dprintf(("CRTDLL: _ismbbkpunct\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return 0;
-}
-
-
-/*********************************************************************
- *                  _ismbblead     (CRTDLL.145)
- */
-int CDECL CRTDLL__ismbblead( unsigned int c )
-{
-  dprintf(("CRTDLL: _ismbblead\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return 0;
-}
-
-
-/*********************************************************************
- *                  _ismbbprint     (CRTDLL.146)
- */
-int CDECL CRTDLL__ismbbprint( unsigned int c )
-{
-  dprintf(("CRTDLL: _ismbbprint\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return 0;
-}
-
-
-/*********************************************************************
- *                  _ismbbpunct     (CRTDLL.147)
- */
-int CDECL CRTDLL__ismbbpunct( unsigned int c )
-{
-  dprintf(("CRTDLL: _ismbbpunct\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return 0;
-}
-
-
-/*********************************************************************
- *                  _ismbbtrail     (CRTDLL.148)
- */
-int CDECL CRTDLL__ismbbtrail( unsigned int c )
-{
-  dprintf(("CRTDLL: _ismbbtrail\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return 0;
-}
-
-
-/*********************************************************************
- *                  _ismbcalpha     (CRTDLL.149)
- */
-int CDECL CRTDLL__ismbcalpha( unsigned int c )
-{
-  dprintf(("CRTDLL: _ismbcalpha\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return 0;
-}
-
-
-/*********************************************************************
- *                  _ismbcdigit     (CRTDLL.150)
- */
-int CDECL CRTDLL__ismbcdigit( unsigned int c )
-{
-  dprintf(("CRTDLL: _ismbcdigit\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return 0;
-}
-
-
-/*********************************************************************
- *                  _ismbchira     (CRTDLL.151)
- */
-int CDECL CRTDLL__ismbchira( unsigned int c )
-{
-  dprintf(("CRTDLL: _ismbchira\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return 0;
-}
-
-
-/*********************************************************************
- *                  _ismbckata     (CRTDLL.152)
- */
-int CDECL CRTDLL__ismbckata( unsigned int c )
-{
-  dprintf(("CRTDLL: _ismbckata\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return 0;
-}
-
-
-/*********************************************************************
- *	_ismbcl0				(CRTDLL.153)
- */
-int CDECL CRTDLL__ismbcl0( unsigned int ch )
-{
-  dprintf(("CRTDLL: _ismbcl0 not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return 0;
-}
-
-
-/*********************************************************************
- *	_ismbcl1				(CRTDLL.154)
- */
-int CDECL CRTDLL__ismbcl1( unsigned int ch )
-{
-  dprintf(("CRTDLL: _ismbcl1 not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return 0;
-}
-
-
-/*********************************************************************
- *	_ismbcl2				(CRTDLL.155)
- */
-int CDECL CRTDLL__ismbcl2( unsigned int ch )
-{
-  dprintf(("CRTDLL: _ismbcl2 not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return 0;
-}
-
-
-/*********************************************************************
- *                  _ismbclegal     (CRTDLL.156)
- */
-int CDECL CRTDLL__ismbclegal( unsigned int c )
-{
-  dprintf(("CRTDLL: _ismbclegal\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return 0;
-}
-
-
-/*********************************************************************
- *                  _ismbclower     (CRTDLL.157)
- */
-int CDECL CRTDLL__ismbclower( unsigned int c )
-{
-  dprintf(("CRTDLL: _ismbclower\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return 0;
-}
-
-
-/*********************************************************************
- *                  _ismbcprint     (CRTDLL.158)
- */
-int CDECL CRTDLL__ismbcprint( unsigned int c )
-{
-  dprintf(("CRTDLL: _ismbcprint\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return 0;
-}
-
-
-/*********************************************************************
- *	_ismbcspace				(CRTDLL.159)
- */
-int CDECL CRTDLL__ismbcspace( unsigned int c )
-{
-  dprintf(("CRTDLL: _ismbcspace not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return 0;
-}
-
-
-/*********************************************************************
- *	_ismbcsymbol				(CRTDLL.160)
- */
-int CDECL CRTDLL__ismbcsymbol( unsigned int c )
-{
-  dprintf(("CRTDLL: _ismbcsymbol not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return 0;
-}
-
-
-/*********************************************************************
- *                  _ismbcupper     (CRTDLL.161)
- */
-int CDECL CRTDLL__ismbcupper( unsigned int c )
-{
-  dprintf(("CRTDLL: _ismbcupper\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return 0;
-}
-
-
-/*********************************************************************
- *                  _ismbslead     (CRTDLL.162)
- */
-int CDECL CRTDLL__ismbslead(const unsigned char *str, const unsigned char *t)
-{
-  dprintf(("CRTDLL: _ismbslead\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return 0;
-}
-
-
-/*********************************************************************
- *                  _ismbstrail     (CRTDLL.163)
- */
-int CDECL CRTDLL__ismbstrail(const unsigned char *str, const unsigned char *t)
-{
-  dprintf(("CRTDLL: _ismbstrail\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return 0;
-}
-
-
-/*********************************************************************
- *                  _lfind     (CRTDLL.170)
- */
-void * CDECL CRTDLL__lfind(const void *key, const void *base, size_t *nelp,
-         size_t width, int (*compar)(const void *, const void *))
-{
-  dprintf(("CRTDLL: _lfind not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *                  _locking        (CRTDLL.173)
- */
-int CDECL CRTDLL__locking( int fd, int mode, long nbytes )
-{
-  dprintf(("CRTDLL: _locking not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *	_logb					(CRTDLL.174)
- */
-double CDECL CRTDLL__logb( double x )
-{
-  dprintf(("CRTDLL: _logb not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *                  _mbbtombc        (CRTDLL.182)
- */
-unsigned int CDECL CRTDLL__mbbtombc( unsigned int c )
-{
-  dprintf(("CRTDLL: _mbbtombc not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *                  _mbbtype        (CRTDLL.183)
- */
-int CDECL CRTDLL__mbbtype( unsigned char c, int type )
-{
-  dprintf(("CRTDLL: _mbbtype not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *                  _mbcjistojms     (CRTDLL.185)
- */
-int CDECL CRTDLL__mbcjistojms( unsigned int c )
-{
-  dprintf(("CRTDLL: _mbcjistojms not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *                  _mbcjmstojis     (CRTDLL.186)
- */
-int CDECL CRTDLL__mbcjmstojis( unsigned int c )
-{
-  dprintf(("CRTDLL: _mbcjmstojis not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *                  _mbclen    (CRTDLL.187)
- */
-size_t CDECL CRTDLL__mbclen( const unsigned char *s )
-{
-  dprintf(("CRTDLL: _mbclen not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *                  _mbctohira     (CRTDLL.188)
- */
-int CDECL CRTDLL__mbctohira( unsigned int c )
-{
-  dprintf(("CRTDLL: _mbctohira not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *                  _mbctokata     (CRTDLL.189)
- */
-int CDECL CRTDLL__mbctokata( unsigned int c )
-{
-  dprintf(("CRTDLL: _mbctokata not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *                  _mbctolower     (CRTDLL.190)
- */
-unsigned int CDECL CRTDLL__mbctolower( unsigned int c )
-{
-  dprintf(("CRTDLL: _mbctolower not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *                  _mbctombb        (CRTDLL.191)
- */
-unsigned int CDECL CRTDLL__mbctombb( unsigned int c )
-{
-  dprintf(("CRTDLL: _mbctombb not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *                  _mbctoupper     (CRTDLL.192)
- */
-unsigned int CDECL CRTDLL__mbctoupper( unsigned int c )
-{
-  dprintf(("CRTDLL: _mbctoupper not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *                  _mbsbtype     (CRTDLL.194)
- */
-int CDECL CRTDLL__mbsbtype( const unsigned char *str, int n )
-{
-  dprintf(("CRTDLL: _mbsbtype not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *                  _mbscspn        (CRTDLL.199)
- */
-size_t CDECL CRTDLL__mbscspn( const unsigned char *s1, const unsigned char *s2 )
-{
-  dprintf(("CRTDLL: _mbscspn not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *           _mbsdec    (CRTDLL.200)
- */
-unsigned char * CDECL CRTDLL__mbsdec( const unsigned char *str, const unsigned char *cur )
-{
-  dprintf(("CRTDLL: _mbsdec not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *           _mbslwr    (CRTDLL.205)
- */
-unsigned char * CDECL CRTDLL__mbslwr( unsigned char *x )
-{
-  dprintf(("CRTDLL: _mbslwr not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *           _mbsnbcat  (CRTDLL.206)
- */
-unsigned char * CDECL CRTDLL__mbsnbcat( unsigned char *dst, const unsigned char *src, size_t n )
-{
-  dprintf(("CRTDLL: _mbsnbcat not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *           _mbsnbcmp  (CRTDLL.207)
- */
-int CDECL CRTDLL__mbsnbcmp( const unsigned char *str1, const unsigned char *str2, size_t n )
-{
-  dprintf(("CRTDLL: _mbsnbcmp not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *           _mbsnbcnt  (CRTDLL.208)
- */
-size_t CDECL CRTDLL__mbsnbcnt( const unsigned char *str, size_t n )
-{
-  dprintf(("CRTDLL: _mbsnbcnt not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *           _mbsnbcpy  (CRTDLL.209)
- */
-unsigned char * CDECL CRTDLL__mbsnbcpy( unsigned char *str1, const unsigned char *str2, size_t n )
-{
-  dprintf(("CRTDLL: _mbsnbcpy not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *           _mbsnbicmp (CRTDLL.210)
- */
-int CDECL CRTDLL__mbsnbicmp( const unsigned char *s1, const unsigned char *s2, size_t n )
-{
-  dprintf(("CRTDLL: _mbsnbicmp not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *           _mbsnbset (CRTDLL.211)
- */
-unsigned char * CDECL CRTDLL__mbsnbset( unsigned char *src, unsigned int val, size_t count )
-{
-  dprintf(("CRTDLL: _mbsnbset not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *           _mbsncat (CRTDLL.212)
- */
-unsigned char * CDECL CRTDLL__mbsncat( unsigned char *dst, const unsigned char *src, size_t n )
-{
-  dprintf(("CRTDLL: _mbsncat not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *           _mbsnccnt (CRTDLL.213)
- */
-size_t CDECL CRTDLL__mbsnccnt( const unsigned char *str, size_t n )
-{
-  dprintf(("CRTDLL: _mbsnccnt not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *           _mbsncmp (CRTDLL.214)
- */
-int CDECL CRTDLL__mbsncmp( const unsigned char *str1, const unsigned char *str2, size_t n )
-{
-  dprintf(("CRTDLL: _mbsncmp not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *           _mbsncpy (CRTDLL.215)
- */
-unsigned char * CDECL CRTDLL__mbsncpy( unsigned char *str1, const unsigned char *str2, size_t n )
-{
-  dprintf(("CRTDLL: _mbsncpy not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *           _mbsnextc (CRTDLL.216)
- */
-unsigned int CDECL CRTDLL__mbsnextc( const unsigned char *src )
-{
-  dprintf(("CRTDLL: _mbsnextc not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *           _mbsnicmp (CRTDLL.217)
- */
-int CDECL CRTDLL__mbsnicmp( const unsigned char *s1, const unsigned char *s2, size_t n )
-{
-  dprintf(("CRTDLL: _mbsnicmp not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *           _mbsninc (CRTDLL.218)
- */
-unsigned char * CDECL CRTDLL__mbsninc( const unsigned char *str, size_t n )
-{
-  dprintf(("CRTDLL: _mbsninc not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *           _mbsnset (CRTDLL.219)
- */
-unsigned char * CDECL CRTDLL__mbsnset( unsigned char *src, unsigned int val, size_t count )
-{
-  dprintf(("CRTDLL: _mbsnset not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *           _mbspbrk   (CRTDLL.220)
- */
-unsigned char * CDECL CRTDLL__mbspbrk( const unsigned char *s1, const unsigned char *s2 )
-{
-  dprintf(("CRTDLL: _mbspbrk not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *           _mbsrev    (CRTDLL.222)
- */
-unsigned char * CDECL CRTDLL__mbsrev( unsigned char *s )
-{
-  dprintf(("CRTDLL: _mbsrev not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *           _mbsset    (CRTDLL.223)
- */
-unsigned char * CDECL CRTDLL__mbsset( unsigned char *src, unsigned int c )
-{
-  dprintf(("CRTDLL: _mbsset not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *           _mbsspn   (CRTDLL.224)
- */
-size_t CDECL CRTDLL__mbsspn( const unsigned char *s1, const unsigned char *s2 )
-{
-  dprintf(("CRTDLL: _mbsspn not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *           _mbsspnp   (CRTDLL.225)
- */
-unsigned char * CDECL CRTDLL__mbsspnp( const unsigned char *s1, const unsigned char *s2 )
-{
-  dprintf(("CRTDLL: _mbsspnp not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *           _mbstok    (CRTDLL.227)
- */
-unsigned char * CDECL CRTDLL__mbstok( unsigned char *s, const unsigned char *delim )
-{
-  dprintf(("CRTDLL: _mbstok not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *           _mbstrlen   (CRTDLL.228)
- */
-size_t CDECL CRTDLL__mbstrlen(const char *string)
-{
-  dprintf(("CRTDLL: _mbstrlen not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *           _mbsupr    (CRTDLL.229)
- */
-unsigned char * CDECL CRTDLL__mbsupr( unsigned char *x )
-{
-  dprintf(("CRTDLL: _mbsupr not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *                  _nextafter        (CRTDLL.235)
- */
-double CDECL CRTDLL__nextafter( double x, double y )
-{
-  dprintf(("CRTDLL: _nextafter not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *	_pclose					(CRTDLL.244)
- */
-INT CDECL CRTDLL__pclose( FILE *fp )
-{
-  dprintf(("CRTDLL: _pclose not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *                  _pipe     (CRTDLL.247)
- */
-INT CDECL CRTDLL__pipe(int _fildes[2], unsigned int size, int mode )
-{
-  dprintf(("CRTDLL: _pipe not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *                  _popen    (CRTDLL.248)
- */
-FILE * CDECL CRTDLL__popen(const char *cm, const char *md)
-{
-  dprintf(("CRTDLL: _popen not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *           _scalb 	 (CRTDLL.259)
- */
-double CDECL CRTDLL__scalb( double x, long e )
-{
-  dprintf(("CRTDLL: _scalb not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *	_snprintf				(CRTDLL.266)
- */
-int  CDECL CRTDLL__snprintf( char *buf, size_t bufsize, const char *fmt, ... )
-{
-  dprintf(("CRTDLL: _snprintf(%08xh, %08xh, %08xh) not implemented\n",
-           buf,
-           bufsize,
-           fmt));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return 0;
-}
-
-
-/*********************************************************************
- *	_snwprintf				(CRTDLL.267)
- */
-int  CDECL CRTDLL__snwprintf( wchar_t *buf, size_t bufsize, const wchar_t *fmt, ... )
-{
-  dprintf(("CRTDLL: _snwprintf(%08xh, %08xh, %08xh) not implemented\n",
-           buf,
-           bufsize,
-           fmt));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return 0;
-}
-
-
-/*********************************************************************
- *	_tzset					(CRTDLL.308)
- */
-void CDECL CRTDLL__tzset( void )
-{
-  dprintf(("CRTDLL: _tzset not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-}
-
-
-/*********************************************************************
- *	_vsnwprintf				(CRTDLL.316)
- */
-int CDECL CRTDLL__vsnwprintf( wchar_t *s1, size_t n, const wchar_t *s2, va_list arg )
-{
-  dprintf(("CRTDLL: _vsnwprintf not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *	fwprintf				(CRTDLL.382)
- */
-int CDECL CRTDLL_fwprintf( FILE *iop, const wchar_t *fmt, ... )
-{
-  dprintf(("CRTDLL: fwprintf not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *	fwscanf					(CRTDLL.384)
- */
-int CDECL CRTDLL_fwscanf( FILE *strm, const wchar_t *format, ... )
-{
-  dprintf(("CRTDLL: fwscanf not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *                  is_wctype    (CRTDLL.390)
- */
-INT CDECL CRTDLL_is_wctype(wint_t wc, wctype_t wctype)
-{
-  dprintf(("CRTDLL: is_wctype not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *	isleadbyte				(CRTDLL.396)
- */
-int CDECL CRTDLL_isleadbyte(int i)
-{
-  dprintf(("CRTDLL: isleadbyte(%08xh) not implemented.\n", i));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *	vfwprintf				(CRTDLL.495)
- */
-int CDECL CRTDLL_vfwprintf( FILE *F, const wchar_t *s, va_list arg )
-{
-  dprintf(("CRTDLL: vfwprintf not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *	vwprintf				(CRTDLL.499)
- */
-int CDECL CRTDLL_vwprintf( const wchar_t *s, va_list arg)
-{
-  dprintf(("CRTDLL: vwprintf not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *	wprintf					(CRTDLL.522)
- */
-int CDECL CRTDLL_wprintf( const wchar_t *s, ... )
-{
-  dprintf(("CRTDLL: wprintf not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
-
-/*********************************************************************
- *	wscanf					(CRTDLL.523)
- */
-int CDECL CRTDLL_wscanf( const wchar_t *s, ... )
-{
-  dprintf(("CRTDLL: wscanf not implemented.\n"));
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
-}
-
