Changeset 1900 for trunk/src/crtdll/crtdll.cpp
- Timestamp:
- Nov 30, 1999, 9:42:10 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/crtdll/crtdll.cpp
r1898 r1900 1 /* $Id: crtdll.cpp,v 1.1 3 1999-11-30 20:19:52sandervl Exp $ */1 /* $Id: crtdll.cpp,v 1.14 1999-11-30 20:42:10 sandervl Exp $ */ 2 2 3 3 /* … … 24 24 #include <ctype.h> 25 25 #include <setjmp.h> 26 #include <ntddk.h> 26 27 #include <debugtools.h> 27 28 … … 48 49 #include "crtinc.h" 49 50 #include "ieee.h" 50 #include <ntddk.h>51 51 52 52 DEFAULT_DEBUG_CHANNEL(crtdll) … … 335 335 CRTDLL_argv_dll = xargv; 336 336 *argv = xargv; 337 CRTDLL_environ_dll = *environ = GetEnvironmentStringsA(); 337 338 dprintf(("CRTDLL: GetMainArgs end\n")); 338 CRTDLL_environ_dll = *environ = GetEnvironmentStringsA();339 339 return 0; 340 340 } … … 652 652 * CRTDLL__commit (CRTDLL.58) 653 653 */ 654 int CDECL CRTDLL__commit( int handle)655 { 656 dprintf(("CRTDLL: _commit not implemented.\n"));657 // if (! FlushFileBuffers(_get_osfhandle(_fd)) ) {658 //__set_errno(EBADF);659 //return -1;660 //}654 int CDECL CRTDLL__commit( int _fd ) 655 { 656 dprintf(("CRTDLL: _commit\n")); 657 if (! FlushFileBuffers((HFILE)CRTDLL__get_osfhandle(_fd)) ) { 658 __set_errno(EBADF); 659 return -1; 660 } 661 661 return 0; 662 662 } … … 863 863 * CRTDLL__execle (CRTDLL.80) 864 864 */ 865 int CDECL CRTDLL__execle( char *s1, char *s2, ...) 866 { 867 dprintf(("CRTDLL: _execle not implemented.\n")); 868 SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 869 return FALSE; 865 int CDECL CRTDLL__execle(char *path, char *szArgv0, ...) 866 { 867 dprintf(("CRTDLL: _execle not correct implemented.\n")); 868 char *szArg[100]; 869 const char *a; 870 char *ptr; 871 int i = 0; 872 va_list l = 0; 873 va_start(l,szArgv0); 874 do { 875 a = (const char *)va_arg(l,const char *); 876 szArg[i++] = (char *)a; 877 } while ( a != NULL && i < 100 ); 878 879 880 // szArg0 is passed and not environment if there is only one parameter; 881 882 if ( i >=2 ) { 883 ptr = szArg[i-2]; 884 szArg[i-2] = NULL; 885 } 886 else 887 ptr = NULL; 888 889 return _spawnve(P_OVERLAY, path, szArg, (char**)ptr); 870 890 } 871 891 … … 893 913 * CRTDLL__execlpe (CRTDLL.82) 894 914 */ 895 int CDECL CRTDLL__execlpe( char *s1, char *s2, ...) 896 { 897 dprintf(("CRTDLL: _execlpe not implemented.\n")); 898 SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 899 return FALSE; 915 int CDECL CRTDLL__execlpe( char *path, char *szArgv0, ...) 916 { 917 dprintf(("CRTDLL: _execlpe not correct implemented.\n")); 918 char *szArg[100]; 919 const char *a; 920 char *ptr; 921 int i = 0; 922 va_list l = 0; 923 va_start(l,szArgv0); 924 do { 925 a = (const char *)va_arg(l,const char *); 926 szArg[i++] = (char *)a; 927 } while ( a != NULL && i < 100 ); 928 929 930 // szArg0 is passed and not environment if there is only one parameter; 931 932 if ( i >=2 ) { 933 ptr = szArg[i-2]; 934 szArg[i-2] = NULL; 935 } 936 else 937 ptr = NULL; 938 return spawnvpe(P_OVERLAY, path, szArg, (char**)ptr); 900 939 } 901 940 … … 1239 1278 * _ftime (CRTDLL.112) 1240 1279 */ 1241 int CDECL CRTDLL__ftime( struct timeb *time ptr)1280 int CDECL CRTDLL__ftime( struct timeb *timebuf ) 1242 1281 { 1243 1282 dprintf(("CRTDLL: _ftime not implemented.\n")); … … 1281 1320 * _get_osfhandle (CRTDLL.117) 1282 1321 */ 1283 long CDECL CRTDLL__get_osfhandle( int posixhandle ) 1284 { 1285 dprintf(("CRTDLL: _get_osfhandle not implemented.\n")); 1286 SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 1287 return FALSE; 1322 void* CDECL CRTDLL__get_osfhandle( int fileno ) 1323 { 1324 dprintf(("CRTDLL: _get_osfhandle\n")); 1325 return filehnd(fileno); 1288 1326 } 1289 1327 … … 2017 2055 * _matherr (CRTDLL.181) 2018 2056 */ 2019 #if (__IBMCPP__ > 300)2020 #define exception _exception2021 #endif2022 2023 2057 double CDECL CRTDLL__matherr( struct exception * excep ) 2024 2058 { … … 3520 3554 * CRTDLL__spawnle (CRTDLL.270) 3521 3555 */ 3522 int CDECL CRTDLL__spawnle( int i, char *s1, char *s2, ... ) 3523 { 3524 dprintf(("CRTDLL: _spawnle not implemented.\n")); 3525 SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 3526 return FALSE; 3556 int CDECL CRTDLL__spawnle( int mode, char *path, char **szArgv0, ... ) 3557 { 3558 dprintf(("CRTDLL: _spawnle not correct implemented.\n")); 3559 char *szArg[100]; 3560 char *a; 3561 char *ptr; 3562 int i = 0; 3563 va_list l = 0; 3564 va_start(l,szArgv0); 3565 do { 3566 a = (char*)va_arg(l,const char *); 3567 szArg[i++] = (char *)a; 3568 } while ( a != NULL && i < 100 ); 3569 3570 3571 // szArg0 is passed and not environment if there is only one parameter; 3572 3573 if ( i >=2 ) { 3574 ptr = szArg[i-2]; 3575 szArg[i-2] = NULL; 3576 } 3577 else 3578 ptr = NULL; 3579 3580 return _spawnve(mode, path, szArg, (char**)ptr); 3527 3581 } 3528 3582 … … 3550 3604 * CRTDLL__spawnlpe (CRTDLL.272) 3551 3605 */ 3552 int CDECL CRTDLL__spawnlpe( int i, char *s1, char *s2, ... ) 3553 { 3554 dprintf(("CRTDLL: _spawnlpe not implemented.\n")); 3555 SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 3556 return FALSE; 3606 int CDECL CRTDLL__spawnlpe( int mode, char *path, char *szArgv0, ... ) 3607 { 3608 dprintf(("CRTDLL: _spawnlpe not correct implemented.\n")); 3609 char *szArg[100]; 3610 const char *a; 3611 char *ptr; 3612 int i = 0; 3613 va_list l = 0; 3614 va_start(l,szArgv0); 3615 do { 3616 a = (char *)va_arg(l,const char *); 3617 szArg[i++] = (char *)a; 3618 } while ( a != NULL && i < 100 ); 3619 3620 3621 // szArg0 is passed and not environment if there is only one parameter; 3622 3623 if ( i >=2 ) { 3624 ptr = szArg[i-2]; 3625 szArg[i-2] = NULL; 3626 } 3627 else 3628 ptr = NULL; 3629 3630 return _spawnvpe(mode, path, szArg, (char**)ptr); 3557 3631 } 3558 3632 … … 4859 4933 int CDECL CRTDLL_printf( const char *format, ... ) 4860 4934 { 4861 dprintf(("CRTDLL: printf not implemented.\n"));4935 dprintf(("CRTDLL: printf\n")); 4862 4936 va_list arg; 4863 4937 int done; … … 5374 5448 return ( x->exponent == 0x7ff && ( x->mantissah == 0 && x->mantissal == 0 )); 5375 5449 } 5450 5451 5452 /********************************************************************* 5453 * _filehnd (INTERNAL-#6) 5454 */ 5455 void* filehnd(int fileno) 5456 { 5457 if ( fileno < 0 ) 5458 return (void *)-1; 5459 #define STD_AUX_HANDLE 3 5460 #define STD_PRINTER_HANDLE 4 5461 5462 switch(fileno) 5463 { 5464 case 0: 5465 return (void*)GetStdHandle(STD_INPUT_HANDLE); 5466 case 1: 5467 return (void*)GetStdHandle(STD_OUTPUT_HANDLE); 5468 case 2: 5469 return (void*)GetStdHandle(STD_ERROR_HANDLE); 5470 case 3: 5471 return (void*)GetStdHandle(STD_AUX_HANDLE); 5472 case 4: 5473 return (void*)GetStdHandle(STD_PRINTER_HANDLE); 5474 default: 5475 break; 5476 } 5477 5478 if ( fileno >= maxfno ) 5479 return (void *)-1; 5480 5481 if ( fileno_modes[fileno].fd == -1 ) 5482 return (void *)-1; 5483 return (void*)fileno_modes[fileno].hFile; 5484 }
Note:
See TracChangeset
for help on using the changeset viewer.