source: trunk/src/crtdll/crtdll.cpp@ 1207

Last change on this file since 1207 was 1207, checked in by sandervl, 26 years ago

Update by Jens Weissner

File size: 121.3 KB
Line 
1/* $Id: crtdll.cpp,v 1.9 1999-10-09 09:39:12 sandervl Exp $ */
2
3/*
4 * The C RunTime DLL
5 *
6 * Implements C run-time functionality as known from UNIX.
7 *
8 * Partialy based on Wine and ReactOS
9 *
10 * Copyright 1996,1998 Marcus Meissner
11 * Copyright 1996 Jukka Iivonen
12 * Copyright 1997 Uwe Bonnes
13 * Copyright 1999 Jens Wiessner
14 */
15
16#include <os2win.h>
17#include <stdio.h>
18#include <stdlib.h>
19#include <string.h>
20#include <odinwrap.h>
21#include <misc.h>
22#include <unicode.h>
23#include <heapstring.h>
24#include <ctype.h>
25#include <setjmp.h>
26#include <except.h>
27#include <debugtools.h>
28
29#include <wchar.h>
30#include <wctype.h>
31#include <math.h>
32#include <libc\locale.h>
33#include <signal.h>
34#include <io.h>
35#include <assert.h>
36#include <process.h>
37#include <float.h>
38#include <conio.h>
39#include <direct.h>
40#include <malloc.h>
41#include <drive.h>
42#include <fcntl.h>
43#include <search.h>
44#include <heap.h>
45#include <sys\utime.h>
46#include <sys\stat.h>
47
48#include <crtdll.h>
49#include "crtinc.h"
50
51DEFAULT_DEBUG_CHANNEL(crtdll)
52
53
54/*********************************************************************
55 * CRTDLL_MainInit (CRTDLL.init)
56 */
57BOOL WINAPI CRTDLL_Init(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
58{
59 if (fdwReason == DLL_PROCESS_ATTACH) {
60 CRTDLL__fdopen(0,"r");
61 CRTDLL__fdopen(1,"w");
62 CRTDLL__fdopen(2,"w");
63 }
64 return TRUE;
65}
66
67
68/*********************************************************************
69 * new (CRTDLL.001)
70 */
71VOID* CDECL CRTDLL_new(DWORD size)
72{
73 dprintf(("CRTDLL: ??2@YAPAXI@Z\n"));
74 VOID* result;
75 if(!(result = HeapAlloc(GetProcessHeap(),0,size)) && new_handler)
76 (*new_handler)();
77 return result;
78}
79
80
81/*********************************************************************
82 * delete (CRTDLL.002)
83 */
84VOID CDECL CRTDLL_delete(VOID* ptr)
85{
86 dprintf(("CRTDLL: ??3@YAXPAX@Z\n"));
87 HeapFree(GetProcessHeap(),0,ptr);
88}
89
90
91/*********************************************************************
92 * set_new_handler(CRTDLL.003)
93 */
94new_handler_type CDECL CRTDLL_set_new_handler(new_handler_type func)
95{
96 dprintf(("CRTDLL: ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z\n"));
97 new_handler_type old_handler = new_handler;
98 new_handler = func;
99 return old_handler;
100}
101
102
103/*********************************************************************
104 * _CIacos (CRTDLL.004)
105 */
106double CDECL CRTDLL__CIacos( double x )
107{
108 dprintf(("NTDLL: _CIacos\n"));
109 dprintf(("should be register function\n"));
110 return acos(x);
111}
112
113
114/*********************************************************************
115 * _CIasin (CRTDLL.005)
116 */
117double CDECL CRTDLL__CIasin( double x )
118{
119 dprintf(("NTDLL: _CIasin\n"));
120 dprintf(("should be register function\n"));
121 return asin(x);
122}
123
124
125/*********************************************************************
126 * _CIatan (CRTDLL.006)
127 */
128double CDECL CRTDLL__CIatan( double x )
129{
130 dprintf(("NTDLL: _CIatan\n"));
131 dprintf(("should be register function\n"));
132 return atan(x);
133}
134
135
136/*********************************************************************
137 * _CIatan2 (CRTDLL.007)
138 */
139double CDECL CRTDLL__CIatan2( double x, double y )
140{
141 dprintf(("NTDLL: _CIatan2\n"));
142 dprintf(("should be register function\n"));
143 return atan2(x,y);
144}
145
146
147/*********************************************************************
148 * _CIcos (CRTDLL.008)
149 */
150double CDECL CRTDLL__CIcos( double x )
151{
152 dprintf(("NTDLL: _CIcos\n"));
153 dprintf(("should be register function\n"));
154 return cos(x);
155}
156
157
158/*********************************************************************
159 * _CIcosh (CRTDLL.009)
160 */
161double CDECL CRTDLL__CIcosh( double x )
162{
163 dprintf(("NTDLL: _CIcosh\n"));
164 dprintf(("should be register function\n"));
165 return cosh(x);
166}
167
168
169/*********************************************************************
170 * _CIexp (CRTDLL.010)
171 */
172double CDECL CRTDLL__CIexp( double x )
173{
174 dprintf(("NTDLL: _CIexp\n"));
175 dprintf(("should be register function\n"));
176 return exp(x);
177}
178
179
180/*********************************************************************
181 * _CIfmod (CRTDLL.011)
182 */
183double CDECL CRTDLL__CIfmod( double x, double y )
184{
185 dprintf(("NTDLL: _CIfmod\n"));
186 dprintf(("should be register function\n"));
187 return fmod(x,y);
188}
189
190
191/*********************************************************************
192 * _CIlog (CRTDLL.012)
193 */
194double CDECL CRTDLL__CIlog( double x )
195{
196 dprintf(("NTDLL: _CIlog\n"));
197 dprintf(("should be register function\n"));
198 return log(x);
199}
200
201
202/*********************************************************************
203 * _CIlog10 (CRTDLL.013)
204 */
205double CDECL CRTDLL__CIlog10( double x )
206{
207 dprintf(("NTDLL: _CIlog10\n"));
208 dprintf(("should be register function\n"));
209 return log10(x);
210}
211
212
213/*********************************************************************
214 * _CIsin (CRTDLL.015)
215 */
216double CDECL CRTDLL__CIsin( double x )
217{
218 dprintf(("NTDLL: _CIsin\n"));
219 dprintf(("should be register function\n"));
220 return sin(x);
221}
222
223
224/*********************************************************************
225 * _CIsinh (CRTDLL.016)
226 */
227double CDECL CRTDLL__CIsinh( double x )
228{
229 dprintf(("NTDLL: _CIsinh\n"));
230 dprintf(("should be register function\n"));
231 return sinh(x);
232}
233
234
235/*********************************************************************
236 * _CIsqrt (CRTDLL.017)
237 */
238double CDECL CRTDLL__CIsqrt( double x )
239{
240 dprintf(("NTDLL: _CIsqrt\n"));
241 dprintf(("should be register function\n"));
242 return acos(x);
243}
244
245
246/*********************************************************************
247 * _CItan (CRTDLL.018)
248 */
249double CDECL CRTDLL__CItan( double x )
250{
251 dprintf(("NTDLL: _CItan\n"));
252 dprintf(("should be register function\n"));
253 return tan(x);
254}
255
256
257/*********************************************************************
258 * _CItanh (CRTDLL.019)
259 */
260double CDECL CRTDLL__CItanh( double x )
261{
262 dprintf(("NTDLL: _CItanh\n"));
263 dprintf(("should be register function\n"));
264 return tanh(x);
265}
266
267
268/*********************************************************************
269 * _XcptFilter (CRTDLL.21)
270 */
271INT CDECL CRTDLL__XcptFilter(DWORD ret, struct _EXCEPTION_POINTERS * ExceptionInfo )
272{
273 dprintf(("CRTDLL: XcptFilter not implemented.\n"));
274 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
275 return FALSE;
276}
277
278
279/*********************************************************************
280 * _GetMainArgs (CRTDLL.22)
281 */
282DWORD CDECL CRTDLL__GetMainArgs(LPDWORD argc,LPSTR **argv,
283 LPSTR *environ,DWORD flag)
284{
285 char *cmdline;
286 char **xargv;
287 int xargc,i,afterlastspace;
288 DWORD version;
289
290 dprintf(("CRTDLL: GetMainArgs\n"));
291
292 CRTDLL_acmdln_dll = cmdline = HEAP_strdupA( GetProcessHeap(), 0,
293 GetCommandLineA() );
294
295 version = GetVersion();
296 CRTDLL_osver_dll = version >> 16;
297 CRTDLL_winminor_dll = version & 0xFF;
298 CRTDLL_winmajor_dll = (version>>8) & 0xFF;
299 CRTDLL_baseversion_dll = version >> 16;
300 CRTDLL_winver_dll = ((version >> 8) & 0xFF) + ((version & 0xFF) << 8);
301 CRTDLL_baseminor_dll = (version >> 16) & 0xFF;
302 CRTDLL_basemajor_dll = (version >> 24) & 0xFF;
303 CRTDLL_osversion_dll = version & 0xFFFF;
304 CRTDLL_osminor_dll = version & 0xFF;
305 CRTDLL_osmajor_dll = (version>>8) & 0xFF;
306
307 /* missing threading init */
308
309 i=0;xargv=NULL;xargc=0;afterlastspace=0;
310/*
311 dprintf(("CRTDLL: GetMainArgs i loop\n"));
312 while (cmdline[i]) {
313 if (cmdline[i]==' ') {
314 dprintf(("CRTDLL: GetMainArgs *1\n"));
315 xargv=(char**)HeapReAlloc( GetProcessHeap(), 0, xargv,
316 sizeof(char*)*(++xargc));
317 cmdline[i]='\0';
318 xargv[xargc-1] = HEAP_strdupA( GetProcessHeap(), 0,
319 cmdline+afterlastspace);
320 i++;
321 dprintf(("CRTDLL: GetMainArgs *2\n"));
322 while (cmdline[i]==' ')
323 i++;
324 if (cmdline[i])
325 afterlastspace=i;
326 dprintf(("CRTDLL: GetMainArgs *3\n"));
327
328 } else
329 i++;
330
331 }
332
333 xargv=(char**)HeapReAlloc( GetProcessHeap(), 0, xargv,
334 sizeof(char*)*(++xargc));
335 dprintf(("CRTDLL: GetMainArgs *4\n"));
336 cmdline[i]='\0';
337 dprintf(("CRTDLL: GetMainArgs *5\n"));
338 xargv[xargc-1] = HEAP_strdupA( GetProcessHeap(), 0,
339 cmdline+afterlastspace);
340*/
341 CRTDLL_argc_dll = xargc;
342 *argc = xargc;
343 CRTDLL_argv_dll = xargv;
344 *argv = xargv;
345 dprintf(("CRTDLL: GetMainArgs end\n"));
346 CRTDLL_environ_dll = *environ = GetEnvironmentStringsA();
347 return 0;
348}
349
350
351/*********************************************************************
352 * __dllonexit (CRTDLL.25)
353 */
354VOID CDECL CRTDLL___dllonexit ()
355{
356 dprintf(("__dllonexit not implemented.\n"));
357}
358
359
360/*********************************************************************
361 * __doserrno (CRTDLL.26)
362 */
363int * CDECL CRTDLL___doserrno()
364{
365 dprintf(("__doserrno\n"));
366 _doserrno = GetLastError();
367 return &_doserrno;
368}
369
370
371/*********************************************************************
372 * __fpecode (CRTDLL.27)
373 */
374int * CDECL CRTDLL___fpecode ( void )
375{
376 dprintf(("__fpecode not implemented.\n"));
377 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
378 return FALSE;
379}
380
381
382/*********************************************************************
383 * CRTDLL___isascii (CRTDLL.28)
384 */
385int CDECL CRTDLL___isascii(int i)
386{
387 dprintf(("CRTDLL: __isascii\n"));
388 return (!((i)&(~0x7f)));
389}
390
391
392/*********************************************************************
393 * CRTDLL___iscsym (CRTDLL.29)
394 */
395int CDECL CRTDLL___iscsym(int c)
396{
397 dprintf(("CRTDLL: __iscsym\n"));
398 return (CRTDLL_isalnum(c) || ( c == '_' )) ;
399}
400
401
402/*********************************************************************
403 * CRTDLL___iscsymf (CRTDLL.30)
404 */
405int CDECL CRTDLL___iscsymf(int c)
406{
407 dprintf(("CRTDLL: __iscsymf\n"));
408 return (isalpha(c) || ( c == '_' )) ;
409}
410
411
412/*********************************************************************
413 * CRTDLL___pxcptinfoptrs (CRTDLL.32)
414 */
415void ** CDECL CRTDLL___pxcptinfoptrs (void)
416{
417 dprintf(("CRTDLL: __pxcptinfoptrs not implemented.\n"));
418 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
419 return NULL;
420}
421
422
423/*********************************************************************
424 * CRTDLL___threadhandle (CRTDLL.33)
425 */
426unsigned long CDECL CRTDLL___threadhandle( void )
427{
428 dprintf(("CRTDLL: __threadhandle\n"));
429 return GetCurrentThread();
430}
431
432
433/*********************************************************************
434 * CRTDLL___threadid (CRTDLL.34)
435 */
436unsigned long CDECL CRTDLL___threadid(void)
437{
438 dprintf(("CRTDLL: __threadid\n"));
439 return GetCurrentThreadId();
440}
441
442
443/*********************************************************************
444 * CRTDLL__abnormal_termination (CRTDLL.36)
445 */
446int CDECL CRTDLL__abnormal_termination(void)
447{
448 dprintf(("CRTDLL: _abnormal_termination not implemented.\n"));
449 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
450 return FALSE;
451}
452
453
454/*********************************************************************
455 * CRTDLL__access (CRTDLL.37)
456 */
457int CDECL CRTDLL__access(const char *path,int mode)
458{
459 dprintf(("CRTDLL: _access\n"));
460 return (_access(path, mode));
461}
462
463
464/*********************************************************************
465 * CRTDLL___toascii (CRTDLL.38)
466 */
467int CDECL CRTDLL___toascii(int c)
468{
469 dprintf(("CRTDLL: __toascii\n"));
470 return ((unsigned)(c) & 0x7F );
471}
472
473
474/*********************************************************************
475 * _aexit_rtn_dll (CRTDLL.39)
476 */
477VOID CDECL CRTDLL__aexit_rtn_dll(int exitcode)
478{
479 dprintf(("CRTDLL: _aexit_rtn_dll\n"));
480 ExitProcess(exitcode);
481}
482
483
484/*********************************************************************
485 * _amsg_exit (CRTDLL.40)
486 */
487VOID CDECL CRTDLL__amsg_exit(int errnum)
488{
489 dprintf(("CRTDLL: _amsg_exit\n"));
490 fprintf(stderr,strerror(errnum));
491 ExitProcess(-1);
492}
493
494
495/*********************************************************************
496 * CRTDLL__assert (CRTDLL.41)
497 */
498void CDECL CRTDLL__assert( char *s1, char *s2, int i)
499{
500 dprintf(("CRTDLL: _assert\n"));
501 _assert(s1, s2, i);
502}
503
504
505/*********************************************************************
506 * CRTDLL__beep (CRTDLL.45)
507 */
508void CDECL CRTDLL__beep(unsigned nFreq, unsigned nDur)
509{
510 dprintf(("_beep\n"));
511 Beep(nFreq,nDur);
512}
513
514
515/*********************************************************************
516 * CRTDLL__beginthread (CRTDLL.46)
517 */
518unsigned long CDECL CRTDLL__beginthread(void (*pfuncStart)(void *),
519 unsigned unStackSize, void* pArgList)
520{
521 DWORD ThreadId;
522 HANDLE hThread;
523 if ( pfuncStart == NULL )
524 __set_errno(EINVAL);
525
526 hThread = CreateThread( NULL,unStackSize,(LPTHREAD_START_ROUTINE)pfuncStart,pArgList,0, &ThreadId);
527 if (hThread == NULL ) {
528 __set_errno(EAGAIN);
529 return -1;
530 }
531 return (unsigned long)hThread;
532}
533
534
535/*********************************************************************
536 * _c_exit (CRTDLL.47)
537 *
538 */
539void CDECL CRTDLL__c_exit(INT ret)
540{
541 dprintf(("_c_exit(%d)\n",ret));
542 ExitProcess(ret);
543}
544
545
546/*********************************************************************
547 * CRTDLL__cabs (CRTDLL.48)
548 */
549double CDECL CRTDLL__cabs(struct complex * z)
550{
551 dprintf(("CRTDLL: _cabs not implemented\n"));
552 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
553 return FALSE;
554}
555
556
557/*********************************************************************
558 * _cexit (CRTDLL.49)
559 */
560void CDECL CRTDLL__cexit(INT ret)
561{
562 dprintf(("_cexit(%d)\n",ret));
563 ExitProcess(ret);
564}
565
566
567/*********************************************************************
568 * CRTDLL__cgets (CRTDLL.50)
569 */
570char * CDECL CRTDLL__cgets( char *s )
571{
572 dprintf(("CRTDLL: _cgets\n"));
573 return (_cgets(s));
574}
575
576
577/*********************************************************************
578 * _chdir (CRTDLL.51)
579 */
580INT CDECL CRTDLL__chdir(LPCSTR newdir)
581{
582 dprintf(("CRTDLL: chdir\n"));
583 if (!SetCurrentDirectoryA(newdir))
584 return 1;
585 return 0;
586}
587
588
589/*********************************************************************
590 * _chdrive (CRTDLL.52)
591 *
592 * newdir [I] drive to change to, A=1
593 *
594 */
595BOOL CDECL CRTDLL__chdrive(INT newdrive)
596{
597 /* FIXME: generates errnos */
598 dprintf(("CRTDLL: _chdrive\n"));
599 return DRIVE_SetCurrentDrive(newdrive-1);
600}
601
602
603/*********************************************************************
604 * CRTDLL__chgsign (CRTDLL.53)
605 */
606double CDECL CRTDLL__chgsign(double x)
607{
608 dprintf(("CRTDLL: _chgsign not implemented.\n"));
609 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
610 return FALSE;
611}
612
613
614/*********************************************************************
615 * CRTDLL__chmod (CRTDLL.54)
616 */
617int CDECL CRTDLL__chmod( const char *s, int i)
618{
619 dprintf(("CRTDLL: _chmod\n"));
620 return (_chmod(s, i));
621}
622
623
624/*********************************************************************
625 * CRTDLL__chsize (CRTDLL.55)
626 */
627int CDECL CRTDLL__chsize( int i, long l )
628{
629 dprintf(("CRTDLL: _chsize\n"));
630 return (_chsize(i, l));
631}
632
633
634/*********************************************************************
635 * CRTDLL__clearfp (CRTDLL.56)
636 */
637unsigned int CDECL CRTDLL__clearfp( void )
638{
639 dprintf(("CRTDLL: _clearfp\n"));
640 return (_clear87());
641}
642
643
644/*********************************************************************
645 * CRTDLL__close (CRTDLL.57)
646 */
647int CDECL CRTDLL__close(int handle)
648{
649 dprintf(("CRTDLL: _close\n"));
650 return (_close(handle));
651}
652
653
654/*********************************************************************
655 * CRTDLL__commit (CRTDLL.58)
656 */
657int CDECL CRTDLL__commit( int handle )
658{
659 dprintf(("CRTDLL: _commit not implemented.\n"));
660// if (! FlushFileBuffers(_get_osfhandle(_fd)) ) {
661// __set_errno(EBADF);
662// return -1;
663// }
664 return 0;
665}
666
667
668/*********************************************************************
669 * CRTDLL__control87 (CRTDLL.60)
670 */
671unsigned CDECL CRTDLL__control87(unsigned i1,unsigned i2)
672{
673 dprintf(("CRTDLL: _control87\n"));
674 return (_control87(i1, i2));
675}
676
677
678/*********************************************************************
679 * CRTDLL__controlfp (CRTDLL.61)
680 */
681unsigned CDECL CRTDLL__controlfp(unsigned i1,unsigned i2)
682{
683 dprintf(("CRTDLL: _controlfp\n"));
684 return (_control87(i1, i2));
685}
686
687
688/*********************************************************************
689 * CRTDLL__copysign (CRTDLL.62)
690 */
691double CDECL CRTDLL__copysign( double x, double y )
692{
693 dprintf(("CRTDLL: _copysign not implemented.\n"));
694 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
695 return FALSE;
696}
697
698
699/*********************************************************************
700 * CRTDLL__cprintf (CRTDLL.63)
701 */
702INT CDECL CRTDLL__cprintf( char *s, ... )
703{
704 dprintf(("CRTDLL: _cprintf not implemented.\n"));
705 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
706 return FALSE;
707}
708
709
710/*********************************************************************
711 * CRTDLL__cputs (CRTDLL.65)
712 */
713INT CDECL CRTDLL__cputs( char * s )
714{
715 dprintf(("CRTDLL: _cputs\n"));
716 return (_cputs(s));
717}
718
719
720/*********************************************************************
721 * CRTDLL__creat (CRTDLL.66)
722 */
723INT CDECL CRTDLL__creat( const char *s, int i )
724{
725 dprintf(("CRTDLL: _creat\n"));
726 return (_creat(s, i));
727}
728
729
730/*********************************************************************
731 * CRTDLL__cscanf (CRTDLL.67)
732 */
733INT CDECL CRTDLL__cscanf( char *s, ... )
734{
735 dprintf(("CRTDLL: _cscanf not implemented.\n"));
736 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
737 return FALSE;
738}
739
740
741/*********************************************************************
742 * CRTDLL__cwait (CRTDLL.69)
743 */
744int CDECL CRTDLL__cwait( int *status, int process_id, int action_code )
745{
746 dprintf(("CRTDLL: _cwait\n"));
747 return (_cwait(status, process_id, action_code));
748}
749
750
751/*********************************************************************
752 * CRTDLL__dup (CRTDLL.71)
753 */
754int CDECL CRTDLL__dup(int handle)
755{
756 dprintf(("CRTDLL: _dup\n"));
757 return (_dup(handle));
758}
759
760
761/*********************************************************************
762 * CRTDLL__dup2 (CRTDLL.72)
763 */
764int CDECL CRTDLL__dup2(int handle1,int handle2)
765{
766 dprintf(("CRTDLL: _dup2\n"));
767 return (_dup2(handle1, handle2));
768}
769
770
771/*********************************************************************
772 * CRTDLL__ecvt (CRTDLL.73)
773 */
774char * CDECL CRTDLL__ecvt( double val, int ndig, int *dec, int *sign )
775{
776 dprintf(("CRTDLL: _ecvt\n"));
777 return (_ecvt(val, ndig, dec, sign));
778}
779
780
781/*********************************************************************
782 * CRTDLL__endthread (CRTDLL.74)
783 */
784void CDECL CRTDLL__endthread(void)
785{
786 dprintf(("CRTDLL: _endthread\n"));
787 _endthread ();
788}
789
790
791/*********************************************************************
792 * CRTDLL___eof (CRTDLL.76)
793 */
794int CDECL CRTDLL__eof( int _fd )
795{
796 dprintf(("CRTDLL: _eof\n"));
797 int cur_pos = CRTDLL__lseek(_fd, 0, SEEK_CUR);
798 int end_pos = CRTDLL__filelength( _fd );
799 if ( cur_pos == -1 || end_pos == -1)
800 return -1;
801
802 if ( cur_pos == end_pos )
803 return 1;
804
805 return 0;
806}
807
808
809/*********************************************************************
810 * CRTDLL__errno (CRTDLL.77)
811 */
812int * CDECL CRTDLL__errno(void)
813{
814 dprintf(("CRTDLL: _errno\n"));
815 return (_errno());
816}
817
818
819/*********************************************************************
820 * _except_handler2 (CRTDLL.78)
821 */
822INT CDECL CRTDLL__except_handler2 ( PEXCEPTION_RECORD rec,
823 PEXCEPTION_FRAME frame, PCONTEXT context,
824 PEXCEPTION_FRAME *dispatcher)
825{
826 dprintf(("CRTDLL: _except_handler2\n"));
827 return 1;
828}
829
830
831/*********************************************************************
832 * CRTDLL__execl (CRTDLL.79)
833 */
834int CDECL CRTDLL__execl( char *s1, char *s2, ...)
835{
836 dprintf(("CRTDLL: _execl not implemented.\n"));
837 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
838 return FALSE;
839}
840
841
842/*********************************************************************
843 * CRTDLL__execle (CRTDLL.80)
844 */
845int CDECL CRTDLL__execle( char *s1, char *s2, ...)
846{
847 dprintf(("CRTDLL: _execle not implemented.\n"));
848 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
849 return FALSE;
850}
851
852
853/*********************************************************************
854 * CRTDLL__execlp (CRTDLL.81)
855 */
856int CDECL CRTDLL__execlp( char *s1, char *s2, ...)
857{
858 dprintf(("CRTDLL: _execlp not implemented.\n"));
859 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
860 return FALSE;
861}
862
863
864/*********************************************************************
865 * CRTDLL__execlpe (CRTDLL.82)
866 */
867int CDECL CRTDLL__execlpe( char *s1, char *s2, ...)
868{
869 dprintf(("CRTDLL: _execlpe not implemented.\n"));
870 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
871 return FALSE;
872}
873
874
875/*********************************************************************
876 * CRTDLL__execv (CRTDLL.83)
877 */
878int CDECL CRTDLL__execv( char *s1, char **s2)
879{
880 dprintf(("CRTDLL: _execv\n"));
881 return (_execv(s1, s2));
882}
883
884
885/*********************************************************************
886 * CRTDLL__execve (CRTDLL.84)
887 */
888int CDECL CRTDLL__execve( char *s1, char **s2, char **s3)
889{
890 dprintf(("CRTDLL: _execve\n"));
891 return (_execve(s1, s2, s3));
892}
893
894
895/*********************************************************************
896 * CRTDLL__execvp (CRTDLL.85)
897 */
898int CDECL CRTDLL__execvp( char *s1, char **s2)
899{
900 dprintf(("CRTDLL: _execvp\n"));
901 return (_execvp(s1, s2));
902}
903
904
905/*********************************************************************
906 * CRTDLL__execvpe (CRTDLL.86)
907 */
908int CDECL CRTDLL__execvpe( char *s1, char **s2, char **s3)
909{
910 dprintf(("CRTDLL: _execvpe\n"));
911 return (_execvpe(s1, s2, s3));
912}
913
914
915/*********************************************************************
916 * _exit (CRTDLL.87)
917 */
918VOID CDECL CRTDLL__exit(DWORD ret)
919{
920 dprintf(("CRTDLL: _exit\n"));
921 ExitProcess(ret);
922}
923
924
925/*********************************************************************
926 * CRTDLL__expand (CRTDLL.88)
927 */
928void * CDECL CRTDLL__expand( void *ptr, size_t size )
929{
930 dprintf(("CRTDLL: _expand not implemented.\n"));
931 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
932 return FALSE;
933}
934
935
936/*********************************************************************
937 * CRTDLL__fcloseall (CRTDLL.89)
938 */
939int CDECL CRTDLL__fcloseall( void )
940{
941 dprintf(("CRTDLL: _fcloseall\n"));
942 return (_fcloseall());
943}
944
945
946/*********************************************************************
947 * CRTDLL__fcvt (CRTDLL.90)
948 */
949char * CDECL CRTDLL__fcvt( double val, int ndig, int *dec, int *sign )
950{
951 dprintf(("CRTDLL: _fcvt\n"));
952 return (_fcvt(val, ndig, dec, sign));
953}
954
955
956/*********************************************************************
957 * _fdopen (CRTDLL.91)
958 */
959CRTDLL_FILE * CDECL CRTDLL__fdopen(INT handle, LPCSTR mode)
960{
961 dprintf(("CRTDLL: fdopen\n"));
962 CRTDLL_FILE *file;
963
964 switch (handle)
965 {
966 case 0:
967 file = CRTDLL_stdin;
968 if (!file->handle) file->handle = GetStdHandle( STD_INPUT_HANDLE );
969 break;
970 case 1:
971 file = CRTDLL_stdout;
972 if (!file->handle) file->handle = GetStdHandle( STD_OUTPUT_HANDLE );
973 break;
974 case 2:
975 file=CRTDLL_stderr;
976 if (!file->handle) file->handle = GetStdHandle( STD_ERROR_HANDLE );
977 break;
978 default:
979 file = (PCRTDLL_FILE)HeapAlloc( GetProcessHeap(), 0, sizeof(*file) );
980 file->handle = handle;
981 break;
982 }
983 return file;
984}
985
986
987/*********************************************************************
988 * CRTDLL__fgetchar (CRTDLL.92)
989 */
990int CDECL CRTDLL__fgetchar( void )
991{
992 dprintf(("CRTDLL: _fgetchar\n"));
993 return (_fgetchar());
994}
995
996
997/*********************************************************************
998 * CRTDLL__fgetwchar (CRTDLL.93)
999 */
1000wint_t CDECL CRTDLL__fgetwchar( void *i )
1001{
1002 dprintf(("CRTDLL: _fgetwchar\n"));
1003 return CRTDLL__getch();
1004}
1005
1006
1007/*********************************************************************
1008 * CRTDLL__filbuf (CRTDLL.94)
1009 */
1010int CDECL CRTDLL__filbuf(FILE * f)
1011{
1012 dprintf(("CRTDLL: _filbuf not implemented.\n"));
1013 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1014 return FALSE;
1015}
1016
1017
1018/*********************************************************************
1019 * CRTDLL__filelength (CRTDLL.96)
1020 */
1021long CDECL CRTDLL__filelength( int i )
1022{
1023 dprintf(("CRTDLL: _filelength\n"));
1024 return (_filelength(i));
1025}
1026
1027
1028/*********************************************************************
1029 * CRTDLL__fileno (CRTDLL.97)
1030 */
1031int CDECL CRTDLL__fileno(FILE * f)
1032{
1033 dprintf(("CRTDLL: _fileno\n"));
1034 return (_fileno(f));
1035}
1036
1037
1038/*********************************************************************
1039* _findclose (CRTDLL.098)
1040*/
1041int CDECL CRTDLL__findclose( long handle )
1042{
1043 dprintf(("CRTDLL: _findclose\n"));
1044 // check no wildcards or invalid handle
1045 if ( handle == 0 || handle == -1)
1046 return 0;
1047 return FindClose(handle);
1048}
1049
1050
1051 /*********************************************************************
1052 * _findfirst (CRTDLL.099)
1053 */
1054DWORD CDECL CRTDLL__findfirst(LPCSTR fname, struct find_t * x2)
1055{
1056 dprintf(("CRTDLL: _findfirst not implemented.\n"));
1057 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1058 return FALSE;
1059}
1060
1061
1062/*********************************************************************
1063 * _findnext (CRTDLL.100)
1064 */
1065INT CDECL CRTDLL__findnext(DWORD hand, struct find_t * x2)
1066{
1067 dprintf(("CRTDLL: _findnext not implemented.\n"));
1068 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1069 return FALSE;
1070}
1071
1072
1073/*********************************************************************
1074 * _finite (CRTDLL.101)
1075 */
1076INT CDECL CRTDLL__finite(double x)
1077{
1078 dprintf(("CRTDLL: _finite not implemented.\n"));
1079 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1080 return FALSE;
1081}
1082
1083
1084/*********************************************************************
1085 * _flsbuf (CRTDLL.102)
1086 */
1087INT CDECL CRTDLL__flsbuf(int i, FILE * f)
1088{
1089 dprintf(("CRTDLL: _flsbuf not implemented.\n"));
1090 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1091 return FALSE;
1092}
1093
1094
1095/*********************************************************************
1096 * _flushall (CRTDLL.103)
1097 */
1098INT CDECL CRTDLL__flushall(void)
1099{
1100 dprintf(("CRTDLL: _flushall\n"));
1101 return (_flushall());
1102}
1103
1104
1105/*********************************************************************
1106 * _fpclass (CRTDLL.105)
1107 */
1108INT CDECL CRTDLL__fpclass( double x )
1109{
1110 dprintf(("CRTDLL: _fpclass not implemented.\n"));
1111 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1112 return FALSE;
1113}
1114
1115
1116/*********************************************************************
1117 * _fpieee_flt (CRTDLL.106)
1118 */
1119INT CDECL CRTDLL__fpieee_flt( unsigned long exc_code, struct _EXCEPTION_POINTERS *exc_info, int handler)
1120{
1121 dprintf(("CRTDLL: _fpieee_flt not implemented.\n"));
1122 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1123 return 0;
1124}
1125
1126
1127
1128/*********************************************************************
1129 * _fpreset (CRTDLL.107)
1130 */
1131INT CDECL CRTDLL__fpreset(void)
1132{
1133 dprintf(("CRTDLL: _fpreset not implemented.\n"));
1134 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1135 return FALSE;
1136}
1137
1138
1139/*********************************************************************
1140 * _fputchar (CRTDLL.108)
1141 */
1142INT CDECL CRTDLL__fputchar( int c )
1143{
1144 dprintf(("CRTDLL: _fputchar\n"));
1145 return(_fputchar(c));
1146}
1147
1148
1149/*********************************************************************
1150 * _fputwchar (CRTDLL.109)
1151 */
1152wint_t CDECL CRTDLL__fputwchar( wint_t )
1153{
1154 dprintf(("CRTDLL: _fputwchar not implemented.\n"));
1155 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1156 return FALSE;
1157}
1158
1159
1160/*********************************************************************
1161 * _fsopen (CRTDLL.110)
1162 */
1163FILE * CDECL CRTDLL__fsopen( const char *file, const char *mode, int shflag )
1164{
1165 dprintf(("CRTDLL: _fsopen not implemented.\n"));
1166 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1167 return FALSE;
1168}
1169
1170
1171/*********************************************************************
1172 * _fstat (CRTDLL.111)
1173 */
1174int CDECL CRTDLL__fstat(int file, struct stat* buf)
1175{
1176 dprintf(("CRTDLL: _fstat not implemented.\n"));
1177 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1178 return FALSE;
1179}
1180
1181
1182/*********************************************************************
1183 * _ftime (CRTDLL.112)
1184 */
1185int CDECL CRTDLL__ftime( struct timeb *timeptr )
1186{
1187 dprintf(("CRTDLL: _ftime not implemented.\n"));
1188 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1189 return FALSE;
1190}
1191
1192
1193/*********************************************************************
1194 * _fullpath (CRTDLL.114)
1195 */
1196char * CDECL CRTDLL__fullpath( char *buf, char *path, size_t size )
1197{
1198 dprintf(("CRTDLL: _fullpath\n"));
1199 return (_fullpath(buf, path, size));
1200}
1201
1202
1203/*********************************************************************
1204 * _futime (CRTDLL.115)
1205 */
1206int CDECL CRTDLL__futime( int handle, struct _utimbuf *filetime )
1207{
1208 dprintf(("CRTDLL: _futime not implemented.\n"));
1209 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1210 return FALSE;
1211}
1212
1213
1214/*********************************************************************
1215 * _gcvt (CRTDLL.116)
1216 */
1217char * CDECL CRTDLL__gcvt( double val, int ndig, char *buf )
1218{
1219 dprintf(("CRTDLL: _gcvt\n"));
1220 return (_gcvt(val, ndig, buf));
1221}
1222
1223
1224/*********************************************************************
1225 * _get_osfhandle (CRTDLL.117)
1226 */
1227long CDECL CRTDLL__get_osfhandle( int posixhandle )
1228{
1229 dprintf(("CRTDLL: _get_osfhandle not implemented.\n"));
1230 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1231 return FALSE;
1232}
1233
1234
1235/*********************************************************************
1236 * _getch (CRTDLL.118)
1237 */
1238int CDECL CRTDLL__getch(void)
1239{
1240 dprintf(("CRTDLL: _getch\n"));
1241 return (_getch());
1242}
1243
1244
1245/*********************************************************************
1246 * _getche (CRTDLL.119)
1247 */
1248int CDECL CRTDLL__getche(void)
1249{
1250 dprintf(("CRTDLL: _getche\n"));
1251 return (_getche());
1252}
1253
1254
1255/*********************************************************************
1256 * _getcwd (CRTDLL.120)
1257 */
1258char * CDECL CRTDLL__getcwd( char *buf, size_t size )
1259{
1260 dprintf(("CRTDLL: _getcwd\n"));
1261 return (_getcwd(buf, size));
1262}
1263
1264
1265/*********************************************************************
1266 * _getdcwd (CRTDLL.121)
1267 */
1268char * CDECL CRTDLL__getdcwd( int drive, char *buffer, size_t maxlen )
1269{
1270 dprintf(("CRTDLL: _getdcwd\n"));
1271 return (_getdcwd(drive, buffer, maxlen));
1272}
1273
1274
1275/*********************************************************************
1276 * _getdiskfree (CRTDLL.122)
1277 */
1278unsigned int CDECL CRTDLL__getdiskfree( unsigned int drive, struct _diskfree_t *diskspace)
1279{
1280 dprintf(("CRTDLL: _getdiskfree\n"));
1281 char RootPathName[10];
1282 RootPathName[0] = toupper(drive +'@');
1283 RootPathName[1] = ':';
1284 RootPathName[2] = '\\';
1285 RootPathName[3] = 0;
1286 if ( diskspace == NULL )
1287 return 0;
1288
1289 if ( !GetDiskFreeSpaceA(RootPathName,(LPDWORD)&diskspace->sectors_per_cluster,(LPDWORD)&diskspace->bytes_per_sector,
1290 (LPDWORD )&diskspace->avail_clusters,(LPDWORD )&diskspace->total_clusters ) )
1291 return 0;
1292 return diskspace->avail_clusters;
1293}
1294
1295
1296/*********************************************************************
1297 * _getdllprocaddr (CRTDLL.123)
1298 */
1299FARPROC CDECL CRTDLL__getdllprocaddr(HMODULE hModule,char * lpProcName, int iOrdinal)
1300{
1301 dprintf(("CRTDLL: _getdllprocaddr\n"));
1302 if ( lpProcName != NULL )
1303 return GetProcAddress(hModule, lpProcName);
1304 else
1305 return GetProcAddress(hModule, (LPSTR)iOrdinal);
1306 return (NULL);
1307}
1308
1309
1310/*********************************************************************
1311 * _getdrive (CRTDLL.124)
1312 */
1313unsigned CDECL CRTDLL__getdrive( void )
1314{
1315 dprintf(("CRTDLL: _getdrive\n"));
1316 return DRIVE_GetCurrentDrive() + 1;
1317}
1318
1319
1320/*********************************************************************
1321 * _getdrives (CRTDLL.125)
1322 */
1323unsigned long CDECL CRTDLL__getdrives(void)
1324{
1325 dprintf(("CRTDLL: _getdrives\n"));
1326 return GetLogicalDrives();
1327}
1328
1329
1330/*********************************************************************
1331 * _getpid (CRTDLL.126)
1332 */
1333int CDECL CRTDLL__getpid( void )
1334{
1335 dprintf(("CRTDLL: _getpid\n"));
1336 return (_getpid());
1337}
1338
1339
1340/*********************************************************************
1341 * _getsystime (CRTDLL.127)
1342 */
1343unsigned int CDECL CRTDLL__getsystime(struct tm *tp)
1344{
1345 dprintf(("CRTDLL: _getsystime not implemented.\n"));
1346 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1347 return FALSE;
1348}
1349
1350
1351/*********************************************************************
1352 * _getw (CRTDLL.128)
1353 */
1354int CDECL CRTDLL__getw( FILE *stream )
1355{
1356 dprintf(("CRTDLL: _getw\n"));
1357 int w;
1358
1359 /* Is there a better way? */
1360 if (CRTDLL_fread( &w, sizeof(w), 1, stream) != 1)
1361 return(EOF);
1362 return(w);
1363}
1364
1365
1366/*******************************************************************
1367 * _global_unwind2 (CRTDLL.129)
1368 */
1369void CDECL CRTDLL__global_unwind2( PEXCEPTION_FRAME frame )
1370{
1371 dprintf(("CRTDLL: global_undwind2\n"));
1372 RtlUnwind( frame, 0, NULL, 0 );
1373}
1374
1375
1376/*********************************************************************
1377 * _heapchk (CRTDLL.130)
1378 */
1379int CDECL CRTDLL__heapchk( void )
1380{
1381 dprintf(("CRTDLL: _heapchk\n"));
1382 return (_heapchk());
1383}
1384
1385
1386/*********************************************************************
1387 * _heapmin (CRTDLL.131)
1388 */
1389int CDECL CRTDLL__heapmin( void )
1390{
1391 dprintf(("CRTDLL: _heapmin\n"));
1392 return (_heapmin());
1393}
1394
1395
1396/*********************************************************************
1397 * _heapset (CRTDLL.132)
1398 */
1399int CDECL CRTDLL__heapset( unsigned int fill )
1400{
1401 dprintf(("CRTDLL: _heapset\n"));
1402 return (_heapset(fill));
1403}
1404
1405
1406/*********************************************************************
1407 * _heapwalk (CRTDLL.133)
1408 */
1409int CDECL CRTDLL__heapwalk( struct _heapinfo *entry )
1410{
1411 dprintf(("CRTDLL: _heapwalk not implemented.\n"));
1412 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1413 return FALSE;
1414}
1415
1416
1417/*********************************************************************
1418 * _hypot (CRTDLL.134)
1419 */
1420double CDECL CRTDLL__hypot(double x1, double x2)
1421{
1422 dprintf(("CRTDLL: _hypot not implemented.\n"));
1423 return (_hypot(x1, x2));
1424}
1425
1426
1427/*********************************************************************
1428 * _initterm (CRTDLL.135)
1429 */
1430DWORD CDECL CRTDLL__initterm(_INITTERMFUN *start,_INITTERMFUN *end)
1431{
1432 dprintf(("CRTDLL: initterm\n"));
1433 _INITTERMFUN *current;
1434
1435 current=start;
1436 while (current<end) {
1437 if (*current) (*current)();
1438 current++;
1439 }
1440 return 0;
1441}
1442
1443
1444/*********************************************************************
1445 * _isatty (CRTDLL.137)
1446 */
1447BOOL CDECL CRTDLL__isatty(DWORD x)
1448{
1449 dprintf(("(%ld)\n",x));
1450 return TRUE;
1451}
1452
1453
1454/*********************************************************************
1455 * _isctype (CRTDLL.138)
1456 */
1457BOOL CDECL CRTDLL__isctype(CHAR x,CHAR type)
1458{
1459 dprintf(("CRTDLL: isctype\n"));
1460 if ((type & CRTDLL_SPACE) && isspace(x))
1461 return TRUE;
1462 if ((type & CRTDLL_PUNCT) && ispunct(x))
1463 return TRUE;
1464 if ((type & CRTDLL_LOWER) && islower(x))
1465 return TRUE;
1466 if ((type & CRTDLL_UPPER) && isupper(x))
1467 return TRUE;
1468 if ((type & CRTDLL_ALPHA) && isalpha(x))
1469 return TRUE;
1470 if ((type & CRTDLL_DIGIT) && isdigit(x))
1471 return TRUE;
1472 if ((type & CRTDLL_CONTROL) && iscntrl(x))
1473 return TRUE;
1474 /* check CRTDLL_LEADBYTE */
1475 return FALSE;
1476}
1477
1478
1479/*********************************************************************
1480 * _ismbbalnum (CRTDLL.139)
1481 */
1482int CDECL CRTDLL__ismbbalnum( unsigned int c )
1483{
1484 dprintf(("CRTDLL: _ismbbalnum\n"));
1485 return (CRTDLL_isalnum(c) || CRTDLL__ismbbkalnum(c));
1486}
1487
1488
1489/*********************************************************************
1490 * _ismbbalpha (CRTDLL.140)
1491 */
1492int CDECL CRTDLL__ismbbalpha( unsigned int c )
1493{
1494 dprintf(("CRTDLL: _ismbbalpha\n"));
1495 return (isalpha(c) || CRTDLL__ismbbkalnum(c));
1496}
1497
1498
1499/*********************************************************************
1500 * _ismbbgraph (CRTDLL.141)
1501 */
1502int CDECL CRTDLL__ismbbgraph( unsigned int c )
1503{
1504 dprintf(("CRTDLL: _ismbbgraph\n"));
1505 return (CRTDLL_isgraph(c) || CRTDLL__ismbbkana(c));
1506}
1507
1508
1509/*********************************************************************
1510 * _ismbbkalnum (CRTDLL.142)
1511 */
1512int CDECL CRTDLL__ismbbkalnum( unsigned int c )
1513{
1514 dprintf(("CRTDLL: _ismbbkalnum\n"));
1515 return ((_jctype+1)[(unsigned char)(c)] & (_KNJ_P));
1516}
1517
1518
1519/*********************************************************************
1520 * _ismbbkana (CRTDLL.143)
1521 */
1522int CDECL CRTDLL__ismbbkana( unsigned int c )
1523{
1524 dprintf(("CRTDLL: _ismbbkana\n"));
1525 return ((_jctype+1)[(unsigned char)(c)] & (_KNJ_M|_KNJ_P));
1526}
1527
1528
1529/*********************************************************************
1530 * _ismbbkpunct (CRTDLL.144)
1531 */
1532int CDECL CRTDLL__ismbbkpunct( unsigned int c )
1533{
1534 dprintf(("CRTDLL: _ismbbkpunct\n"));
1535 return ((_jctype+1)[(unsigned char)(c)] & (_KNJ_P));
1536}
1537
1538
1539/*********************************************************************
1540 * _ismbblead (CRTDLL.145)
1541 */
1542int CDECL CRTDLL__ismbblead( unsigned int c )
1543{
1544 dprintf(("CRTDLL: _ismbblead\n"));
1545 return ((_jctype+1)[(unsigned char)(c)] & _KNJ_1);
1546}
1547
1548
1549/*********************************************************************
1550 * _ismbbprint (CRTDLL.146)
1551 */
1552int CDECL CRTDLL__ismbbprint( unsigned int c )
1553{
1554 dprintf(("CRTDLL: _ismbbprint\n"));
1555 return (isprint(c) || CRTDLL__ismbbkana(c));
1556}
1557
1558
1559/*********************************************************************
1560 * _ismbbpunct (CRTDLL.147)
1561 */
1562int CDECL CRTDLL__ismbbpunct( unsigned int c )
1563{
1564 dprintf(("CRTDLL: _ismbbpunct\n"));
1565 return (ispunct(c) || CRTDLL__ismbbkana(c));
1566}
1567
1568
1569/*********************************************************************
1570 * _ismbbtrail (CRTDLL.148)
1571 */
1572int CDECL CRTDLL__ismbbtrail( unsigned int c )
1573{
1574 dprintf(("CRTDLL: _ismbbtrail\n"));
1575 return ((_jctype+1)[(unsigned char)(c)] & _KNJ_2);
1576}
1577
1578
1579/*********************************************************************
1580 * _ismbcalpha (CRTDLL.149)
1581 */
1582int CDECL CRTDLL__ismbcalpha( unsigned int c )
1583{
1584 dprintf(("CRTDLL: _ismbcalpha\n"));
1585 if ((c & 0xFF00) != 0) {
1586 // true multibyte character
1587 return 0;
1588 }
1589 else
1590 return CRTDLL__ismbbalpha(c);
1591
1592 return 0;
1593}
1594
1595
1596/*********************************************************************
1597 * _ismbcdigit (CRTDLL.150)
1598 */
1599int CDECL CRTDLL__ismbcdigit( unsigned int c )
1600{
1601 dprintf(("CRTDLL: _ismbcdigit\n"));
1602 if ((c & 0xFF00) != 0) {
1603 // true multibyte character
1604 return 0;
1605 }
1606 else
1607 return 0;
1608// return _ismbbdigit(c);
1609
1610 return 0;
1611}
1612
1613
1614/*********************************************************************
1615 * _ismbchira (CRTDLL.151)
1616 */
1617int CDECL CRTDLL__ismbchira( unsigned int c )
1618{
1619 dprintf(("CRTDLL: _ismbchira\n"));
1620 return ((c>=0x829F) && (c<=0x82F1));
1621}
1622
1623
1624/*********************************************************************
1625 * _ismbckata (CRTDLL.152)
1626 */
1627int CDECL CRTDLL__ismbckata( unsigned int c )
1628{
1629 dprintf(("CRTDLL: _ismbckata\n"));
1630 return ((c>=0x8340) && (c<=0x8396));
1631}
1632
1633/*********************************************************************
1634 * _ismbcl0 (CRTDLL.153)
1635 */
1636int CDECL CRTDLL__ismbcl0( unsigned int ch )
1637{
1638 dprintf(("CRTDLL: _ismbcl0 not implemented.\n"));
1639 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1640 return 0;
1641}
1642
1643
1644/*********************************************************************
1645 * _ismbcl1 (CRTDLL.154)
1646 */
1647int CDECL CRTDLL__ismbcl1( unsigned int ch )
1648{
1649 dprintf(("CRTDLL: _ismbcl1 not implemented.\n"));
1650 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1651 return 0;
1652}
1653
1654
1655/*********************************************************************
1656 * _ismbcl2 (CRTDLL.155)
1657 */
1658int CDECL CRTDLL__ismbcl2( unsigned int ch )
1659{
1660 dprintf(("CRTDLL: _ismbcl2 not implemented.\n"));
1661 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1662 return 0;
1663}
1664
1665
1666/*********************************************************************
1667 * _ismbclegal (CRTDLL.156)
1668 */
1669int CDECL CRTDLL__ismbclegal( unsigned int c )
1670{
1671 dprintf(("CRTDLL: _ismbclegal\n"));
1672 if ((c & 0xFF00) != 0) {
1673 return CRTDLL__ismbblead(c>>8) && CRTDLL__ismbbtrail(c&0xFF);
1674 }
1675 else
1676 return CRTDLL__ismbbtrail(c&0xFF);
1677
1678 return 0;
1679}
1680
1681
1682/*********************************************************************
1683 * _ismbclower (CRTDLL.157)
1684 */
1685int CDECL CRTDLL__ismbclower( unsigned int c )
1686{
1687 dprintf(("CRTDLL: _ismbclower\n"));
1688 if ((c & 0xFF00) != 0) {
1689 if ( c >= 0x829A && c<= 0x829A )
1690 return 1;
1691 }
1692 else
1693 return isupper(c);
1694}
1695
1696
1697/*********************************************************************
1698 * _ismbcprint (CRTDLL.158)
1699 */
1700int CDECL CRTDLL__ismbcprint( unsigned int c )
1701{
1702 dprintf(("CRTDLL: _ismbcprint\n"));
1703 if ((c & 0xFF00) != 0) {
1704 // true multibyte character
1705 return 0;
1706 }
1707 else
1708 return 0;
1709// return _ismbbdigit(c);
1710
1711 return 0;
1712}
1713
1714
1715/*********************************************************************
1716 * _ismbcspace (CRTDLL.159)
1717 */
1718int CDECL CRTDLL__ismbcspace( unsigned int c )
1719{
1720 dprintf(("CRTDLL: _ismbcspace not implemented.\n"));
1721 if ((c & 0xFF00) != 0) {
1722 // true multibyte character
1723 return 0;
1724 }
1725 else
1726 return 0;
1727// return _ismbbdigit(c);
1728
1729 return 0;
1730}
1731
1732
1733/*********************************************************************
1734 * _ismbcsymbol (CRTDLL.160)
1735 */
1736int CDECL CRTDLL__ismbcsymbol( unsigned int c )
1737{
1738 dprintf(("CRTDLL: _ismbcsymbol\n"));
1739 if ((c & 0xFF00) != 0) {
1740 // true multibyte character
1741 return 0;
1742 }
1743 else
1744 return 0;
1745// return _ismbbdigit(c);
1746
1747 return 0;
1748}
1749
1750
1751/*********************************************************************
1752 * _ismbcupper (CRTDLL.161)
1753 */
1754int CDECL CRTDLL__ismbcupper( unsigned int c )
1755{
1756 dprintf(("CRTDLL: _ismbcupper\n"));
1757 if ((c & 0xFF00) != 0) {
1758 if ( c >= 0x8260 && c<= 0x8279 )
1759 return 1;
1760 }
1761 else
1762 return isupper(c);
1763}
1764
1765
1766/*********************************************************************
1767 * _ismbslead (CRTDLL.162)
1768 */
1769int CDECL CRTDLL__ismbslead(const unsigned char *str, const unsigned char *t)
1770{
1771 dprintf(("CRTDLL: _ismbslead\n"));
1772 unsigned char *s = (unsigned char *)str;
1773 while(*s != 0 && s != t)
1774 {
1775 s+= _mbclen2(*s);
1776 }
1777 return CRTDLL__ismbblead( *s);
1778}
1779
1780
1781/*********************************************************************
1782 * _ismbstrail (CRTDLL.163)
1783 */
1784int CDECL CRTDLL__ismbstrail(const unsigned char *str, const unsigned char *t)
1785{
1786 dprintf(("CRTDLL: _ismbstrail\n"));
1787 unsigned char *s = (unsigned char *)str;
1788 while(*s != 0 && s != t)
1789 {
1790
1791 s+= _mbclen2(*s);
1792 }
1793
1794 return CRTDLL__ismbbtrail(*s);
1795}
1796
1797
1798/*********************************************************************
1799 * _isnan (CRTDLL.164)
1800 */
1801int CDECL CRTDLL__isnan( double x )
1802{
1803 dprintf(("CRTDLL: _isnan not implemented.\n"));
1804 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1805 return FALSE;
1806}
1807
1808
1809/*********************************************************************
1810 * _j0 (CRTDLL.166)
1811 */
1812double CDECL CRTDLL__j0(double x)
1813{
1814 dprintf(("CRTDLL: _j0\n"));
1815 return (_j0(x));
1816}
1817
1818
1819/*********************************************************************
1820 * _j1 (CRTDLL.167)
1821 */
1822double CDECL CRTDLL__j1(double x)
1823{
1824 dprintf(("CRTDLL: _j1\n"));
1825 return (_j1(x));}
1826
1827
1828/*********************************************************************
1829 * _jn (CRTDLL.168)
1830 */
1831double CDECL CRTDLL__jn(int i, double x)
1832{
1833 dprintf(("CRTDLL: _jn\n"));
1834 return (_jn(i, x));
1835}
1836
1837
1838/*********************************************************************
1839 * _kbhit (CRTDLL.169)
1840 */
1841int CDECL CRTDLL__kbhit( void )
1842{
1843 dprintf(("CRTDLL: _kbhit\n"));
1844 return (_kbhit());
1845}
1846
1847
1848/*********************************************************************
1849 * _lfind (CRTDLL.170)
1850 */
1851void * CDECL CRTDLL__lfind(const void *v1, const void *v2, unsigned int *i1, unsigned int i2,
1852 int (CDECL *i3)(const void *v3, const void *v4))
1853{
1854 dprintf(("CRTDLL: _lfind not implemented.\n"));
1855 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1856 return FALSE;
1857// return (_lfind(v1,v2,i1,i2,i3(v3,v4)));
1858}
1859
1860
1861/*********************************************************************
1862 * _loaddll (CRTDLL.171)
1863 */
1864void * CDECL CRTDLL__loaddll (char *name)
1865{
1866 dprintf(("CRTDLL: _loaddll not implemented.\n"));
1867 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1868 return FALSE;
1869}
1870
1871
1872/*******************************************************************
1873 * _local_unwind2 (CRTDLL.172)
1874 */
1875void CDECL CRTDLL__local_unwind2( PEXCEPTION_FRAME endframe, DWORD nr )
1876{
1877 dprintf(("CRTDLL: local_undwind2\n"));
1878}
1879
1880
1881/*********************************************************************
1882 * _locking (CRTDLL.173)
1883 */
1884int CDECL CRTDLL__locking(int handle,int mode,unsigned long nbyte)
1885{
1886 dprintf(("CRTDLL: _locking not implemented.\n"));
1887 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1888 return FALSE;
1889}
1890
1891
1892/*********************************************************************
1893 * _logb (CRTDLL.174)
1894 */
1895double CDECL CRTDLL__logb( double x )
1896{
1897 dprintf(("CRTDLL: _logb not implemented.\n"));
1898 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1899 return FALSE;
1900}
1901
1902
1903/*********************************************************************
1904 * _lrotl (CRTDLL.175)
1905 */
1906unsigned long CDECL CRTDLL__lrotl( unsigned long value, unsigned int shift )
1907{
1908 dprintf(("CRTDLL: _lrotl\n"));
1909 return (_lrotl(value, shift));
1910}
1911
1912
1913/*********************************************************************
1914 * _lrotr (CRTDLL.176)
1915 */
1916unsigned long CDECL CRTDLL__lrotr( unsigned long value, unsigned int shift )
1917{
1918 dprintf(("CRTDLL: _lrotr\n"));
1919 return (_lrotr(value, shift));
1920}
1921
1922
1923/*********************************************************************
1924 * _lsearch (CRTDLL.177)
1925 */
1926void * CDECL CRTDLL__lsearch(const void *v1, void *v2, unsigned int *i1, unsigned int i2,
1927 int (CDECL *i3)(const void *v3, const void *v4))
1928{
1929 dprintf(("CRTDLL: _lsearch not implemented.\n"));
1930 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1931 return FALSE;
1932// return (_lsearch(v1,v2,i1,i2,i3(v3,v4)));
1933}
1934
1935
1936/*********************************************************************
1937 * _lseek (CRTDLL.178)
1938 */
1939long CDECL CRTDLL__lseek(int handle,long offset,int origin)
1940{
1941 dprintf(("CRTDLL: _lssek\n"));
1942 return (_lseek(handle, offset, origin));
1943}
1944
1945
1946/*********************************************************************
1947 * _makepath (CRTDLL.180)
1948 */
1949void CDECL CRTDLL__makepath( char *path, char *drive,
1950 char *dir, char *fname, char *ext )
1951{
1952 dprintf(("CRTDLL: _makepath\n"));
1953 _makepath(path, drive, dir, fname, ext);
1954}
1955
1956
1957/*********************************************************************
1958 * _matherr (CRTDLL.181)
1959 */
1960#if (__IBMCPP__ > 300)
1961#define exception _exception
1962#endif
1963
1964double CDECL CRTDLL__matherr( struct exception * excep )
1965{
1966 dprintf(("CRTDLL: _matherr\n"));
1967 return (_matherr(excep));
1968}
1969
1970
1971/*********************************************************************
1972 * _mbbtombc (CRTDLL.182)
1973 */
1974unsigned int CDECL CRTDLL__mbbtombc( unsigned int c )
1975{
1976 dprintf(("CRTDLL: _mbbtombc\n"));
1977 if (c >= 0x20 && c <= 0x7e) {
1978 return han_to_zen_ascii_table[c - 0x20];
1979 } else if (ISKANA(c)) {
1980 return han_to_zen_kana_table[c - 0xa0];
1981 }
1982 return c;
1983}
1984
1985
1986/*********************************************************************
1987 * _mbbtype (CRTDLL.183)
1988 */
1989int CDECL CRTDLL__mbbtype( unsigned char c, int type )
1990{
1991 dprintf(("CRTDLL: _mbbtype\n"));
1992 if ( type == 1 ) {
1993 if ((c >= 0x40 && c <= 0x7e ) || (c >= 0x80 && c <= 0xfc ) )
1994 {
1995 return _MBC_TRAIL;
1996 }
1997 else if (( c >= 0x20 && c >= 0x7E ) || ( c >= 0xA1 && c <= 0xDF ) ||
1998 ( c >= 0x81 && c <= 0x9F ) || ( c >= 0xE0 && c <= 0xFC ) )
1999 return _MBC_ILLEGAL;
2000 else
2001 return 0;
2002
2003 }
2004 else {
2005 if (( c >= 0x20 && c <= 0x7E ) || ( c >= 0xA1 && c <= 0xDF )) {
2006 return _MBC_SINGLE;
2007 }
2008 else if ( (c >= 0x81 && c <= 0x9F ) || ( c >= 0xE0 && c <= 0xFC) )
2009 return _MBC_LEAD;
2010 else if (( c >= 0x20 && c >= 0x7E ) || ( c >= 0xA1 && c <= 0xDF ) ||
2011 ( c >= 0x81 && c <= 0x9F ) || ( c >= 0xE0 && c <= 0xFC ) )
2012 return _MBC_ILLEGAL;
2013 else
2014 return 0;
2015
2016 }
2017
2018
2019 return 0;
2020}
2021
2022
2023/*********************************************************************
2024 * _mbccpy (CRTDLL.184)
2025 */
2026void CDECL CRTDLL__mbccpy( unsigned char *dst, const unsigned char *src )
2027{
2028 dprintf(("CRTDLL: _mbccpy\n"));
2029
2030 if (!CRTDLL__ismbblead(*src) )
2031 return;
2032
2033 memcpy(dst,src,_mbclen2(*src));
2034}
2035
2036
2037/*********************************************************************
2038 * _mbcjistojms (CRTDLL.185)
2039 */
2040int CDECL CRTDLL__mbcjistojms( unsigned int c )
2041{
2042 dprintf(("CRTDLL: _mbcjistojms\n"));
2043 int c1, c2;
2044
2045 c2 = (unsigned char)c;
2046 c1 = c >> 8;
2047 if (c1 >= 0x21 && c1 <= 0x7e && c2 >= 0x21 && c2 <= 0x7e) {
2048 if (c1 & 0x01) {
2049 c2 += 0x1f;
2050 if (c2 >= 0x7f)
2051 c2 ++;
2052 } else {
2053 c2 += 0x7e;
2054 }
2055 c1 += 0xe1;
2056 c1 >>= 1;
2057 if (c1 >= 0xa0)
2058 c1 += 0x40;
2059 return ((c1 << 8) | c2);
2060 }
2061 return 0;
2062}
2063
2064
2065/*********************************************************************
2066 * _mbcjmstojis (CRTDLL.186)
2067 */
2068int CDECL CRTDLL__mbcjmstojis( unsigned int c )
2069{
2070 dprintf(("CRTDLL: _mbcjmstojis\n"));
2071 int c1, c2;
2072
2073 c2 = (unsigned char)c;
2074 c1 = c >> 8;
2075 if (c1 < 0xf0 && CRTDLL__ismbblead(c1) && CRTDLL__ismbbtrail(c2)) {
2076 if (c1 >= 0xe0)
2077 c1 -= 0x40;
2078 c1 -= 0x70;
2079 c1 <<= 1;
2080 if (c2 < 0x9f) {
2081 c1 --;
2082 c2 -= 0x1f;
2083 if (c2 >= (0x80-0x1f))
2084 c2 --;
2085 } else {
2086 c2 -= 0x7e;
2087 }
2088 return ((c1 << 8) | c2);
2089 }
2090 return 0;
2091}
2092
2093
2094/*********************************************************************
2095 * _mbclen (CRTDLL.187)
2096 */
2097size_t CDECL CRTDLL__mbclen( const unsigned char *s )
2098{
2099 dprintf(("CRTDLL: _mbclen\n"));
2100 return (CRTDLL__ismbblead(*s>>8) && CRTDLL__ismbbtrail(*s&0x00FF)) ? 2 : 1;
2101}
2102
2103
2104/*********************************************************************
2105 * _mbctohira (CRTDLL.188)
2106 */
2107int CDECL CRTDLL__mbctohira( unsigned int c )
2108{
2109 dprintf(("CRTDLL: _mbctohira\n"));
2110 return c;
2111}
2112
2113
2114/*********************************************************************
2115 * _mbctokata (CRTDLL.189)
2116 */
2117int CDECL CRTDLL__mbctokata( unsigned int c )
2118{
2119 dprintf(("CRTDLL: _mbctokata\n"));
2120 return c;
2121}
2122
2123
2124/*********************************************************************
2125 * _mbctolower (CRTDLL.190)
2126 */
2127unsigned int CDECL CRTDLL__mbctolower( unsigned int c )
2128{
2129 dprintf(("CRTDLL: _mbctolower\n"));
2130 if ((c & 0xFF00) != 0) {
2131// true multibyte case conversion needed
2132 if ( CRTDLL__ismbclower(c) )
2133 return c + CASE_DIFF;
2134
2135 } else
2136 return _mbbtolower(c);
2137
2138 return 0;
2139}
2140
2141
2142/*********************************************************************
2143 * _mbctombb (CRTDLL.191)
2144 */
2145unsigned int CDECL CRTDLL__mbctombb( unsigned int c )
2146{
2147 dprintf(("CRTDLL: _mbctombb\n"));
2148 int i;
2149 unsigned short *p;
2150
2151 if (JISKANA(c)) {
2152 return zen_to_han_kana_table[c - 0x8340];
2153 } else if (JISHIRA(c)) {
2154 c = JTOKANA(c);
2155 return zen_to_han_kana_table[c - 0x8340];
2156 } else if (c <= 0x8396) {
2157 for (i = 0x20, p = han_to_zen_ascii_table; i <= 0x7e; i++, p++) {
2158 if (*p == c) {
2159 return i;
2160 }
2161 }
2162 for (i = 0; i < ZTOH_SYMBOLS; i++) {
2163 if (zen_to_han_symbol_table_1[i] == c) {
2164 return zen_to_han_symbol_table_2[i];
2165 }
2166 }
2167 }
2168 return c;
2169}
2170
2171
2172/*********************************************************************
2173 * _mbctoupper (CRTDLL.192)
2174 */
2175unsigned int CDECL CRTDLL__mbctoupper( unsigned int c )
2176{
2177 dprintf(("CRTDLL: _mbctoupper\n"));
2178 if ((c & 0xFF00) != 0) {
2179// true multibyte case conversion needed
2180 if ( CRTDLL__ismbcupper(c) )
2181 return c + CASE_DIFF;
2182
2183 } else
2184 return _mbbtoupper(c);
2185
2186 return 0;
2187}
2188
2189
2190/*********************************************************************
2191 * _mbsbtype (CRTDLL.194)
2192 */
2193int CDECL CRTDLL__mbsbtype( const unsigned char *str, int n )
2194{
2195 dprintf(("CRTDLL: _mbsbtype\n"));
2196 if ( str == NULL )
2197 return -1;
2198 return CRTDLL__mbbtype(*(str+n),1);
2199}
2200
2201
2202/*********************************************************************
2203 * _mbscat (CRTDLL.195)
2204 */
2205unsigned char * CDECL CRTDLL__mbscat( unsigned char *dst, const unsigned char *src )
2206{
2207 dprintf(("CRTDLL: _mbscat not implemented.\n"));
2208 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
2209 return FALSE;
2210}
2211
2212
2213/*********************************************************************
2214 * _mbschr (CRTDLL.196)
2215 */
2216unsigned char * CDECL CRTDLL__mbschr( const unsigned char *str, unsigned int c )
2217{
2218 dprintf(("CRTDLL: _mbschr not implemented.\n"));
2219 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
2220 return FALSE;
2221}
2222
2223
2224/*********************************************************************
2225 * _mbscmp (CRTDLL.197)
2226 */
2227int CDECL CRTDLL__mbscmp( const unsigned char *s1, const unsigned char *s2 )
2228{
2229 dprintf(("CRTDLL: _mbscmp not implemented.\n"));
2230 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
2231 return FALSE;
2232}
2233
2234
2235/*********************************************************************
2236 * _mbscpy (CRTDLL.198)
2237 */
2238unsigned char * CDECL CRTDLL__mbscpy( unsigned char *s1, const unsigned char *s2 )
2239{
2240 dprintf(("CRTDLL: _mbscpy not implemented.\n"));
2241 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
2242 return FALSE;
2243}
2244
2245
2246/*********************************************************************
2247 * _mbscspn (CRTDLL.199)
2248 */
2249size_t CDECL CRTDLL__mbscspn( const unsigned char *s1, const unsigned char *s2 )
2250{
2251 dprintf(("CRTDLL: _mbscspn not implemented.\n"));
2252 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
2253 return FALSE;
2254}
2255
2256
2257/*********************************************************************
2258 * _mbsdec (CRTDLL.200)
2259 */
2260unsigned char * CDECL CRTDLL__mbsdec( const unsigned char *str, const unsigned char *cur )
2261{
2262 dprintf(("CRTDLL: _mbsdec\n"));
2263 unsigned char *s = (unsigned char *)cur;
2264 if ( str >= cur )
2265 return NULL;
2266 s--;
2267 if (CRTDLL__ismbblead(*(s-1)) )
2268 s--;
2269
2270 return s;
2271}
2272
2273
2274/*********************************************************************
2275 * _mbsdup (CRTDLL.201)
2276 */
2277unsigned char * CDECL CRTDLL__mbsdup( unsigned char *src )
2278{
2279 dprintf(("CRTDLL: _mbsdup not implemented.\n"));
2280 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
2281 return FALSE;
2282}
2283
2284
2285/*********************************************************************
2286 * CRTDLL__mbsicmp (CRTDLL.202)
2287 */
2288int CDECL CRTDLL__mbsicmp( const unsigned char *x, const unsigned char *y )
2289{
2290 dprintf(("CRTDLL: _mbsicmp\n"));
2291 do {
2292 if (!*x)
2293 return !!*y;
2294 if (!*y)
2295 return !!*x;
2296 /* FIXME: MBCS handling... */
2297 if (*x!=*y)
2298 return 1;
2299 x++;
2300 y++;
2301 } while (1);
2302}
2303
2304
2305/*********************************************************************
2306 * CRTDLL__mbsinc (CRTDLL.203)
2307 */
2308LPSTR CDECL CRTDLL__mbsinc( LPCSTR str )
2309{
2310 dprintf(("CRTDLL: _mbsinc\n"));
2311 int len = mblen( str, MB_LEN_MAX );
2312 if (len < 1) len = 1;
2313 return (LPSTR)(str + len);
2314}
2315
2316
2317/*********************************************************************
2318 * CRTDLL__mbslen (CRTDLL.204)
2319 */
2320INT CDECL CRTDLL__mbslen( LPCSTR str )
2321{
2322 dprintf(("CRTDLL: _mbslen\n"));
2323 INT len, total = 0;
2324 while ((len = mblen( str, MB_LEN_MAX )) > 0)
2325 {
2326 str += len;
2327 total++;
2328 }
2329 return total;
2330}
2331
2332
2333/*********************************************************************
2334 * _mbslwr (CRTDLL.205)
2335 */
2336unsigned char * CDECL CRTDLL__mbslwr( unsigned char *x )
2337{
2338 dprintf(("CRTDLL: _mbslwr\n"));
2339 unsigned char *y=x;
2340
2341 while (*y) {
2342 if (!CRTDLL__ismbblead(*y) )
2343 *y = tolower(*y);
2344 else {
2345 *y=CRTDLL__mbctolower(*(unsigned short *)y);
2346 y++;
2347 }
2348 }
2349 return x;
2350}
2351
2352
2353/*********************************************************************
2354 * _mbsnbcat (CRTDLL.206)
2355 */
2356unsigned char * CDECL CRTDLL__mbsnbcat( unsigned char *dst, const unsigned char *src, size_t n )
2357{
2358 dprintf(("CRTDLL: _mbsnbcat\n"));
2359 char *d;
2360 char *s = (char *)src;
2361 if (n != 0) {
2362 d = (char*)dst + strlen((char*)dst); // get the end of string
2363 d += _mbclen2(*d); // move 1 or 2 up
2364
2365 do {
2366 if ((*d++ = *s++) == 0)
2367 {
2368 while (--n != 0)
2369 *d++ = 0;
2370 break;
2371 }
2372 if ( !(n==1 && CRTDLL__ismbblead(*s)) )
2373 n--;
2374 } while (n > 0);
2375 }
2376 return dst;
2377}
2378
2379
2380/*********************************************************************
2381 * _mbsnbcmp (CRTDLL.207)
2382 */
2383int CDECL CRTDLL__mbsnbcmp( const unsigned char *str1, const unsigned char *str2, size_t n )
2384{
2385 dprintf(("CRTDLL: _mbsnbcmp\n"));
2386 unsigned char *s1 = (unsigned char *)str1;
2387 unsigned char *s2 = (unsigned char *)str2;
2388
2389 unsigned short *short_s1, *short_s2;
2390
2391 int l1, l2;
2392
2393 if (n == 0)
2394 return 0;
2395 do {
2396
2397 if (*s1 == 0)
2398 break;
2399
2400 l1 = CRTDLL__ismbblead(*s1);
2401 l2 = CRTDLL__ismbblead(*s2);
2402 if ( !l1 && !l2 ) {
2403
2404 if (*s1 != *s2)
2405 return *s1 - *s2;
2406 else {
2407 s1 += 1;
2408 s2 += 1;
2409 n--;
2410 }
2411 }
2412 else if ( l1 && l2 ){
2413 short_s1 = (unsigned short *)s1;
2414 short_s2 = (unsigned short *)s2;
2415 if ( *short_s1 != *short_s2 )
2416 return *short_s1 - *short_s2;
2417 else {
2418 s1 += 2;
2419 s2 += 2;
2420 n-=2;
2421
2422 }
2423 }
2424 else
2425 return *s1 - *s2;
2426 } while (n > 0);
2427 return 0;
2428}
2429
2430
2431/*********************************************************************
2432 * _mbsnbcnt (CRTDLL.208)
2433 */
2434size_t CDECL CRTDLL__mbsnbcnt( const unsigned char *str, size_t n )
2435{
2436 dprintf(("CRTDLL: _mbsnbcnt\n"));
2437 unsigned char *s = (unsigned char *)str;
2438 while(*s != 0 && n > 0) {
2439 if (!CRTDLL__ismbblead(*s) )
2440 n--;
2441 s++;
2442 }
2443
2444 return (size_t)(s - str);
2445}
2446
2447
2448/*********************************************************************
2449 * _mbsnbcpy (CRTDLL.209)
2450 */
2451unsigned char * CDECL CRTDLL__mbsnbcpy( unsigned char *str1, const unsigned char *str2, size_t n )
2452{
2453 dprintf(("CRTDLL: _mbsnbcpy\n"));
2454 unsigned char *s1 = (unsigned char *)str1;
2455 unsigned char *s2 = (unsigned char *)str2;
2456
2457 unsigned short *short_s1, *short_s2;
2458
2459 if (n == 0)
2460 return 0;
2461 do {
2462
2463 if (*s2 == 0)
2464 break;
2465
2466 if ( !CRTDLL__ismbblead(*s2) ) {
2467
2468 *s1 = *s2;
2469 s1 += 1;
2470 s2 += 1;
2471 n--;
2472 }
2473 else {
2474 short_s1 = (unsigned short *)s1;
2475 short_s2 = (unsigned short *)s2;
2476 *short_s1 = *short_s2;
2477 s1 += 2;
2478 s2 += 2;
2479 n-=2;
2480 }
2481 } while (n > 0);
2482 return str1;
2483}
2484
2485
2486/*********************************************************************
2487 * _mbsnbicmp (CRTDLL.210)
2488 */
2489int CDECL CRTDLL__mbsnbicmp( const unsigned char *s1, const unsigned char *s2, size_t n )
2490{
2491 dprintf(("CRTDLL: _mbsnbicmp\n"));
2492 if (n == 0)
2493 return 0;
2494 do {
2495 if (_mbbtoupper(*s1) != _mbbtoupper(*s2))
2496 return _mbbtoupper(*(unsigned const char *)s1) - _mbbtoupper(*(unsigned const char *)s2);
2497 s1 += _mbclen2(*s1);
2498 s2 += _mbclen2(*s2);
2499
2500
2501 if (*s1 == 0)
2502 break;
2503 n--;
2504 } while (n > 0);
2505 return 0;
2506}
2507
2508
2509/*********************************************************************
2510 * _mbsnbset (CRTDLL.211)
2511 */
2512unsigned char * CDECL CRTDLL__mbsnbset( unsigned char *src, unsigned int val, size_t count )
2513{
2514 dprintf(("CRTDLL: _mbsnbset\n"));
2515 unsigned char *char_src = (unsigned char *)src;
2516 unsigned short *short_src = (unsigned short *)src;
2517
2518 if ( _mbclen2(val) == 1 ) {
2519
2520 while(count > 0) {
2521 *char_src = val;
2522 char_src++;
2523 count--;
2524 }
2525 *char_src = 0;
2526 }
2527 else {
2528 while(count > 0) {
2529 *short_src = val;
2530 short_src++;
2531 count-=2;
2532 }
2533 *short_src = 0;
2534 }
2535
2536 return src;
2537}
2538
2539
2540/*********************************************************************
2541 * _mbsncat (CRTDLL.212)
2542 */
2543unsigned char * CDECL CRTDLL__mbsncat( unsigned char *dst, const unsigned char *src, size_t n )
2544{
2545 dprintf(("CRTDLL: _mbsncat\n"));
2546 char *d = (char *)dst;
2547 char *s = (char *)src;
2548 if (n != 0) {
2549 d = (char*)dst + strlen((char*)dst); // get the end of string
2550 d += _mbclen2(*d); // move 1 or 2 up
2551
2552 do {
2553 if ((*d++ = *s++) == 0)
2554 {
2555 while (--n != 0)
2556 *d++ = 0;
2557 break;
2558 }
2559 if (!CRTDLL__ismbblead(*s) )
2560 n--;
2561 } while (n > 0);
2562 }
2563 return dst;
2564}
2565
2566
2567/*********************************************************************
2568 * _mbsnccnt (CRTDLL.213)
2569 */
2570size_t CDECL CRTDLL__mbsnccnt( const unsigned char *str, size_t n )
2571{
2572 dprintf(("CRTDLL: _mbsnccnt\n"));
2573 unsigned char *s = (unsigned char *)str;
2574 size_t cnt = 0;
2575 while(*s != 0 && n > 0) {
2576 if (CRTDLL__ismbblead(*s) )
2577 s++;
2578 else
2579 n--;
2580 s++;
2581 cnt++;
2582 }
2583
2584 return cnt;
2585}
2586
2587
2588/*********************************************************************
2589 * _mbsncmp (CRTDLL.214)
2590 */
2591int CDECL CRTDLL__mbsncmp( const unsigned char *str1, const unsigned char *str2, size_t n )
2592{
2593 dprintf(("CRTDLL: _mbsncmp\n"));
2594 unsigned char *s1 = (unsigned char *)str1;
2595 unsigned char *s2 = (unsigned char *)str2;
2596
2597 unsigned short *short_s1, *short_s2;
2598
2599 int l1, l2;
2600
2601 if (n == 0)
2602 return 0;
2603 do {
2604
2605 if (*s1 == 0)
2606 break;
2607
2608 l1 = CRTDLL__ismbblead(*s1);
2609 l2 = CRTDLL__ismbblead(*s2);
2610 if ( !l1 && !l2 ) {
2611
2612 if (*s1 != *s2)
2613 return *s1 - *s2;
2614 else {
2615 s1 += 1;
2616 s2 += 1;
2617 n--;
2618 }
2619 }
2620 else if ( l1 && l2 ){
2621 short_s1 = (unsigned short *)s1;
2622 short_s2 = (unsigned short *)s2;
2623 if ( *short_s1 != *short_s2 )
2624 return *short_s1 - *short_s2;
2625 else {
2626 s1 += 2;
2627 s2 += 2;
2628 n--;
2629
2630 }
2631 }
2632 else
2633 return *s1 - *s2;
2634 } while (n > 0);
2635 return 0;
2636}
2637
2638
2639/*********************************************************************
2640 * _mbsncpy (CRTDLL.215)
2641 */
2642unsigned char * CDECL CRTDLL__mbsncpy( unsigned char *str1, const unsigned char *str2, size_t n )
2643{
2644 dprintf(("CRTDLL: _mbsncpy\n"));
2645 unsigned char *s1 = (unsigned char *)str1;
2646 unsigned char *s2 = (unsigned char *)str2;
2647
2648 unsigned short *short_s1, *short_s2;
2649
2650 if (n == 0)
2651 return 0;
2652 do {
2653
2654 if (*s2 == 0)
2655 break;
2656
2657 if ( !CRTDLL__ismbblead(*s2) ) {
2658
2659 *s1 = *s2;
2660 s1 += 1;
2661 s2 += 1;
2662 n--;
2663 }
2664 else {
2665 short_s1 = (unsigned short *)s1;
2666 short_s2 = (unsigned short *)s2;
2667 *short_s1 = *short_s2;
2668 s1 += 2;
2669 s2 += 2;
2670 n--;
2671 }
2672 } while (n > 0);
2673 return str1;
2674}
2675
2676
2677/*********************************************************************
2678 * _mbsnextc (CRTDLL.216)
2679 */
2680unsigned int CDECL CRTDLL__mbsnextc( const unsigned char *src )
2681{
2682 dprintf(("CRTDLL: _mbsnextc\n"));
2683 unsigned char *char_src = (unsigned char *)src;
2684 unsigned short *short_src = (unsigned short *)src;
2685
2686 if ( src == NULL )
2687 return 0;
2688
2689 if ( !CRTDLL__ismbblead(*src) )
2690 return *char_src;
2691 else
2692 return *short_src;
2693 return 0;
2694
2695}
2696
2697
2698/*********************************************************************
2699 * _mbsnicmp (CRTDLL.217)
2700 */
2701int CDECL CRTDLL__mbsnicmp( const unsigned char *s1, const unsigned char *s2, size_t n )
2702{
2703 dprintf(("CRTDLL: _mbsnicmp\n"));
2704 if (n == 0)
2705 return 0;
2706 do {
2707 if (_mbbtoupper(*s1) != _mbbtoupper(*s2))
2708 return _mbbtoupper(*(unsigned const char *)s1) - _mbbtoupper(*(unsigned const char *)s2);
2709
2710// Next 2 lines won't compile
2711// *s1 += _mbclen2(*s1);
2712// *s2 += _mbclen2(*s2);
2713
2714
2715 if (*s1 == 0)
2716 break;
2717 if (!CRTDLL__ismbblead(*s1) )
2718 n--;
2719 } while (n > 0);
2720 return 0;
2721}
2722
2723
2724/*********************************************************************
2725 * _mbsninc (CRTDLL.218)
2726 */
2727unsigned char * CDECL CRTDLL__mbsninc( const unsigned char *str, size_t n )
2728{
2729 dprintf(("CRTDLL: _mbsninc\n"));
2730 unsigned char *s = (unsigned char *)str;
2731 while(*s != 0 && n > 0) {
2732 if (!CRTDLL__ismbblead(*s) )
2733 n--;
2734 s++;
2735 }
2736
2737 return s;
2738}
2739
2740
2741/*********************************************************************
2742 * _mbsnset (CRTDLL.219)
2743 */
2744unsigned char * CDECL CRTDLL__mbsnset( unsigned char *src, unsigned int val, size_t count )
2745{
2746 dprintf(("CRTDLL: _mbsnset\n"));
2747 unsigned char *char_src = (unsigned char *)src;
2748 unsigned short *short_src = (unsigned short *)src;
2749
2750 if ( _mbclen2(val) == 1 ) {
2751
2752 while(count > 0) {
2753 *char_src = val;
2754 char_src++;
2755 count--;
2756 }
2757 *char_src = 0;
2758 }
2759 else {
2760 while(count > 0) {
2761 *short_src = val;
2762 short_src++;
2763 count-=2;
2764 }
2765 *short_src = 0;
2766 }
2767
2768 return src;
2769
2770}
2771
2772
2773/*********************************************************************
2774 * _mbspbrk (CRTDLL.220)
2775 */
2776unsigned char * CDECL CRTDLL__mbspbrk( const unsigned char *s1, const unsigned char *s2 )
2777{
2778 dprintf(("CRTDLL: _mbspbrk\n"));
2779 const char *scanp;
2780 int c, sc;
2781
2782 while ((c = *s1++) != 0)
2783 {
2784 for (scanp = (char*)s2; (sc = *scanp++) != 0;)
2785 if (sc == c)
2786 return (unsigned char *)((char *)s1 - (char *)1);
2787 }
2788 return 0;
2789}
2790
2791
2792/*********************************************************************
2793 * CRTDLL__mbsrchr (CRTDLL.221)
2794 */
2795LPSTR CDECL CRTDLL__mbsrchr(LPSTR s,CHAR x)
2796{
2797 dprintf(("CRTDLL: _mbsrchr\n"));
2798 /* FIXME: handle multibyte strings */
2799 return strrchr(s,x);
2800}
2801
2802
2803/*********************************************************************
2804 * _mbsrev (CRTDLL.222)
2805 */
2806unsigned char * CDECL CRTDLL__mbsrev( unsigned char *s )
2807{
2808 dprintf(("CRTDLL: _mbsrev\n"));
2809 unsigned char *e;
2810 unsigned char a;
2811 e=s;
2812 while (*e) {
2813 if ( CRTDLL__ismbblead(*e) ) {
2814 a = *e;
2815 *e = *++e;
2816 if ( *e == 0 )
2817 break;
2818 *e = a;
2819 }
2820 e++;
2821 }
2822 while (s<e) {
2823 a=*s;
2824 *s=*e;
2825 *e=a;
2826 s++;
2827 e--;
2828 }
2829
2830
2831 return s;
2832}
2833
2834
2835/*********************************************************************
2836 * _mbsset (CRTDLL.223)
2837 */
2838unsigned char * CDECL CRTDLL__mbsset( unsigned char *src, unsigned int c )
2839{
2840 dprintf(("CRTDLL: _mbsset\n"));
2841 unsigned char *char_src = src;
2842 unsigned short *short_src = (unsigned short*)src;
2843
2844 if ( _mbclen2(c) == 1 ) {
2845
2846 while(*char_src != 0) {
2847 *char_src = c;
2848 char_src++;
2849 }
2850 *char_src = 0;
2851 }
2852 else {
2853 while(*short_src != 0) {
2854 *short_src = c;
2855 short_src++;
2856 }
2857 *short_src = 0;
2858 }
2859
2860 return src;
2861}
2862
2863
2864/*********************************************************************
2865 * _mbsspn (CRTDLL.224)
2866 */
2867size_t CDECL CRTDLL__mbsspn( const unsigned char *s1, const unsigned char *s2 )
2868{
2869 dprintf(("CRTDLL: _mbsspn\n"));
2870 const char *p = (char*)s1, *spanp;
2871 char c, sc;
2872
2873 cont:
2874 c = *p++;
2875 for (spanp = (char*)s2; (sc = *spanp++) != 0;)
2876 if (sc == c)
2877 goto cont;
2878 return (size_t)(p - 1) - (size_t)s1;
2879}
2880
2881
2882/*********************************************************************
2883 * _mbsspnp (CRTDLL.225)
2884 */
2885unsigned char * CDECL CRTDLL__mbsspnp( const unsigned char *s1, const unsigned char *s2 )
2886{
2887 dprintf(("CRTDLL: _mbsspnp\n"));
2888 const char *p = (char*)s1, *spanp;
2889 char c, sc;
2890
2891 cont:
2892 c = *p++;
2893 for (spanp = (char*)s2; (sc = *spanp++) != 0;)
2894 if (sc == c)
2895 goto cont;
2896 return (unsigned char*)p;
2897}
2898
2899
2900/*********************************************************************
2901 * _mbsstr (CRTDLL.226)
2902 */
2903unsigned char * CDECL CRTDLL__mbsstr( const unsigned char *s1, const unsigned char *s2 )
2904{
2905 dprintf(("CRTDLL: _mbsstr not implemented.\n"));
2906 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
2907 return FALSE;
2908}
2909
2910
2911/*********************************************************************
2912 * _mbstok (CRTDLL.227)
2913 */
2914unsigned char * CDECL CRTDLL__mbstok( unsigned char *s, const unsigned char *delim )
2915{
2916 dprintf(("CRTDLL: _mbstok not implemented\n"));
2917 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
2918 return FALSE;
2919}
2920
2921
2922/*********************************************************************
2923 * _mbstrlen (CRTDLL.228)
2924 */
2925size_t CDECL CRTDLL__mbstrlen(const char *string)
2926{
2927 dprintf(("CRTDLL: _mbstrlen\n"));
2928 char *s = (char *)string;
2929 size_t i;
2930 while ( *s != 0 ) {
2931 if ( CRTDLL__ismbblead(*s) )
2932 s++;
2933 s++;
2934 i++;
2935 }
2936 return i;
2937}
2938
2939
2940/*********************************************************************
2941 * _mbsupr (CRTDLL.229)
2942 */
2943unsigned char * CDECL CRTDLL__mbsupr( unsigned char *x )
2944{
2945 dprintf(("CRTDLL: _mbsupr\n"));
2946 unsigned char *y=x;
2947 while (*y) {
2948 if (!CRTDLL__ismbblead(*y) )
2949 *y = toupper(*y);
2950 else {
2951 *y=CRTDLL__mbctoupper(*(unsigned short *)y);
2952 y++;
2953 }
2954 }
2955 return x;
2956}
2957
2958
2959/*********************************************************************
2960 * CRTDLL__memccpy (CRTDLL.230)
2961 */
2962void * CDECL CRTDLL__memccpy(void *to, const void *from,int c,size_t count)
2963{
2964 dprintf(("CRTDLL: _memccpy\n"));
2965 memcpy(to,from,count);
2966 return memchr(to,c,count);
2967}
2968
2969
2970/*********************************************************************
2971 * _mkdir (CRTDLL.232)
2972 */
2973INT CDECL CRTDLL__mkdir(LPCSTR newdir)
2974{
2975 dprintf(("CRTDLL: mkdir\n"));
2976 if (!CreateDirectoryA(newdir,NULL))
2977 return -1;
2978 return 0;
2979}
2980
2981
2982/*********************************************************************
2983 * _mktemp (CRTDLL.233)
2984 */
2985char * CDECL CRTDLL__mktemp( char * _template )
2986{
2987 dprintf(("CRTDLL: _mktemp\n"));
2988 static int count = 0;
2989 char *cp, *dp;
2990 int i, len, xcount, loopcnt;
2991
2992
2993
2994 len = strlen (_template);
2995 cp = _template + len;
2996
2997 xcount = 0;
2998 while (xcount < 6 && cp > _template && cp[-1] == 'X')
2999 xcount++, cp--;
3000
3001 if (xcount) {
3002 dp = cp;
3003 while (dp > _template && dp[-1] != '/' && dp[-1] != '\\' && dp[-1] != ':')
3004 dp--;
3005
3006 /* Keep the first characters of the template, but turn the rest into
3007 Xs. */
3008 while (cp > dp + 8 - xcount) {
3009 *--cp = 'X';
3010 xcount = (xcount >= 6) ? 6 : 1 + xcount;
3011 }
3012
3013 /* If dots occur too early -- squash them. */
3014 while (dp < cp) {
3015 if (*dp == '.') *dp = 'a';
3016 dp++;
3017 }
3018
3019 /* Try to add ".tmp" to the filename. Truncate unused Xs. */
3020 if (cp + xcount + 3 < _template + len)
3021 strcpy (cp + xcount, ".tmp");
3022 else
3023 cp[xcount] = 0;
3024
3025 for (loopcnt = 0; loopcnt < (1 << (5 * xcount)); loopcnt++) {
3026 int c = count++;
3027 for (i = 0; i < xcount; i++, c >>= 5)
3028 cp[i] = "abcdefghijklmnopqrstuvwxyz012345"[c & 0x1f];
3029 if (CRTDLL__access(_template,0) == -1)
3030 return _template;
3031 }
3032 }
3033 /* Failure: truncate the template and return NULL. */
3034 *_template = 0;
3035 return 0;
3036}
3037
3038
3039/*********************************************************************
3040 * _msize (CRTDLL.234)
3041 */
3042size_t CDECL CRTDLL__msize( void *ptr )
3043{
3044 dprintf(("CRTDLL: _msize\n"));
3045 return (_msize(ptr));
3046}
3047
3048
3049/*********************************************************************
3050 * _nextafter (CRTDLL.235)
3051 */
3052double CDECL CRTDLL__nextafter( double x, double y )
3053{
3054 dprintf(("CRTDLL: _nextafter not implemented.\n"));
3055 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
3056 return FALSE;
3057}
3058
3059
3060/*********************************************************************
3061 * _onexit (CRTDLL.236)
3062 */
3063onexit_t CDECL CRTDLL__onexit(onexit_t t)
3064{
3065 dprintf(("CRTDLL: _onexit\n"));
3066 return (_onexit(t));
3067}
3068
3069
3070/*********************************************************************
3071 * _open (CRTDLL.237)
3072 */
3073HFILE CDECL CRTDLL__open(LPCSTR path,INT flags)
3074{
3075 dprintf(("CRTDLL: _open\n"));
3076 DWORD access = 0, creation = 0;
3077 HFILE ret;
3078
3079 switch(flags & 3)
3080 {
3081 case O_RDONLY: access |= GENERIC_READ; break;
3082 case O_WRONLY: access |= GENERIC_WRITE; break;
3083 case O_RDWR: access |= GENERIC_WRITE | GENERIC_READ; break;
3084 }
3085
3086 if (flags & 0x0100) /* O_CREAT */
3087 {
3088 if (flags & 0x0400) /* O_EXCL */
3089 creation = CREATE_NEW;
3090 else if (flags & 0x0200) /* O_TRUNC */
3091 creation = CREATE_ALWAYS;
3092 else
3093 creation = OPEN_ALWAYS;
3094 }
3095 else /* no O_CREAT */
3096 {
3097 if (flags & 0x0200) /* O_TRUNC */
3098 creation = TRUNCATE_EXISTING;
3099 else
3100 creation = OPEN_EXISTING;
3101 }
3102 if (flags & 0x0008) /* O_APPEND */
3103 dprintf(("O_APPEND not supported\n" ));
3104 if (flags & 0xf0f4)
3105 dprintf(("CRTDLL_open file unsupported flags 0x%04x\n",flags));
3106 /* End Fixme */
3107
3108 ret = CreateFileA( path, access, FILE_SHARE_READ | FILE_SHARE_WRITE,
3109 NULL, creation, FILE_ATTRIBUTE_NORMAL, -1 );
3110 dprintf(("CRTDLL_open file %s mode 0x%04x got handle %d\n", path,flags,ret));
3111 return ret;
3112}
3113
3114
3115/*********************************************************************
3116 * _open_osfhandle (CRTDLL.238)
3117 */
3118INT CDECL CRTDLL__open_osfhandle( long osfhandle, int flags )
3119{
3120 dprintf(("CRTDLL: _open_osfhandle\n"));
3121HFILE handle;
3122
3123 switch (osfhandle) {
3124 case STD_INPUT_HANDLE :
3125 case 0 :
3126 handle=0;
3127 break;
3128 case STD_OUTPUT_HANDLE:
3129 case 1:
3130 handle=1;
3131 break;
3132 case STD_ERROR_HANDLE:
3133 case 2:
3134 handle=2;
3135 break;
3136 default:
3137 return (-1);
3138 }
3139 dprintf(("(handle %08lx,flags %d) return %d\n",
3140 osfhandle,flags,handle));
3141 return handle;
3142}
3143
3144
3145/*********************************************************************
3146 * _pclose (CRTDLL.244)
3147 */
3148INT CDECL CRTDLL__pclose( FILE *fp )
3149{
3150 dprintf(("CRTDLL: _pclose not implemented.\n"));
3151 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
3152 return FALSE;
3153}
3154
3155
3156/*********************************************************************
3157 * _pipe (CRTDLL.247)
3158 */
3159INT CDECL CRTDLL__pipe( int *phandles, unsigned psize, int textmode )
3160{
3161 dprintf(("CRTDLL: _pipe not implemented.\n"));
3162 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
3163 return FALSE;
3164}
3165
3166
3167/*********************************************************************
3168 * _popen (CRTDLL.248)
3169 */
3170FILE * CDECL CRTDLL__popen( const char *command, const char *mode )
3171{
3172 dprintf(("CRTDLL: _popen not implemented.\n"));
3173 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
3174 return FALSE;
3175}
3176
3177
3178/*********************************************************************
3179 * _purecall (CRTDLL.249)
3180 */
3181void CDECL CRTDLL__purecall(void)
3182{
3183 dprintf(("CRTDLL: _purecall\n"));
3184}
3185
3186
3187/*********************************************************************
3188 * _putch (CRTDLL.250)
3189 */
3190INT CDECL CRTDLL__putch( int i )
3191{
3192 dprintf(("CRTDLL: _putch\n"));
3193 return (_putch(i));
3194}
3195
3196
3197/*********************************************************************
3198 * _putenv (CRTDLL.251)
3199 */
3200INT CDECL CRTDLL__putenv(const char *s)
3201{
3202 dprintf(("CRTDLL: _putenv\n"));
3203 return (_putenv(s));
3204}
3205
3206
3207/*********************************************************************
3208 * _putw (CRTDLL.252)
3209 */
3210INT CDECL CRTDLL__putw( int w, FILE *stream )
3211{
3212 dprintf(("CRTDLL: _putw\n"));
3213 if (fwrite( &w, sizeof(w), 1, stream) < 1)
3214 return(EOF);
3215 return(0);
3216}
3217
3218
3219/*********************************************************************
3220 * _read (CRTDLL.254)
3221 */
3222INT CDECL CRTDLL__read(INT fd, LPVOID buf, UINT count)
3223{
3224 dprintf(("CRTDLL: _read not implemented.\n"));
3225 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
3226 return FALSE;
3227}
3228
3229
3230/*********************************************************************
3231 * _rmdir (CRTDLL.255)
3232 */
3233INT CDECL CRTDLL__rmdir(const char *path)
3234{
3235 dprintf(("CRTDLL: _rmdir\n"));
3236 if (!RemoveDirectoryA(path))
3237 return -1;
3238 return 0;
3239}
3240
3241
3242/*********************************************************************
3243 * _rmtmp (CRTDLL.256)
3244 */
3245INT CDECL CRTDLL__rmtmp(void)
3246{
3247 dprintf(("CRTDLL: _rmtmp\n"));
3248 return(_rmtmp());
3249}
3250
3251
3252/*********************************************************************
3253 * CRTDLL__rotl (CRTDLL.257)
3254 */
3255unsigned int CDECL CRTDLL__rotl( unsigned int value, unsigned int shift )
3256{
3257 dprintf(("CRTDLL: _rotl\n"));
3258 return (_rotl(value, shift));
3259}
3260
3261
3262/*********************************************************************
3263 * CRTDLL__rotr (CRTDLL.258)
3264 */
3265unsigned int CDECL CRTDLL__rotr( unsigned int value, unsigned int shift )
3266{
3267 dprintf(("CRTDLL: _rotr\n"));
3268 return (_rotr(value, shift));
3269}
3270
3271
3272/*********************************************************************
3273 * _scalb (CRTDLL.259)
3274 */
3275double CDECL CRTDLL__scalb( double x, long exp )
3276{
3277 dprintf(("CRTDLL: _scalb not implemented.\n"));
3278 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
3279 return FALSE;
3280}
3281
3282
3283/*********************************************************************
3284 * CRTDLL__searchenv (CRTDLL.260)
3285 */
3286void CDECL CRTDLL__searchenv(const char *file,const char *var,char *path )
3287{
3288 dprintf(("CRTDLL: _searchenv\n"));
3289 char *env = CRTDLL_getenv(var);
3290
3291 char *x;
3292 char *y;
3293 char *FilePart;
3294 x = strchr(env,'=');
3295 if ( x != NULL ) {
3296 *x = 0;
3297 x++;
3298 }
3299 y = strchr(env,';');
3300 while ( y != NULL ) {
3301 *y = 0;
3302 if ( SearchPathA(x,file,NULL,MAX_PATH,path,&FilePart) > 0 ) {
3303 return;
3304 }
3305 x = y+1;
3306 y = strchr(env,';');
3307 }
3308 return;
3309}
3310
3311
3312/*********************************************************************
3313 * CRTDLL__seterrormode (CRTDLL.261)
3314 */
3315void CDECL CRTDLL__seterrormode(int i)
3316{
3317 dprintf(("CRTDLL: _seterrormode\n"));
3318 SetErrorMode(i);
3319 return;
3320}
3321
3322
3323/*********************************************************************
3324 * CRTDLL__setjmp (CRTDLL.262)
3325 */
3326int CDECL CRTDLL__setjmp( jmp_buf env )
3327{
3328 dprintf(("CRTDLL: _setjmp -> setjmp\n"));
3329 return(setjmp( env));
3330}
3331
3332
3333/*********************************************************************
3334 * _setmode (CRTDLL.263)
3335 */
3336INT CDECL CRTDLL__setmode( INT fh,INT mode)
3337{
3338 dprintf(("CRTDLL: _setmode\n"));
3339 return (_setmode(fh, mode));
3340}
3341
3342
3343/*********************************************************************
3344 * _setsystime (CRTDLL.264)
3345 */
3346unsigned int CDECL CRTDLL__setsystime(struct tm *tp, unsigned int ms)
3347{
3348 dprintf(("CRTDLL: _setsystime not implemented.\n"));
3349 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
3350 return FALSE;
3351}
3352
3353
3354/*********************************************************************
3355 * _sleep (CRTDLL.265)
3356 */
3357VOID CDECL CRTDLL__sleep(unsigned long timeout)
3358{
3359 dprintf(("CRTDLL__sleep for %ld milliseconds\n",timeout));
3360 Sleep((timeout)?timeout:1);
3361}
3362
3363
3364/*********************************************************************
3365 * _sopen (CRTDLL.268)
3366 */
3367int CDECL CRTDLL__sopen( const char *s, int i1, int i2, ... )
3368{
3369 dprintf(("CRTDLL: _sopen not implemented.\n"));
3370 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
3371 return FALSE;
3372}
3373
3374
3375/*********************************************************************
3376 * CRTDLL__spawnl (CRTDLL.269)
3377 */
3378int CDECL CRTDLL__spawnl( int i, char *s1, char *s2, ... )
3379{
3380 dprintf(("CRTDLL: _spawnl not implemented.\n"));
3381 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
3382 return FALSE;
3383}
3384
3385
3386/*********************************************************************
3387 * CRTDLL__spawnle (CRTDLL.270)
3388 */
3389int CDECL CRTDLL__spawnle( int i, char *s1, char *s2, ... )
3390{
3391 dprintf(("CRTDLL: _spawnle not implemented.\n"));
3392 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
3393 return FALSE;
3394}
3395
3396
3397/*********************************************************************
3398 * CRTDLL__spawnlp (CRTDLL.271)
3399 */
3400int CDECL CRTDLL__spawnlp( int i, char *s1, char *s2, ... )
3401{
3402 dprintf(("CRTDLL: _spawnlp not implemented.\n"));
3403 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
3404 return FALSE;
3405}
3406
3407
3408/*********************************************************************
3409 * CRTDLL__spawnlpe (CRTDLL.272)
3410 */
3411int CDECL CRTDLL__spawnlpe( int i, char *s1, char *s2, ... )
3412{
3413 dprintf(("CRTDLL: _spawnlpe not implemented.\n"));
3414 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
3415 return FALSE;
3416}
3417
3418
3419/*********************************************************************
3420 * CRTDLL__spawnv (CRTDLL.273)
3421 */
3422int CDECL CRTDLL__spawnv( int i, char *s1, char ** s2 )
3423{
3424 dprintf(("CRTDLL: _spawnv\n"));
3425 return (_spawnv(i, s1, s2));
3426}
3427
3428
3429/*********************************************************************
3430 * CRTDLL__spawnve (CRTDLL.274)
3431 */
3432int CDECL CRTDLL__spawnve( int i, char *s1, char ** s2, char ** s3 )
3433{
3434 dprintf(("CRTDLL: _spawnve\n"));
3435 return (_spawnve(i, s1, s2, s3));
3436}
3437
3438
3439/*********************************************************************
3440 * CRTDLL__spawnvp (CRTDLL.275)
3441 */
3442int CDECL CRTDLL__spawnvp( int i, char *s1, char ** s2 )
3443{
3444 dprintf(("CRTDLL: _spawnvp\n"));
3445 return (_spawnvp(i, s1, s2));
3446}
3447
3448/*********************************************************************
3449 * CRTDLL__spawnv (CRTDLL.276)
3450 */
3451int CDECL CRTDLL__spawnvpe( int i, char *s1, char ** s2, char ** s3 )
3452{
3453 dprintf(("CRTDLL: _spawnvpe\n"));
3454 return (_spawnvpe(i, s1, s2, s3));
3455}
3456
3457
3458/*********************************************************************
3459 * CRTDLL__stat (CRTDLL.278)
3460 */
3461int CDECL CRTDLL__stat( const char *s1, struct stat * n )
3462{
3463 dprintf(("CRTDLL: _stat\n"));
3464 return(_stat(s1, n));
3465}
3466
3467
3468/*********************************************************************
3469 * CRTDLL__statusfp (CRTDLL.279)
3470 */
3471unsigned int CDECL CRTDLL__statusfp( void )
3472{
3473 dprintf(("CRTDLL: _statusfp\n"));
3474 return (_status87());
3475}
3476
3477
3478/*********************************************************************
3479 * CRTDLL__strdate (CRTDLL.281)
3480 */
3481char * CDECL CRTDLL__strdate( char *buf )
3482{
3483 dprintf(("CRTDLL: _strdate\n"));
3484 return(_strdate(buf));
3485}
3486
3487
3488/*********************************************************************
3489 * CRTDLL__strdec (CRTDLL.282)
3490 */
3491char * CDECL CRTDLL__strdec( const char *, const char *p )
3492{
3493 dprintf(("CRTDLL: _strdec\n"));
3494 return( (char *)(p-1) );
3495}
3496
3497
3498/*********************************************************************
3499 * CRTDLL__strdup (CRTDLL.283)
3500 */
3501LPSTR CDECL CRTDLL__strdup(LPCSTR ptr)
3502{
3503 dprintf(("CRTDLL: _strdup\n"));
3504 return HEAP_strdupA(GetProcessHeap(),0,ptr);
3505}
3506
3507
3508/*********************************************************************
3509 * _strerror (CRTDLL.284)
3510 */
3511char * CDECL CRTDLL__strerror(const char *s)
3512{
3513 dprintf(("CRTDLL: _strerror not implemented\n"));
3514 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
3515 return FALSE;
3516// return (_strerror(s));
3517}
3518
3519
3520/*********************************************************************
3521 * CRTDLL__stricoll (CRTDLL.286)
3522 */
3523int CDECL CRTDLL__stricoll( const char *s1, const char *s2 )
3524{
3525 dprintf(("CRTDLL: _stricoll\n"));
3526 return stricmp(s1,s2);
3527}
3528
3529
3530/*********************************************************************
3531 * CRTDLL__strinc (CRTDLL.287)
3532 */
3533char * CDECL CRTDLL__strinc( const char *p )
3534{
3535 dprintf(("CRTDLL: _strinc\n"));
3536 return( (char *)(p+1) );
3537}
3538
3539
3540/*********************************************************************
3541 * CRTDLL__strncnt (CRTDLL.289)
3542 */
3543size_t CDECL CRTDLL__strncnt( const char *p, size_t l )
3544{
3545 dprintf(("CRTDLL: _strncnt\n"));
3546 size_t i;
3547 i = strlen(p);
3548 return( (i>l) ? l : i );
3549}
3550
3551/*********************************************************************
3552 * CRTDLL__strnextc (CRTDLL.290)
3553 */
3554unsigned int CDECL CRTDLL__strnextc( const char *p )
3555{
3556 dprintf(("CRTDLL: _strnextc\n"));
3557 return( (unsigned int)*p );
3558}
3559
3560
3561/*********************************************************************
3562 * CRTDLL__strninc (CRTDLL.292)
3563 */
3564char * CDECL CRTDLL__strninc( const char *p, size_t l )
3565{
3566 dprintf(("CRTDLL: _strninc\n"));
3567 return( (char *)(p+l) );
3568}
3569
3570
3571/*********************************************************************
3572 * CRTDLL__strnset (CRTDLL.293)
3573 */
3574char * CDECL CRTDLL__strnset(char* szToFill, int szFill, size_t sizeMaxFill)
3575{
3576 dprintf(("CRTDLL: _strnset\n"));
3577 char *t = szToFill;
3578 int i = 0;
3579 while( *szToFill != 0 && i < sizeMaxFill)
3580 {
3581 *szToFill = szFill;
3582 szToFill++;
3583 i++;
3584 }
3585 return t;
3586}
3587
3588
3589/*********************************************************************
3590 * CRTDLL__strrev (CRTDLL.294)
3591 */
3592char * CDECL CRTDLL__strrev( char *s )
3593{
3594 dprintf(("CRTDLL: _strrev\n"));
3595 char *e;
3596 char a;
3597 e=s;
3598 while (*e)
3599 e++;
3600 while (s<e) {
3601 a=*s;
3602 *s=*e;
3603 *e=a;
3604 s++;
3605 e--;
3606 }
3607 return s;
3608}
3609
3610
3611/*********************************************************************
3612 * CRTDLL__strset (CRTDLL.295)
3613 */
3614char * CDECL CRTDLL__strset(char* szToFill, int szFill)
3615{
3616 dprintf(("CRTDLL: _strset\n"));
3617 char *t = szToFill;
3618 while( *szToFill != 0 )
3619 {
3620 *szToFill = szFill;
3621 szToFill++;
3622 }
3623 return t;
3624}
3625
3626
3627/*********************************************************************
3628 * CRTDLL__strspnp (CRTDLL.296)
3629 */
3630char * CDECL CRTDLL__strspnp( const char *p1, const char *p2 )
3631{
3632 dprintf(("CRTDLL: _strspnp\n"));
3633 return( (*(p1 += strspn(p1,p2))!='\0') ? (char*)p1 : NULL );
3634}
3635
3636
3637/*********************************************************************
3638 * CRTDLL__strtime (CRTDLL.297)
3639 */
3640char * CDECL CRTDLL__strtime( char *buf )
3641{
3642 dprintf(("CRTDLL: _strtime\n"));
3643 return (_strtime(buf));
3644}
3645
3646
3647/*********************************************************************
3648 * CRTDLL__swab (CRTDLL.299)
3649 */
3650void CDECL CRTDLL__swab(char *s1, char *s2, int i)
3651{
3652 dprintf(("CRTDLL: _swab\n"));
3653 _swab(s1, s2, i);
3654}
3655
3656
3657/*********************************************************************
3658 * CRTDLL__tell (CRTDLL.302)
3659 */
3660long CDECL CRTDLL__tell( int i )
3661{
3662 dprintf(("CRTDLL: _tell\n"));
3663 return (_tell(i));
3664}
3665
3666
3667/*********************************************************************
3668 * CRTDLL__tempnam (CRTDLL.303)
3669 */
3670char * CDECL CRTDLL__tempnam( char *dir, char *prefix )
3671{
3672 dprintf(("CRTDLL: _tempnam\n"));
3673 return (_tempnam(dir, prefix));
3674}
3675
3676
3677/*********************************************************************
3678 * CRTDLL__tolower (CRTDLL.305)
3679 */
3680int CDECL CRTDLL__tolower(int n)
3681{
3682 dprintf(("CRTDLL: _tolower\n"));
3683 return (_tolower(n));
3684}
3685
3686
3687/*********************************************************************
3688 * CRTDLL__toupper (CRTDLL.306)
3689 */
3690int CDECL CRTDLL__toupper(int n)
3691{
3692 dprintf(("CRTDLL: _toupper\n"));
3693 return (_toupper(n));
3694}
3695
3696
3697/*********************************************************************
3698 * _tzset (CRTDLL.308)
3699 */
3700void CDECL CRTDLL__tzset( void )
3701{
3702 dprintf(("CRTDLL: _tzset not implemented.\n"));
3703 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
3704}
3705
3706
3707/*********************************************************************
3708 * CRTDLL__umask (CRTDLL.310)
3709 */
3710int CDECL CRTDLL__umask( int i )
3711{
3712 dprintf(("CRTDLL: _umask\n"));
3713 return (_umask(i));
3714}
3715
3716
3717/*********************************************************************
3718 * CRTDLL__ungetch (CRTDLL.311)
3719 */
3720int CDECL CRTDLL__ungetch( int i )
3721{
3722 dprintf(("CRTDLL: _ungetch\n"));
3723 return (_ungetch(i));
3724}
3725
3726
3727/*********************************************************************
3728 * _unlink (CRTDLL.312)
3729 */
3730INT CDECL CRTDLL__unlink(LPCSTR pathname)
3731{
3732 dprintf(("CRTDLL: _unlink\n"));
3733 int ret=0;
3734 DOS_FULL_NAME full_name;
3735
3736 if (!DOSFS_GetFullName( pathname, FALSE, (CHAR*)&full_name )) {
3737 dprintf(("CRTDLL_unlink file %s bad name\n",pathname));
3738 return EOF;
3739 }
3740
3741 ret=unlink(full_name.long_name);
3742 dprintf(("(%s unix %s)\n",
3743 pathname,full_name.long_name));
3744 if(ret)
3745 dprintf((" Failed!\n"));
3746
3747 return ret;
3748}
3749
3750
3751/*********************************************************************
3752 * CRTDLL__unloaddll (CRTDLL.313)
3753 */
3754int CDECL CRTDLL__unloaddll(void *handle)
3755{
3756 dprintf(("CRTDLL: _unloaddll not implemented.\n"));
3757 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
3758 return FALSE;
3759}
3760
3761
3762/*********************************************************************
3763 * CRTDLL__utime (CRTDLL.314)
3764 */
3765int CDECL CRTDLL__utime( char *path, struct utimbuf * times )
3766{
3767 dprintf(("CRTDLL: _utime\n"));
3768 return (_utime(path, times));
3769}
3770
3771
3772/*********************************************************************
3773 * CRTDLL__vsnwprintf (CRTDLL.316)
3774 */
3775int CDECL CRTDLL__vsnwprintf( wchar_t *s1, size_t n, const wchar_t *s2, va_list arg )
3776{
3777 dprintf(("CRTDLL: _vsnwprintf not implemented.\n"));
3778 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
3779 return FALSE;
3780}
3781
3782
3783/*********************************************************************
3784 * CRTDLL__wcsdup (CRTDLL.317)
3785 */
3786LPWSTR CDECL CRTDLL__wcsdup( LPCWSTR str )
3787{
3788 dprintf(("CRTDLL: _wcsdup\n"));
3789 LPWSTR ret = NULL;
3790 if (str)
3791 {
3792 int size = (wcslen((const wchar_t*)str) + 1) * sizeof(WCHAR);
3793// FIXME ret = CRTDLL_malloc( size );
3794 if (ret) memcpy( ret, str, size );
3795 }
3796 return ret;
3797}
3798
3799
3800/*********************************************************************
3801 * CRTDLL__wcsicoll (CRTDLL.319)
3802 */
3803int CDECL CRTDLL__wcsicoll( LPCWSTR str1, LPCWSTR str2 )
3804{
3805 dprintf(("CRTDLL: _wcsicoll\n"));
3806 return NTDLL__wcsicmp( str1, str2 );
3807}
3808
3809
3810/*********************************************************************
3811 * CRTDLL__wcsnset (CRTDLL.322)
3812 */
3813LPWSTR CDECL CRTDLL__wcsnset( LPWSTR str, WCHAR c, INT n )
3814{
3815 dprintf(("CRTDLL: _wcsnset\n"));
3816 LPWSTR ret = str;
3817 while ((n-- > 0) && *str) *str++ = c;
3818 return ret;
3819}
3820
3821
3822/*********************************************************************
3823 * CRTDLL__wcsrev (CRTDLL.323)
3824 */
3825LPWSTR CDECL CRTDLL__wcsrev( LPWSTR str )
3826{
3827 dprintf(("CRTDLL: _wcsrev\n"));
3828 LPWSTR ret = str;
3829 LPWSTR end = str + wcslen((const wchar_t*)str) - 1;
3830 while (end > str)
3831 {
3832 WCHAR t = *end;
3833 *end-- = *str;
3834 *str++ = t;
3835 }
3836 return ret;
3837}
3838
3839
3840/*********************************************************************
3841 * CRTDLL__wcsset (CRTDLL.324)
3842 */
3843LPWSTR CDECL CRTDLL__wcsset( LPWSTR str, WCHAR c )
3844{
3845 dprintf(("CRTDLL: _wcsset\n"));
3846 LPWSTR ret = str;
3847 while (*str) *str++ = c;
3848 return ret;
3849}
3850
3851
3852/*********************************************************************
3853 * _write (CRTDLL.329)
3854 */
3855INT CDECL CRTDLL__write(INT fd,LPCVOID buf,UINT count)
3856{
3857 dprintf(("CRTDLL: _write\n"));
3858 INT len=0;
3859
3860 if (fd == -1)
3861 len = -1;
3862 else if (fd<=2)
3863 len = (UINT)write(fd,buf,(LONG)count);
3864 else
3865 len = _lwrite(fd,(LPCSTR)buf,count);
3866 dprintf(("%d/%d byte to dfh %d from %p,\n",
3867 len,count,fd,buf));
3868 return len;
3869}
3870
3871
3872/*********************************************************************
3873 * _y0 (CRTDLL.332)
3874 */
3875double CDECL CRTDLL__y0(double x)
3876{
3877 dprintf(("CRTDLL: _y0\n"));
3878 return (_y0(x));
3879}
3880
3881
3882/*********************************************************************
3883 * _y1 (CRTDLL.333)
3884 */
3885double CDECL CRTDLL__y1(double x)
3886{
3887 dprintf(("CRTDLL: _y1\n"));
3888 return (_y1(x));
3889}
3890
3891
3892/*********************************************************************
3893 * _yn (CRTDLL.334)
3894 */
3895double CDECL CRTDLL__yn(int i, double x)
3896{
3897 dprintf(("CRTDLL: _yn\n"));
3898 return (_yn(i, x));
3899}
3900
3901
3902/*********************************************************************
3903 * isleadbyte (CRTDLL.335)
3904 */
3905void CDECL CRTDLL_abort( void )
3906{
3907 dprintf(("CRTDLL: abort\n"));
3908 abort();
3909}
3910
3911
3912/*********************************************************************
3913 * acos (CRTDLL.336)
3914 */
3915double CDECL CRTDLL_acos( double x )
3916{
3917 dprintf(("CRTDLL: acos\n"));
3918 return (acos(x));
3919}
3920
3921
3922/*********************************************************************
3923 * asctime (CRTDLL.338)
3924 */
3925char * CDECL CRTDLL_asctime( const struct tm *timeptr )
3926{
3927 dprintf(("CRTDLL: asctime\n"));
3928 return (asctime(timeptr));
3929}
3930
3931
3932/*********************************************************************
3933 * asin (CRTDLL.339)
3934 */
3935double CDECL CRTDLL_asin( double x )
3936{
3937 dprintf(("CRTDLL: asin\n"));
3938 return (asin(x));
3939}
3940
3941
3942/*********************************************************************
3943 * atan2 (CRTDLL.341)
3944 */
3945double CDECL CRTDLL_atan2( double y, double x )
3946{
3947 dprintf(("CRTDLL: atan2\n"));
3948 return (atan2(y, x));
3949}
3950
3951
3952/*********************************************************************
3953 * atexit (CRTDLL.342)
3954 */
3955int CDECL CRTDLL_atexit( register void ( *func )( void ) )
3956{
3957 dprintf(("CRTDLL: atexit not implemented.\n"));
3958 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
3959 return FALSE;
3960}
3961
3962
3963/*********************************************************************
3964 * atof (CRTDLL.343)
3965 */
3966double CDECL CRTDLL_atof( const char *nptr )
3967{
3968 dprintf(("CRTDLL: atof\n"));
3969 return (atof(nptr));
3970}
3971
3972
3973/*********************************************************************
3974 * bsearch (CRTDLL.346)
3975 */
3976void * CDECL CRTDLL_bsearch( const void *key, const void *base0, size_t nelem,
3977 size_t size, int (*cmp)(const void *ck, const void *ce))
3978{
3979 dprintf(("CRTDLL: bsearch\n"));
3980 char *base = (char *)base0;
3981 int lim, cmpval;
3982 void *p;
3983
3984 for (lim = nelem; lim != 0; lim >>= 1)
3985 {
3986 p = base + (lim >> 1) * size;
3987 cmpval = (*cmp)(key, p);
3988 if (cmpval == 0)
3989 return p;
3990 if (cmpval > 0)
3991 { /* key > p: move right */
3992 base = (char *)p + size;
3993 lim--;
3994 } /* else move left */
3995 }
3996 return 0;
3997}
3998
3999
4000/*********************************************************************
4001 * calloc (CRTDLL.347)
4002 */
4003void * CDECL CRTDLL_calloc( size_t n, size_t size )
4004{
4005 dprintf(("CRTDLL: calloc\n"));
4006 return (calloc(n, size));
4007}
4008
4009
4010/*********************************************************************
4011 * clearerr (CRTDLL.349)
4012 */
4013void CDECL CRTDLL_clearerr( FILE *fp )
4014{
4015 dprintf(("CRTDLL: clearerr\n"));
4016 clearerr(fp);
4017}
4018
4019
4020/*********************************************************************
4021 * clock (CRTDLL.350)
4022 */
4023clock_t CDECL CRTDLL_clock( void )
4024{
4025 dprintf(("CRTDLL: clock\n"));
4026 return (clock());
4027}
4028
4029
4030/*********************************************************************
4031 * cosh (CRTDLL.352)
4032 */
4033double CDECL CRTDLL_cosh( double x )
4034{
4035 dprintf(("CRTDLL: cosh\n"));
4036 return (cosh(x));
4037}
4038
4039
4040/*********************************************************************
4041 * ctime (CRTDLL.353)
4042 */
4043char * CDECL CRTDLL_ctime( const time_t *timer )
4044{
4045 dprintf(("CRTDLL: ctime\n"));
4046 return (ctime(timer));
4047}
4048
4049
4050/*********************************************************************
4051 * difftime (CRTDLL.354)
4052 */
4053double CDECL CRTDLL_difftime( time_t t1, time_t t0 )
4054{
4055 dprintf(("CRTDLL: difftime\n"));
4056 return (difftime(t1, t0));
4057}
4058
4059
4060/*********************************************************************
4061 * div (CRTDLL.355)
4062 */
4063div_t CDECL CRTDLL_div( int numer, int denom )
4064{
4065 dprintf(("CRTDLL: div\n"));
4066 return (div(numer, denom));
4067}
4068
4069
4070/*********************************************************************
4071 * exit (CRTDLL.356)
4072 */
4073void CDECL CRTDLL_exit(DWORD ret)
4074{
4075 dprintf(("CRTDLL: exit\n"));
4076 ExitProcess(ret);
4077}
4078
4079
4080/*********************************************************************
4081 * exp (CRTDLL.357)
4082 */
4083double CDECL CRTDLL_exp( double x )
4084{
4085 dprintf(("CRTDLL: exp\n"));
4086 return (exp(x));
4087}
4088
4089
4090/*********************************************************************
4091 * fclose (CRTDLL.359)
4092 */
4093int CDECL CRTDLL_fclose( FILE *fp )
4094{
4095 dprintf(("CRTDLL: fclose\n"));
4096 return (fclose(fp));
4097}
4098
4099
4100/*********************************************************************
4101 * feof (CRTDLL.360)
4102 */
4103int CDECL CRTDLL_feof( FILE *fp )
4104{
4105 dprintf(("CRTDLL: feof\n"));
4106 return (feof(fp));
4107}
4108
4109
4110/*********************************************************************
4111 * ferror (CRTDLL.361)
4112 */
4113int CDECL CRTDLL_ferror( FILE *fp )
4114{
4115 dprintf(("CRTDLL: ferror\n"));
4116 return (ferror(fp));
4117}
4118
4119
4120/*********************************************************************
4121 * fflush (CRTDLL.362)
4122 */
4123int CDECL CRTDLL_fflush( FILE *fp )
4124{
4125 dprintf(("CRTDLL: fflush\n"));
4126 return (fflush(fp));
4127}
4128
4129
4130/*********************************************************************
4131 * fgetc (CRTDLL.363)
4132 */
4133int CDECL CRTDLL_fgetc( FILE *fp )
4134{
4135 dprintf(("CRTDLL: fgetc\n"));
4136 return (fgetc(fp));
4137}
4138
4139
4140/*********************************************************************
4141 * fgetpos (CRTDLL.364)
4142 */
4143int CDECL CRTDLL_fgetpos( FILE *fp, fpos_t *pos )
4144{
4145 dprintf(("CRTDLL: fgetpos\n"));
4146 return (fgetpos(fp, pos));
4147}
4148
4149
4150/*********************************************************************
4151 * fgets (CRTDLL.365)
4152 */
4153char * CDECL CRTDLL_fgets( char *s, int n, FILE *fp )
4154{
4155 dprintf(("CRTDLL: fgets\n"));
4156 return (fgets(s, n, fp));
4157}
4158
4159
4160/*********************************************************************
4161 * fgetwc (CRTDLL.366)
4162 */
4163wint_t CDECL CRTDLL_fgetwc( FILE *f )
4164{
4165 dprintf(("CRTDLL: fgetwc\n"));
4166 return (fgetwc(f));
4167}
4168
4169
4170/*********************************************************************
4171 * fmod (CRTDLL.368)
4172 */
4173double CDECL CRTDLL_fmod(double x, double y )
4174{
4175 dprintf(("CRTDLL: fmod\n"));
4176 return (fmod(x,y));
4177}
4178
4179
4180/*********************************************************************
4181 * fopen (CRTDLL.369)
4182 */
4183FILE * CDECL CRTDLL_fopen( const char *filename, const char *mode )
4184{
4185 dprintf(("CRTDLL: fopen\n"));
4186 return (fopen( filename, mode));
4187}
4188
4189
4190/*********************************************************************
4191 * fprintf (CRTDLL.370)
4192 */
4193INT CDECL CRTDLL_fprintf( CRTDLL_FILE *file, LPSTR format, ... )
4194{
4195 dprintf(("CRTDLL: fprintf\n"));
4196 va_list valist;
4197 INT res;
4198
4199 va_start( valist, format );
4200 res = CRTDLL_vfprintf( file, format, valist );
4201 va_end( valist );
4202 return res;
4203}
4204
4205
4206/*********************************************************************
4207 * fputc (CRTDLL.371)
4208 */
4209int CDECL CRTDLL_fputc( int c, FILE *fp )
4210{
4211 dprintf(("CRTDLL: fputc\n"));
4212 return (fputc(c, fp));
4213}
4214
4215
4216/*********************************************************************
4217 * fputs (CRTDLL.372)
4218 */
4219int CDECL CRTDLL_fputs( const char *s, FILE *fp )
4220{
4221 dprintf(("CRTDLL: fputs\n"));
4222 return (fputs(s, fp));
4223}
4224
4225
4226/*********************************************************************
4227 * fputwc (CRTDLL.373)
4228 */
4229wint_t CDECL CRTDLL_fputwc( wint_t wc, FILE *strm )
4230{
4231 dprintf(("CRTDLL: fputwc\n"));
4232 return (fputwc(wc, strm));
4233}
4234
4235
4236/*********************************************************************
4237 * fread (CRTDLL.374)
4238 */
4239size_t CDECL CRTDLL_fread( void *ptr, size_t size, size_t n, FILE *fp )
4240{
4241 dprintf(("CRTDLL: fread\n"));
4242 return (fread(ptr, size, n, fp));
4243}
4244
4245
4246/*********************************************************************
4247 * free (CRTDLL.375)
4248 */
4249VOID CDECL CRTDLL_free(LPVOID ptr)
4250{
4251 dprintf(("CRTDLL: free\n"));
4252 HeapFree(GetProcessHeap(),0,ptr);
4253}
4254
4255
4256/*********************************************************************
4257 * freopen (CRTDLL.376)
4258 */
4259FILE * CDECL CRTDLL_freopen( const char *filename, const char *mode, FILE *fp )
4260{
4261 dprintf(("CRTDLL: freopen\n"));
4262 return (freopen(filename, mode, fp));
4263}
4264
4265
4266/*********************************************************************
4267 * frexp (CRTDLL.377)
4268 */
4269double CDECL CRTDLL_frexp( double value, int *exp )
4270{
4271 dprintf(("CRTDLL: frexp\n"));
4272 return (frexp(value, exp));
4273}
4274
4275
4276/*********************************************************************
4277 * fscanf (CRTDLL.378)
4278 */
4279int CDECL CRTDLL_fscanf( FILE*fp, const char *format, ... )
4280{
4281 dprintf(("CRTDLL: fscanf\n"));
4282#if 0
4283 va_list valist;
4284 INT res;
4285
4286 va_start( valist, format );
4287#ifdef HAVE_VFSCANF
4288 res = vfscanf( xlat_file_ptr(stream), format, valist );
4289#endif
4290 va_end( valist );
4291 return res;
4292#endif
4293 dprintf(("broken\n"));
4294 return 0;
4295}
4296
4297
4298/*********************************************************************
4299 * fseek (CRTDLL.379)
4300 */
4301int CDECL CRTDLL_fseek( FILE *file, long int offset, int whence )
4302{
4303 dprintf(("CRTDLL: fseek\n"));
4304 dprintf(("file %p to 0x%08lx pos %s\n",
4305 file,offset,(whence==SEEK_SET)?"SEEK_SET":
4306 (whence==SEEK_CUR)?"SEEK_CUR":
4307 (whence==SEEK_END)?"SEEK_END":"UNKNOWN"));
4308// FIXME if (SetFilePointer( file->handle, offset, NULL, whence ) != 0xffffffff)
4309// FIXME return 0;
4310 dprintf((" failed!\n"));
4311 return -1;
4312}
4313
4314
4315/*********************************************************************
4316 * fsetpos (CRTDLL.380)
4317 */
4318int CDECL CRTDLL_fsetpos( FILE *fp, const fpos_t *pos )
4319{
4320 dprintf(("CRTDLL: fsetpos\n"));
4321 return (fsetpos(fp, pos));
4322}
4323
4324
4325/*********************************************************************
4326 * ftell (CRTDLL.381)
4327 */
4328long int CDECL CRTDLL_ftell( FILE *fp )
4329{
4330 dprintf(("CRTDLL: ftell\n"));
4331 return (ftell(fp));
4332}
4333
4334
4335/*********************************************************************
4336 * fwprintf (CRTDLL.382)
4337 */
4338int CDECL CRTDLL_fwprintf( FILE *strm, const wchar_t *format, ... )
4339{
4340 dprintf(("CRTDLL: fwprintf not implemented.\n"));
4341 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
4342 return FALSE;
4343}
4344
4345
4346/*********************************************************************
4347 * fwrite (CRTDLL.383)
4348 */
4349DWORD CDECL CRTDLL_fwrite( LPVOID ptr, INT size, INT nmemb, CRTDLL_FILE *file )
4350{
4351 DWORD ret;
4352
4353 dprintf(("CRTDLL: fwrite\n"));
4354 if (!WriteFile( file->handle, ptr, size * nmemb, &ret, NULL ))
4355 dprintf((" failed!\n"));
4356
4357 return ret / size;
4358}
4359
4360
4361/*********************************************************************
4362 * fwscanf (CRTDLL.384)
4363 */
4364int CDECL CRTDLL_fwscanf( FILE *strm, const wchar_t *format, ... )
4365{
4366 dprintf(("CRTDLL: fwscanf not implemented.\n"));
4367 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
4368 return FALSE;
4369}
4370
4371
4372/*********************************************************************
4373 * getc (CRTDLL.385)
4374 */
4375int CDECL CRTDLL_getc( FILE *fp )
4376{
4377 dprintf(("CRTDLL: getc\n"));
4378 return (getc(fp));
4379}
4380
4381
4382/*********************************************************************
4383 * getchar (CRTDLL.386)
4384 */
4385int CDECL CRTDLL_getchar( void )
4386{
4387 dprintf(("CRTDLL: getchar\n"));
4388 return (getchar());
4389}
4390
4391
4392/*********************************************************************
4393 * getenv (CRTDLL.387)
4394 */
4395char * CDECL CRTDLL_getenv( const char *name )
4396{
4397 dprintf(("CRTDLL: getenv\n"));
4398 return (getenv(name));
4399}
4400
4401
4402/*********************************************************************
4403 * gets (CRTDLL.388)
4404 */
4405char * CDECL CRTDLL_gets( char *s )
4406{
4407 dprintf(("CRTDLL: gets\n"));
4408 return (gets(s));
4409}
4410
4411
4412/*********************************************************************
4413 * gmtime (CRTDLL.389)
4414 */
4415struct tm * CDECL CRTDLL_gmtime( const time_t *timer )
4416{
4417 dprintf(("CRTDLL: gmtime\n"));
4418 return (gmtime(timer));
4419}
4420
4421
4422/*********************************************************************
4423 * is_wctype (CRTDLL.390)
4424 */
4425INT CDECL CRTDLL_is_wctype(wint_t wc, wctype_t wctypeFlags)
4426{
4427 dprintf(("CRTDLL: is_wctype not implemented.\n"));
4428 return 0;
4429}
4430
4431
4432/*********************************************************************
4433 * isalnum (CRTDLL.391)
4434 */
4435int CDECL CRTDLL_isalnum(int i)
4436{
4437 dprintf(("CRTDLL: isalnum(%08xh)\n", i));
4438 return (isalnum(i));
4439}
4440
4441
4442/*********************************************************************
4443 * iscntrl (CRTDLL.393)
4444 */
4445int CDECL CRTDLL_iscntrl(int i)
4446{
4447 dprintf(("CRTDLL: iscntrl(%08xh)\n", i));
4448 return (iscntrl(i));
4449}
4450
4451
4452/*********************************************************************
4453 * isgraph (CRTDLL.395)
4454 */
4455int CDECL CRTDLL_isgraph(int i)
4456{
4457 dprintf(("CRTDLL: isgraph(%08xh)\n", i));
4458 return (isgraph(i));
4459}
4460
4461
4462/*********************************************************************
4463 * isleadbyte (CRTDLL.396)
4464 */
4465int CDECL CRTDLL_isleadbyte(int i)
4466{
4467 dprintf(("CRTDLL: isleadbyte(%08xh) not implemented.\n", i));
4468 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
4469 return FALSE;
4470}
4471
4472
4473/*********************************************************************
4474 * ispunct (CRTDLL.399)
4475 */
4476int CDECL CRTDLL_ispunct(int i)
4477{
4478 dprintf(("CRTDLL: ispunct(%08xh)\n", i));
4479 return (ispunct(i));
4480}
4481
4482
4483/*********************************************************************
4484 * iswalnum (CRTDLL.402)
4485 */
4486int CDECL CRTDLL_iswalnum(wint_t i)
4487{
4488 dprintf(("CRTDLL: iswalnum(%08xh)\n", i));
4489 return (iswalnum(i));
4490}
4491
4492
4493/*********************************************************************
4494 * iswascii (CRTDLL.404)
4495 */
4496int CDECL CRTDLL_iswascii(wint_t c)
4497{
4498 dprintf(("CRTDLL: iswascii\n", c));
4499 return (!((c)&(~0x7f)));
4500}
4501
4502
4503/*********************************************************************
4504 * iswcntrl (CRTDLL.405)
4505 */
4506int CDECL CRTDLL_iswcntrl(wint_t i)
4507{
4508 dprintf(("CRTDLL: iswcntrl(%08xh)\n", i));
4509 return (iswcntrl(i));
4510}
4511
4512
4513/*********************************************************************
4514 * iswdigit (CRTDLL.407)
4515 */
4516int CDECL CRTDLL_iswdigit(wint_t i)
4517{
4518 dprintf(("CRTDLL: iswdigit(%08xh)\n", i));
4519 return (iswdigit(i));
4520}
4521
4522
4523/*********************************************************************
4524 * iswgraph (CRTDLL.408)
4525 */
4526int CDECL CRTDLL_iswgraph(wint_t i)
4527{
4528 dprintf(("CRTDLL: iswgraph(%08xh)\n", i));
4529 return (iswgraph(i));
4530}
4531
4532
4533/*********************************************************************
4534 * iswlower (CRTDLL.409)
4535 */
4536int CDECL CRTDLL_iswlower(wint_t i)
4537{
4538 dprintf(("CRTDLL: iswlower(%08xh)\n", i));
4539 return (iswlower(i));
4540}
4541
4542
4543/*********************************************************************
4544 * iswprint (CRTDLL.410)
4545 */
4546int CDECL CRTDLL_iswprint(wint_t i)
4547{
4548 dprintf(("CRTDLL: iswprint(%08xh)\n", i));
4549 return (iswprint(i));
4550}
4551
4552
4553/*********************************************************************
4554 * iswpunct (CRTDLL.411)
4555 */
4556int CDECL CRTDLL_iswpunct(wint_t i)
4557{
4558 dprintf(("CRTDLL: iswpunct(%08xh)\n", i));
4559 return (iswpunct(i));
4560}
4561
4562
4563/*********************************************************************
4564 * iswspace (CRTDLL.412)
4565 */
4566int CDECL CRTDLL_iswspace(wint_t i)
4567{
4568 dprintf(("CRTDLL: iswspace(%08xh)\n", i));
4569 return (iswspace(i));
4570}
4571
4572
4573/*********************************************************************
4574 * iswupper (CRTDLL.413)
4575 */
4576int CDECL CRTDLL_iswupper(wint_t i)
4577{
4578 dprintf(("CRTDLL: iswupper(%08xh)\n", i));
4579 return (iswupper(i));
4580}
4581
4582
4583/*********************************************************************
4584 * iswxdigit (CRTDLL.414)
4585 */
4586int CDECL CRTDLL_iswxdigit(wint_t i)
4587{
4588 dprintf(("CRTDLL: iswxdigit(%08xh)\n", i));
4589 return (iswxdigit(i));
4590}
4591
4592
4593/*********************************************************************
4594 * ldexp (CRTDLL.417)
4595 */
4596double CDECL CRTDLL_ldexp( double x, int exp )
4597{
4598 dprintf(("CRTDLL: ldexp\n"));
4599 return (ldexp(x, exp));
4600}
4601
4602
4603/*********************************************************************
4604 * ldiv (CRTDLL.418)
4605 */
4606ldiv_t CDECL CRTDLL_ldiv( long int numer, long int denom )
4607{
4608 dprintf(("CRTDLL: ldiv\n"));
4609 return (ldiv(numer, denom));
4610}
4611
4612
4613/*********************************************************************
4614 * localeconv (CRTDLL.419)
4615 */
4616struct lconv * CDECL CRTDLL_localeconv(void)
4617{
4618 dprintf(("CRTDLL: localeconv\n"));
4619 return (localeconv());
4620}
4621
4622
4623/*********************************************************************
4624 * localtime (CRTDLL.420)
4625 */
4626struct tm * CDECL CRTDLL_localtime( const time_t *timer )
4627{
4628 dprintf(("CRTDLL: localtime\n"));
4629 return (localtime(timer));
4630}
4631
4632
4633/*********************************************************************
4634 * log10 (CRTDLL.422)
4635 */
4636double CDECL CRTDLL_log10( double x )
4637{
4638 dprintf(("CRTDLL: log10\n"));
4639 return (log10(x));
4640}
4641
4642
4643/*********************************************************************
4644 * longjmp (CRTDLL.423)
4645 */
4646VOID CDECL CRTDLL_longjmp(jmp_buf env, int val)
4647{
4648 dprintf(("CRTDLL: longjmp\n"));
4649 longjmp(env, val);
4650}
4651
4652
4653/*********************************************************************
4654 * malloc (CRTDLL.424)
4655 */
4656VOID* CDECL CRTDLL_malloc(DWORD size)
4657{
4658 dprintf(("CRTDLL: malloc\n"));
4659 return HeapAlloc(GetProcessHeap(),0,size);
4660}
4661
4662
4663/*********************************************************************
4664 * mblen (CRTDLL.425)
4665 */
4666INT CDECL CRTDLL_mblen( const char *s, size_t n )
4667{
4668 dprintf(("CRTDLL: mblen\n"));
4669 return (mblen(s, n));
4670}
4671
4672
4673/*********************************************************************
4674 * CRTDLL_mbtowc (CRTDLL.427)
4675 */
4676INT CDECL CRTDLL_mbtowc( WCHAR *dst, LPCSTR str, INT n )
4677{
4678 dprintf(("CRTDLL: _mbtowc\n"));
4679 wchar_t res;
4680 int ret = mbtowc( &res, str, n );
4681 if (dst) *dst = (WCHAR)res;
4682 return ret;
4683}
4684
4685
4686/*********************************************************************
4687 * mktime (CRTDLL.433)
4688 */
4689time_t CDECL CRTDLL_mktime( struct tm *timeptr )
4690{
4691 dprintf(("CRTDLL: mktime\n"));
4692 return mktime( timeptr );
4693}
4694
4695
4696/*********************************************************************
4697 * modf (CRTDLL.434)
4698 */
4699double CDECL CRTDLL_modf( double value, double *iptr )
4700{
4701 dprintf(("CRTDLL: modf\n"));
4702 return modf( value, iptr );
4703}
4704
4705
4706/*********************************************************************
4707 * perror (CRTDLL.435)
4708 */
4709void CDECL CRTDLL_perror( const char *s )
4710{
4711 dprintf(("CRTDLL: perror\n"));
4712 perror( s );
4713}
4714
4715
4716/*********************************************************************
4717 * printf (CRTDLL.437)
4718 */
4719int CDECL CRTDLL_printf( const char *format, ... )
4720{
4721 dprintf(("CRTDLL: printf not implemented.\n"));
4722 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
4723 return FALSE;
4724}
4725
4726
4727/*********************************************************************
4728 * putc (CRTDLL.438)
4729 */
4730int CDECL CRTDLL_putc( int c, FILE *fp )
4731{
4732 dprintf(("CRTDLL: putc\n"));
4733 return putc( c, fp );
4734}
4735
4736
4737/*********************************************************************
4738 * putchar (CRTDLL.439)
4739 */
4740int CDECL CRTDLL_putchar( int c )
4741{
4742 dprintf(("CRTDLL: putchar\n"));
4743 return putchar( c );
4744}
4745
4746
4747/*********************************************************************
4748 * puts (CRTDLL.440)
4749 */
4750int CDECL CRTDLL_puts( const char *s )
4751{
4752 dprintf(("CRTDLL: puts\n"));
4753 return puts( s );
4754}
4755
4756
4757/*********************************************************************
4758 * raise (CRTDLL.442)
4759 */
4760int CDECL CRTDLL_raise( int sig )
4761{
4762 dprintf(("CRTDLL: raise\n"));
4763 return raise( sig );
4764}
4765
4766
4767/*********************************************************************
4768 * rand (CRTDLL.443)
4769 */
4770int CDECL CRTDLL_rand( void )
4771{
4772 dprintf(("CRTDLL: rand\n"));
4773 return (rand());
4774}
4775
4776
4777/*********************************************************************
4778 * realloc (CRTDLL.444)
4779 */
4780void * CDECL CRTDLL_realloc( void *ptr, size_t size )
4781{
4782 dprintf(("CRTDLL: realloc\n"));
4783 return HeapReAlloc( GetProcessHeap(), 0, ptr, size );
4784}
4785
4786
4787/*********************************************************************
4788 * remove (CRTDLL.445)
4789 */
4790INT CDECL CRTDLL_remove(LPCSTR file)
4791{
4792 dprintf(("CRTDLL: remove\n"));
4793 if (!DeleteFileA(file))
4794 return -1;
4795 return 0;
4796}
4797
4798
4799/*********************************************************************
4800 * rename (CRTDLL.446)
4801 */
4802int CDECL CRTDLL_rename (const char *old, const char *new2)
4803{
4804 dprintf(("CRTDLL: rename\n"));
4805 return (rename(old, new2));
4806}
4807
4808
4809/*********************************************************************
4810 * rewind (CRTDLL.447)
4811 */
4812void CDECL CRTDLL_rewind( FILE *fp )
4813{
4814 dprintf(("CRTDLL: rewind\n"));
4815 rewind(fp);
4816}
4817
4818
4819/*********************************************************************
4820 * scanf (CRTDLL.448)
4821 */
4822int CDECL CRTDLL_scanf( const char *format, ... )
4823{
4824 dprintf(("CRTDLL: scanf not implemented.\n"));
4825 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
4826 return FALSE;
4827}
4828
4829
4830/*********************************************************************
4831 * setbuf (CRTDLL.449)
4832 */
4833void CDECL CRTDLL_setbuf( FILE *fp, char *buf )
4834{
4835 dprintf(("CRTDLL: setbuf\n"));
4836 setbuf(fp, buf);
4837}
4838
4839
4840/*********************************************************************
4841 * setlocale (CRTDLL.450)
4842 */
4843char * CDECL CRTDLL_setlocale(int category,const char *locale)
4844{
4845 dprintf(("CRTDLL: setlocale\n"));
4846 return (setlocale(category, locale));
4847}
4848
4849
4850/*********************************************************************
4851 * setvbuf (CRTDLL.451)
4852 */
4853int CDECL CRTDLL_setvbuf( FILE *fp, char *buf, int mode, size_t size )
4854{
4855 dprintf(("CRTDLL: setvbuf\n"));
4856 return (setvbuf(fp, buf, mode, size));
4857}
4858
4859
4860/*********************************************************************
4861 * signal (CRTDLL.452)
4862 */
4863void CDECL CRTDLL_signal( int sig, void (*func)(int))
4864{
4865 dprintf(("CRTDLL: signal not implemented.\n"));
4866 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
4867}
4868
4869
4870/*********************************************************************
4871 * sinh (CRTDLL.454)
4872 */
4873double CDECL CRTDLL_sinh( double x )
4874{
4875 dprintf(("CRTDLL: sinh\n"));
4876 return (sinh(x));
4877}
4878
4879
4880/*********************************************************************
4881 * srand (CRTDLL.457)
4882 */
4883void CDECL CRTDLL_srand( unsigned int seed )
4884{
4885 dprintf(("CRTDLL: srand\n"));
4886 srand(seed);
4887}
4888
4889
4890/*********************************************************************
4891 * strcoll (CRTDLL.462)
4892 */
4893int CDECL CRTDLL_strcoll( const char *s1, const char *s2 )
4894{
4895 dprintf(("CRTDLL: strcoll\n"));
4896 return strcoll(s1, s2);
4897}
4898
4899
4900/*********************************************************************
4901 * strerror (CRTDLL.465)
4902 */
4903char * CDECL CRTDLL_strerror( int errnum )
4904{
4905 dprintf(("CRTDLL: strerror\n"));
4906 return strerror(errnum);
4907}
4908
4909
4910/*********************************************************************
4911 * strftime (CRTDLL.466)
4912 */
4913size_t CDECL CRTDLL_strftime( char *s, size_t maxsiz, const char *fmt, const struct tm *tp )
4914{
4915 dprintf(("CRTDLL: strftime\n"));
4916 return strftime(s, maxsiz, fmt, tp);
4917}
4918
4919
4920/*********************************************************************
4921 * strtod (CRTDLL.475)
4922 */
4923double CDECL CRTDLL_strtod( const char *nptr, char **endptr )
4924{
4925 dprintf(("CRTDLL: strtod\n"));
4926 return strtod(nptr, endptr);
4927}
4928
4929
4930/*********************************************************************
4931 * strtok (CRTDLL.476)
4932 */
4933char * CDECL CRTDLL_strtok( char *s1, const char *s2 )
4934{
4935 dprintf(("CRTDLL: strtok\n"));
4936 return strtok(s1, s2);
4937}
4938
4939
4940/*********************************************************************
4941 * strtol (CRTDLL.477)
4942 */
4943long int CDECL CRTDLL_strtol( const char *nptr, char **endptr, int base )
4944{
4945 dprintf(("CRTDLL: strtol\n"));
4946 return strtol(nptr, endptr, base);
4947}
4948
4949
4950/*********************************************************************
4951 * strtoul (CRTDLL.478)
4952 */
4953unsigned long CDECL CRTDLL_strtoul( const char *nptr, char **endptr, int base )
4954{
4955 dprintf(("CRTDLL: strtoul\n"));
4956 return strtoul(nptr, endptr, base);
4957}
4958
4959
4960/*********************************************************************
4961 * strxfrm (CRTDLL.479)
4962 */
4963size_t CDECL CRTDLL_strxfrm( char *s1, const char *s2, size_t n )
4964{
4965 dprintf(("CRTDLL: strxfrm\n"));
4966 return strxfrm(s1, s2, n);
4967}
4968
4969
4970/*********************************************************************
4971 * swscanf (CRTDLL.481)
4972 */
4973int CDECL CRTDLL_swscanf( const wchar_t *s1, const wchar_t *s2, ... )
4974{
4975 dprintf(("CRTDLL: swscanf not implemented.\n"));
4976 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
4977 return FALSE;
4978}
4979
4980
4981/*********************************************************************
4982 * system (CRTDLL.482)
4983 */
4984int CDECL CRTDLL_system( const char *string )
4985{
4986 dprintf(("CRTDLL: system\n"));
4987 return system(string);
4988}
4989
4990
4991/*********************************************************************
4992 * tanh (CRTDLL.485)
4993 */
4994double CDECL CRTDLL_tanh( double x )
4995{
4996 dprintf(("CRTDLL: tanh\n"));
4997 return tanh(x);
4998}
4999
5000
5001/*********************************************************************
5002 * time (CRTDLL.485)
5003 */
5004time_t CDECL CRTDLL_time( time_t *timer )
5005{
5006 dprintf(("CRTDLL: time\n"));
5007
5008 return time(timer);
5009}
5010
5011
5012/*********************************************************************
5013 * tmpfile (CRTDLL.486)
5014 */
5015FILE * CDECL CRTDLL_tmpfile( void )
5016{
5017 dprintf(("CRTDLL: tmpfile\n"));
5018 return (tmpfile());
5019}
5020
5021
5022/*********************************************************************
5023 * tmpnam (CRTDLL.487)
5024 */
5025char * CDECL CRTDLL_tmpnam( char *s )
5026{
5027 dprintf(("CRTDLL: tmpnam\n"));
5028 return (tmpnam(s));
5029}
5030
5031
5032/*********************************************************************
5033 * ungetc (CRTDLL.492)
5034 */
5035INT CDECL CRTDLL_ungetc(int c)
5036{
5037 dprintf(("CRTDLL: ungetc not implemented.\n"));
5038 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
5039 return FALSE;
5040}
5041
5042
5043/*********************************************************************
5044 * ungetwc (CRTDLL.493)
5045 */
5046wint_t CDECL CRTDLL_ungetwc( wint_t wc, FILE *strm )
5047{
5048 dprintf(("CRTDLL: ungetwc\n"));
5049 return (ungetwc(wc, strm));
5050}
5051
5052
5053/*********************************************************************
5054 * vfprintf (CRTDLL.494)
5055 */
5056INT CDECL CRTDLL_vfprintf( CRTDLL_FILE *file, LPSTR format, va_list args )
5057{
5058 dprintf(("CRTDLL: vprintf\n"));
5059 char buffer[2048]; /* FIXME... */
5060 vsprintf( buffer, format, args );
5061 return CRTDLL_fwrite( buffer, 1, strlen(buffer), file );
5062}
5063
5064
5065/*********************************************************************
5066 * vfwprintf (CRTDLL.495)
5067 */
5068int CDECL CRTDLL_vfwprintf( FILE *F, const wchar_t *s, va_list arg )
5069{
5070 dprintf(("CRTDLL: vfwprintf not implemented.\n"));
5071 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
5072 return FALSE;
5073}
5074
5075
5076/*********************************************************************
5077 * vprintf (CRTDLL.496)
5078 */
5079int CDECL CRTDLL_vprintf( const char *format, __va_list arg )
5080{
5081 dprintf(("CRTDLL: vprintf\n"));
5082 return (vprintf(format, arg));
5083}
5084
5085
5086/*********************************************************************
5087 * vswprintf (CRTDLL.498)
5088 */
5089int CDECL CRTDLL_vswprintf( wchar_t *s , size_t t, const wchar_t *format, va_list arg )
5090{
5091 dprintf(("CRTDLL: vswprintf\n"));
5092 return (vswprintf(s, t, format, arg));
5093}
5094
5095
5096/*********************************************************************
5097 * vwprintf (CRTDLL.499)
5098 */
5099int CDECL CRTDLL_vwprintf( const wchar_t *s, va_list arg)
5100{
5101 dprintf(("CRTDLL: vwprintf not implemented.\n"));
5102 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
5103 return FALSE;
5104}
5105
5106
5107/*********************************************************************
5108 * wcscoll (CRTDLL.503)
5109 */
5110int CDECL CRTDLL_wcscoll(const wchar_t *s1, const wchar_t *s2)
5111{
5112 dprintf(("CRTDLL: wcscoll\n"));
5113 return (wcscoll(s1, s2));
5114}
5115
5116
5117/*********************************************************************
5118 * wcsftime (CRTDLL.506)
5119 */
5120size_t CDECL CRTDLL_wcsftime( wchar_t *s, size_t maxsize,
5121 const wchar_t *format, const struct tm *timeptr )
5122{
5123 dprintf(("CRTDLL: wcsftime\n"));
5124 return (wcsftime(s, maxsize, format, timeptr));
5125}
5126
5127
5128/*********************************************************************
5129 * wcstod (CRTDLL.515)
5130 */
5131double CDECL CRTDLL_wcstod( const wchar_t *nptr, wchar_t **endptr )
5132{
5133 dprintf(("CRTDLL: wcstod\n"));
5134 return (wcstod(nptr, endptr));
5135}
5136
5137
5138/*********************************************************************
5139 * wcsxfrm (CRTDLL.520)
5140 */
5141size_t CDECL CRTDLL_wcsxfrm( wchar_t *s1, const wchar_t *s2, size_t n )
5142{
5143 dprintf(("CRTDLL: wcsxfrm\n"));
5144 return (wcsxfrm(s1, s2, n));
5145}
5146
5147
5148/*********************************************************************
5149 * wcstomb (CRTDLL.521)
5150 */
5151int CDECL CRTDLL_wctomb( char *s, wchar_t wchar )
5152{
5153 dprintf(("CRTDLL: wctomb\n"));
5154 return (wctomb(s,wchar));
5155}
5156
5157
5158/*********************************************************************
5159 * wprintf (CRTDLL.522)
5160 */
5161int CDECL CRTDLL_wprintf( const wchar_t *s, ... )
5162{
5163 dprintf(("CRTDLL: wprintf not implemented.\n"));
5164 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
5165 return FALSE;
5166}
5167
5168
5169/*********************************************************************
5170 * wscanf (CRTDLL.523)
5171 */
5172int CDECL CRTDLL_wscanf( const wchar_t *s, ... )
5173{
5174 dprintf(("CRTDLL: wscanf not implemented.\n"));
5175 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
5176 return FALSE;
5177}
5178
5179
5180
5181/*********************************************************************
5182 * __set_errno (INTERNAL-#1)
5183 */
5184int __set_errno (int error)
5185{
5186 errno = error;
5187 return error;
5188}
5189
5190
5191/*********************************************************************
5192 * _mbbtoupper (INTERNAL-#2)
5193 */
5194unsigned int _mbbtoupper(unsigned int c)
5195{
5196 if (!CRTDLL__ismbblead(c) )
5197 return toupper(c);
5198
5199 return c;
5200}
5201
5202
5203/*********************************************************************
5204 * _mbbtolower (INTERNAL-#3)
5205 */
5206unsigned int _mbbtolower(unsigned int c)
5207{
5208 if (!CRTDLL__ismbblead(c) )
5209 return tolower(c);
5210 return c;
5211}
5212
5213
5214/*********************************************************************
5215 * _mbclen2 (INTERNAL-#4)
5216 */
5217size_t _mbclen2(const unsigned int s)
5218{
5219 return (CRTDLL__ismbblead(s>>8) && CRTDLL__ismbbtrail(s&0x00FF)) ? 2 : 1;
5220}
Note: See TracBrowser for help on using the repository browser.