Changeset 6712 for trunk/src/crtdll
- Timestamp:
 - Sep 15, 2001, 11:47:44 AM (24 years ago)
 - Location:
 - trunk/src/crtdll
 - Files:
 - 
      
- 8 edited
 
 
Legend:
- Unmodified
 - Added
 - Removed
 
- 
      
trunk/src/crtdll/crtdll.cpp
r6645 r6712 1 /* $Id: crtdll.cpp,v 1.30 2001-09-05 12:14:23 bird Exp $ */2 1 /* 3 2 * The C RunTime DLL 4 * 3 * 5 4 * Implements C run-time functionality as known from UNIX. 6 5 * 7 * TODO: 6 * TODO: 8 7 * - Check setjmp(3) 9 8 * - fix *ALL* functions for the FS: wrapper problem … … 73 72 // Definitions for internal functions 74 73 // 75 void qsort1 (char*, char*, size_t,74 void qsort1 (char*, char*, size_t, 76 75 int (* CDECL)(const void*, const void*)); 77 76 … … 445 444 446 445 /********************************************************************* 447 * _cscanf(CRTDLL.67)446 * _cscanf (CRTDLL.67) 448 447 */ 449 448 INT CDECL CRTDLL__cscanf( char *s, va_list arg ) … … 605 604 606 605 /********************************************************************* 607 * _ftime(CRTDLL.112)606 * _ftime (CRTDLL.112) 608 607 */ 609 608 void CDECL CRTDLL__ftime( struct timeb *timebuf ) … … 619 618 LONG CDECL CRTDLL__ftol(void) 620 619 { 621 /* don't just do DO_FPU("fistp",retval), because the rounding622 * mode must also be set to "round towards zero"... */623 double fl;624 POP_FPU(fl);625 return (LONG)fl;620 /* don't just do DO_FPU("fistp",retval), because the rounding 621 * mode must also be set to "round towards zero"... */ 622 double fl; 623 POP_FPU(fl); 624 return (LONG)fl; 626 625 } 627 626 … … 776 775 777 776 /********************************************************************* 778 * _ltoa (CRTDLL.179)777 * _ltoa (CRTDLL.179) 779 778 */ 780 779 LPSTR CDECL CRTDLL__ltoa(long x,LPSTR buf,INT radix) … … 785 784 786 785 /********************************************************************* 787 * _matherr (CRTDLL.181)786 * _matherr (CRTDLL.181) 788 787 */ 789 788 double CDECL CRTDLL__matherr( struct exception * excep ) … … 882 881 883 882 /********************************************************************* 884 * CRTDLL__searchenv (CRTDLL.260)883 * CRTDLL__searchenv (CRTDLL.260) 885 884 */ 886 885 void CDECL CRTDLL__searchenv(char *file, char *var,char *path ) … … 892 891 893 892 /********************************************************************* 894 * CRTDLL__seterrormode (CRTDLL.261)893 * CRTDLL__seterrormode (CRTDLL.261) 895 894 */ 896 895 void CDECL CRTDLL__seterrormode(int uMode) … … 903 902 904 903 /********************************************************************* 905 * CRTDLL__setjmp (CRTDLL.262)904 * CRTDLL__setjmp (CRTDLL.262) 906 905 */ 907 906 int CDECL CRTDLL__setjmp( jmp_buf env ) … … 938 937 939 938 /********************************************************************* 940 * _sopen(CRTDLL.268)939 * _sopen (CRTDLL.268) 941 940 */ 942 941 int CDECL CRTDLL__sopen( const char *s, int i1, int i2, va_list arg ) … … 948 947 949 948 /********************************************************************* 950 * CRTDLL__spawnl (CRTDLL.269)949 * CRTDLL__spawnl (CRTDLL.269) 951 950 */ 952 951 int CDECL CRTDLL__spawnl(int nMode, char* szPath, char* szArgv0, va_list arg) … … 958 957 959 958 /********************************************************************* 960 * CRTDLL__spawnle (CRTDLL.270)959 * CRTDLL__spawnle (CRTDLL.270) 961 960 */ 962 961 int CDECL CRTDLL__spawnle( int mode, char *path, char **szArgv0, va_list arg ) … … 968 967 969 968 /********************************************************************* 970 * CRTDLL__spawnlp (CRTDLL.271)969 * CRTDLL__spawnlp (CRTDLL.271) 971 970 */ 972 971 int CDECL CRTDLL__spawnlp(int nMode, char* szPath, char* szArgv0, va_list arg) … … 978 977 979 978 /********************************************************************* 980 * CRTDLL__spawnlpe (CRTDLL.272)979 * CRTDLL__spawnlpe (CRTDLL.272) 981 980 */ 982 981 int CDECL CRTDLL__spawnlpe( int mode, char *path, char *szArgv0, va_list arg ) … … 988 987 989 988 /********************************************************************* 990 * CRTDLL__spawnv (CRTDLL.273)989 * CRTDLL__spawnv (CRTDLL.273) 991 990 */ 992 991 int CDECL CRTDLL__spawnv( int i, char *s1, char ** s2 ) … … 998 997 999 998 /********************************************************************* 1000 * CRTDLL__spawnvp (CRTDLL.275)999 * CRTDLL__spawnvp (CRTDLL.275) 1001 1000 */ 1002 1001 int CDECL CRTDLL__spawnvp( int i, char *s1, char ** s2 ) … … 1007 1006 1008 1007 /********************************************************************* 1009 * CRTDLL__spawnv (CRTDLL.276)1008 * CRTDLL__spawnv (CRTDLL.276) 1010 1009 */ 1011 1010 int CDECL CRTDLL__spawnvpe( int i, char *s1, char ** s2, char ** s3 ) … … 1017 1016 1018 1017 /********************************************************************* 1019 * CRTDLL__statusfp (CRTDLL.279)1018 * CRTDLL__statusfp (CRTDLL.279) 1020 1019 */ 1021 1020 unsigned int CDECL CRTDLL__statusfp( void ) … … 1024 1023 return (_status87()); 1025 1024 } 1026 1027 1028 /********************************************************************* 1029 * _ultoa (CRTDLL.309)1025 1026 1027 /********************************************************************* 1028 * _ultoa (CRTDLL.309) 1030 1029 */ 1031 1030 LPSTR CDECL CRTDLL__ultoa(long x,LPSTR buf,INT radix) … … 1037 1036 1038 1037 /********************************************************************* 1039 * CRTDLL__ungetch (CRTDLL.311)1038 * CRTDLL__ungetch (CRTDLL.311) 1040 1039 */ 1041 1040 int CDECL CRTDLL__ungetch( int i ) … … 1047 1046 1048 1047 /********************************************************************* 1049 * _utime (CRTDLL.314)1048 * _utime (CRTDLL.314) 1050 1049 */ 1051 1050 int CDECL CRTDLL__utime( char *path, struct utimbuf * times ) … … 1057 1056 1058 1057 /********************************************************************* 1059 * _vsnprintf(CRTDLL.315)1058 * _vsnprintf (CRTDLL.315) 1060 1059 */ 1061 1060 int CDECL CRTDLL__vsnprintf( char *s, size_t bufsize, const char *format, va_list arg ) … … 1101 1100 1102 1101 /********************************************************************* 1103 * abs (CRTDLL.336)1102 * abs (CRTDLL.336) 1104 1103 */ 1105 1104 double CDECL CRTDLL_abs(double d) … … 1113 1112 1114 1113 /********************************************************************* 1115 * acos (CRTDLL.337)1114 * acos (CRTDLL.337) 1116 1115 */ 1117 1116 double CDECL CRTDLL_acos( double x ) … … 1123 1122 1124 1123 /********************************************************************* 1125 * asctime (CRTDLL.338)1124 * asctime (CRTDLL.338) 1126 1125 */ 1127 1126 char * CDECL CRTDLL_asctime( const struct tm *timeptr ) … … 1133 1132 1134 1133 /********************************************************************* 1135 * asin (CRTDLL.339)1134 * asin (CRTDLL.339) 1136 1135 */ 1137 1136 double CDECL CRTDLL_asin( double x ) … … 1143 1142 1144 1143 /********************************************************************* 1145 * atan (CRTDLL.340)1144 * atan (CRTDLL.340) 1146 1145 */ 1147 1146 double CDECL CRTDLL_atan(double d) … … 1155 1154 1156 1155 /********************************************************************* 1157 * atan2 (CRTDLL.341)1156 * atan2 (CRTDLL.341) 1158 1157 */ 1159 1158 double CDECL CRTDLL_atan2( double y, double x ) … … 1165 1164 1166 1165 /********************************************************************* 1167 * atof (CRTDLL.343)1166 * atof (CRTDLL.343) 1168 1167 */ 1169 1168 double CDECL CRTDLL_atof( const char *nptr ) … … 1175 1174 1176 1175 /********************************************************************* 1177 * atoi (CRTDLL.344)1176 * atoi (CRTDLL.344) 1178 1177 */ 1179 1178 int CDECL CRTDLL_atoi(LPSTR str) … … 1187 1186 1188 1187 /********************************************************************* 1189 * atol (CRTDLL.345)1188 * atol (CRTDLL.345) 1190 1189 */ 1191 1190 long CDECL CRTDLL_atol(LPSTR str) … … 1199 1198 1200 1199 /********************************************************************* 1201 * bsearch (CRTDLL.346)1200 * bsearch (CRTDLL.346) 1202 1201 */ 1203 1202 void *CDECL CRTDLL_bsearch (const void *key, const void *base, size_t num, size_t width, … … 1206 1205 int left, right, median, sign; 1207 1206 const void *element; 1208 1207 1209 1208 if (width == 0) 1210 1209 return 0; … … 1227 1226 1228 1227 /********************************************************************* 1229 * ceil (CRTDLL.348)1228 * ceil (CRTDLL.348) 1230 1229 */ 1231 1230 double CDECL CRTDLL_ceil(double d) … … 1238 1237 1239 1238 /********************************************************************* 1240 * clock (CRTDLL.350)1239 * clock (CRTDLL.350) 1241 1240 */ 1242 1241 clock_t CDECL CRTDLL_clock( void ) … … 1248 1247 1249 1248 /********************************************************************* 1250 * cos (CRTDLL.351)1249 * cos (CRTDLL.351) 1251 1250 */ 1252 1251 double CDECL CRTDLL_cos(double d) … … 1260 1259 1261 1260 /********************************************************************* 1262 * cosh (CRTDLL.352)1261 * cosh (CRTDLL.352) 1263 1262 */ 1264 1263 double CDECL CRTDLL_cosh( double x ) … … 1270 1269 1271 1270 /********************************************************************* 1272 * ctime (CRTDLL.353)1271 * ctime (CRTDLL.353) 1273 1272 */ 1274 1273 char * CDECL CRTDLL_ctime( const time_t *timer ) … … 1280 1279 1281 1280 /********************************************************************* 1282 * difftime (CRTDLL.354)1281 * difftime (CRTDLL.354) 1283 1282 */ 1284 1283 double CDECL CRTDLL_difftime( time_t t1, time_t t0 ) … … 1290 1289 1291 1290 /********************************************************************* 1292 * div (CRTDLL.355)1291 * div (CRTDLL.355) 1293 1292 */ 1294 1293 ULONG CDECL CRTDLL_div( int number, int denom ) … … 1304 1303 1305 1304 /********************************************************************* 1306 * exp (CRTDLL.357)1305 * exp (CRTDLL.357) 1307 1306 */ 1308 1307 double CDECL CRTDLL_exp( double x ) … … 1314 1313 1315 1314 /********************************************************************* 1316 * fabs (CRTDLL.358)1315 * fabs (CRTDLL.358) 1317 1316 */ 1318 1317 double CDECL CRTDLL_fabs(double d) … … 1326 1325 1327 1326 /********************************************************************* 1328 * floor (CRTDLL.367)1327 * floor (CRTDLL.367) 1329 1328 */ 1330 1329 double CDECL CRTDLL_floor(double d) … … 1338 1337 1339 1338 /********************************************************************* 1340 * fmod (CRTDLL.368)1339 * fmod (CRTDLL.368) 1341 1340 */ 1342 1341 double CDECL CRTDLL_fmod(double x, double y ) … … 1348 1347 1349 1348 /********************************************************************* 1350 * frexp (CRTDLL.377)1349 * frexp (CRTDLL.377) 1351 1350 */ 1352 1351 double CDECL CRTDLL_frexp( double value, int *exp ) … … 1490 1489 1491 1490 /********************************************************************* 1492 * labs (CRTDLL.416)1491 * labs (CRTDLL.416) 1493 1492 */ 1494 1493 long int CDECL CRTDLL_labs( long int j ) … … 1500 1499 1501 1500 /********************************************************************* 1502 * ldexp (CRTDLL.417)1503 */ 1504 double CDECL CRTDLL_ldexp( double x, int exp ) 1501 * ldexp (CRTDLL.417) 1502 */ 1503 double CDECL CRTDLL_ldexp( double x, int exp ) 1505 1504 { 1506 1505 dprintf2(("CRTDLL: ldexp\n")); … … 1510 1509 1511 1510 /********************************************************************* 1512 * ldiv (CRTDLL.418)1513 */ 1514 ldiv_t CDECL CRTDLL_ldiv( long int numer, long int denom ) 1511 * ldiv (CRTDLL.418) 1512 */ 1513 ldiv_t CDECL CRTDLL_ldiv( long int numer, long int denom ) 1515 1514 { 1516 1515 dprintf2(("CRTDLL: ldiv\n")); … … 1520 1519 1521 1520 /********************************************************************* 1522 * localeconv (CRTDLL.419)1521 * localeconv (CRTDLL.419) 1523 1522 */ 1524 1523 struct lconv * CDECL CRTDLL_localeconv(void) … … 1530 1529 1531 1530 /********************************************************************* 1532 * localtime (CRTDLL.420)1531 * localtime (CRTDLL.420) 1533 1532 */ 1534 1533 struct tm * CDECL CRTDLL_localtime( const time_t *timer ) … … 1540 1539 1541 1540 /********************************************************************* 1542 * log (CRTDLL.421)1541 * log (CRTDLL.421) 1543 1542 */ 1544 1543 double CDECL CRTDLL_log( double x ) … … 1550 1549 1551 1550 /********************************************************************* 1552 * log10 (CRTDLL.422)1551 * log10 (CRTDLL.422) 1553 1552 */ 1554 1553 double CDECL CRTDLL_log10( double x ) … … 1582 1581 * pow (CRTDLL.436) 1583 1582 */ 1584 double CDECL CRTDLL_pow( double x, double y ) 1583 double CDECL CRTDLL_pow( double x, double y ) 1585 1584 { 1586 1585 dprintf2(("CRTDLL: pow(%08xh, %08xh)\n",x, y)); … … 1622 1621 1623 1622 /********************************************************************* 1624 * scanf(CRTDLL.448)1623 * scanf (CRTDLL.448) 1625 1624 */ 1626 1625 int CDECL CRTDLL_scanf( const char *format, va_list arg ) … … 1706 1705 1707 1706 /********************************************************************* 1708 * sscanf(CRTDLL.458)1707 * sscanf (CRTDLL.458) 1709 1708 */ 1710 1709 int CDECL CRTDLL_sscanf( const char *s, const char *format, va_list arg ) … … 1783 1782 1784 1783 /********************************************************************* 1785 * ungetc(CRTDLL.492)1784 * ungetc (CRTDLL.492) 1786 1785 */ 1787 1786 INT CDECL CRTDLL_ungetc(int c, FILE *f) … … 1813 1812 1814 1813 /********************************************************************* 1815 * CRTDLL__setjmp3 (CRTDLL.600)1814 * CRTDLL__setjmp3 (CRTDLL.600) 1816 1815 */ 1817 1816 int CDECL CRTDLL__setjmp3( jmp_buf env )  - 
      
trunk/src/crtdll/crtdll_main.c
r6645 r6712 1 /* $Id: crtdll_main.c,v 1.2 2001-09-05 12:14:24 bird Exp $ */2 1 /* 3 2 * The C RunTime DLL 4 * 3 * 5 4 * Implements C run-time functionality as known from UNIX. 6 5 * … … 14 13 Unresolved issues Uwe Bonnes 970904: 15 14 - tested with ftp://ftp.remcomp.com/pub/remcomp/lcc-win32.zip, a C-Compiler 16 for Win32, based on lcc, from Jacob Navia15 for Win32, based on lcc, from Jacob Navia 17 16 UB 000416: 18 17 - probably not thread safe 19 18 */ 20 19 21 /* NOTE: This file also implements the wcs* functions. They _ARE_ in 20 /* NOTE: This file also implements the wcs* functions. They _ARE_ in 22 21 * the newer Linux libcs, but use 4 byte wide characters, so are unusable, 23 22 * since we need 2 byte wide characters. - Marcus Meissner, 981031 … … 64 63 UINT CRTDLL_winminor_dll; /* CRTDLL.330 */ 65 64 UINT CRTDLL_winver_dll; /* CRTDLL.331 */ 66 INT CRTDLL_doserrno = 0; 65 INT CRTDLL_doserrno = 0; 67 66 INT CRTDLL_errno = 0; 68 67 const INT CRTDLL__sys_nerr = 43; … … 78 77 * CRTDLL_MainInit (CRTDLL.init) 79 78 */ 80 79 81 80 BOOL WINAPI CRTDLL_Init(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) 82 81 { 83 82 FS_OS2 84 83 85 84 // call i/o initializer in file.c 86 if (fdwReason == DLL_PROCESS_ATTACH) 85 if (fdwReason == DLL_PROCESS_ATTACH) 87 86 { 88 87 __CRTDLL__init_io(); 89 88 } 90 89 91 90 /* 92 91 PH 2000/11/21 this code doesn't look very useful 93 92 94 93 if (fdwReason == DLL_PROCESS_ATTACH) { 95 94 _fdopen(0,"r"); … … 104 103 } 105 104 */ 106 105 107 106 FS_WIN32 108 107 return TRUE; … … 177 176 char *cmdline; 178 177 char **xargv; 179 intxargc,end,last_arg,afterlastspace;180 DWORDversion;181 182 TRACE("(%p,%p,%p,%ld).\n",183 argc,argv,environ,flag184 );185 186 if (CRTDLL_acmdln_dll != NULL)187 HeapFree(GetProcessHeap(), 0, CRTDLL_acmdln_dll);188 189 CRTDLL_acmdln_dll = cmdline = CRTDLL__strdup( GetCommandLineA() );190 TRACE("got '%s'\n", cmdline);191 192 version= GetVersion();193 CRTDLL_osver_dll = version >> 16;194 CRTDLL_winminor_dll = version & 0xFF;195 CRTDLL_winmajor_dll = (version>>8) & 0xFF;196 CRTDLL_baseversion_dll = version >> 16;197 CRTDLL_winver_dll = ((version >> 8) & 0xFF) + ((version & 0xFF) << 8);198 CRTDLL_baseminor_dll = (version >> 16) & 0xFF;199 CRTDLL_basemajor_dll = (version >> 24) & 0xFF;200 CRTDLL_osversion_dll = version & 0xFFFF;201 CRTDLL_osminor_dll = version & 0xFF;202 CRTDLL_osmajor_dll = (version>>8) & 0xFF;203 204 /* missing threading init */205 206 end=0;last_arg=0;xargv=NULL;xargc=0;afterlastspace=0;207 while (1)208 {209 if ((cmdline[end]==' ') || (cmdline[end]=='\0'))210 {211 if (cmdline[end]=='\0')212 last_arg=1;213 else214 cmdline[end]='\0';215 /* alloc xargc + NULL entry */216 xargv=(char**)HeapReAlloc( GetProcessHeap(), 0, xargv,217 sizeof(char*)*(xargc+1));218 if (strlen(cmdline+afterlastspace))219 {220 xargv[xargc] = CRTDLL__strdup(cmdline+afterlastspace);221 xargc++;178 int xargc,end,last_arg,afterlastspace; 179 DWORD version; 180 181 TRACE("(%p,%p,%p,%ld).\n", 182 argc,argv,environ,flag 183 ); 184 185 if (CRTDLL_acmdln_dll != NULL) 186 HeapFree(GetProcessHeap(), 0, CRTDLL_acmdln_dll); 187 188 CRTDLL_acmdln_dll = cmdline = CRTDLL__strdup( GetCommandLineA() ); 189 TRACE("got '%s'\n", cmdline); 190 191 version = GetVersion(); 192 CRTDLL_osver_dll = version >> 16; 193 CRTDLL_winminor_dll = version & 0xFF; 194 CRTDLL_winmajor_dll = (version>>8) & 0xFF; 195 CRTDLL_baseversion_dll = version >> 16; 196 CRTDLL_winver_dll = ((version >> 8) & 0xFF) + ((version & 0xFF) << 8); 197 CRTDLL_baseminor_dll = (version >> 16) & 0xFF; 198 CRTDLL_basemajor_dll = (version >> 24) & 0xFF; 199 CRTDLL_osversion_dll = version & 0xFFFF; 200 CRTDLL_osminor_dll = version & 0xFF; 201 CRTDLL_osmajor_dll = (version>>8) & 0xFF; 202 203 /* missing threading init */ 204 205 end=0;last_arg=0;xargv=NULL;xargc=0;afterlastspace=0; 206 while (1) 207 { 208 if ((cmdline[end]==' ') || (cmdline[end]=='\0')) 209 { 210 if (cmdline[end]=='\0') 211 last_arg=1; 212 else 213 cmdline[end]='\0'; 214 /* alloc xargc + NULL entry */ 215 xargv=(char**)HeapReAlloc( GetProcessHeap(), 0, xargv, 216 sizeof(char*)*(xargc+1)); 217 if (strlen(cmdline+afterlastspace)) 218 { 219 xargv[xargc] = CRTDLL__strdup(cmdline+afterlastspace); 220 xargc++; 222 221 if (!last_arg) /* need to seek to the next arg ? */ 223 {224 end++;225 while (cmdline[end]==' ')226 end++;227 }228 afterlastspace=end;229 }230 else231 {232 xargv[xargc] = NULL; /* the last entry is NULL */233 break;234 }235 }236 else237 end++;238 }239 CRTDLL_argc_dll= xargc;240 *argc= xargc;241 CRTDLL_argv_dll= xargv;242 *argv= xargv;243 244 TRACE("found %d arguments\n",245 CRTDLL_argc_dll);246 CRTDLL_environ_dll = *environ = GetEnvironmentStringsA();247 return environ;222 { 223 end++; 224 while (cmdline[end]==' ') 225 end++; 226 } 227 afterlastspace=end; 228 } 229 else 230 { 231 xargv[xargc] = NULL; /* the last entry is NULL */ 232 break; 233 } 234 } 235 else 236 end++; 237 } 238 CRTDLL_argc_dll = xargc; 239 *argc = xargc; 240 CRTDLL_argv_dll = xargv; 241 *argv = xargv; 242 243 TRACE("found %d arguments\n", 244 CRTDLL_argc_dll); 245 CRTDLL_environ_dll = *environ = GetEnvironmentStringsA(); 246 return environ; 248 247 } 249 248 … … 254 253 DWORD CDECL CRTDLL__initterm(_INITTERMFUN *start,_INITTERMFUN *end) 255 254 { 256 _INITTERMFUN*current;257 258 TRACE("(%p,%p)\n",start,end);259 current=start;260 while (current<end) {261 if (*current) (*current)();262 current++;263 }264 return 0;255 _INITTERMFUN *current; 256 257 TRACE("(%p,%p)\n",start,end); 258 current=start; 259 while (current<end) { 260 if (*current) (*current)(); 261 current++; 262 } 263 return 0; 265 264 } 266 265 … … 310 309 INT CDECL CRTDLL_rand() 311 310 { 312 return (rand() & CRTDLL_RAND_MAX); 311 return (rand() & CRTDLL_RAND_MAX); 313 312 } 314 313 … … 320 319 { 321 320 // return (_rotl(value, shift)); 322 321 323 322 shift &= 31; 324 323 return (x << shift) | (x >> (32-shift)); … … 332 331 { 333 332 // return (_lrotl(value, shift)); 334 333 335 334 shift &= 31; 336 335 return (x << shift) | (x >> (32-shift)); … … 344 343 { 345 344 // return (_lrotr(value, shift)); 346 345 347 346 shift &= 0x1f; 348 347 return (x >> shift) | (x << (32-shift)); … … 356 355 { 357 356 // return (_rotr(value, shift)); 358 357 359 358 shift &= 0x1f; 360 359 return (x >> shift) | (x << (32-shift)); … … 368 367 { 369 368 // return (vswprintf(s, t, format, arg)); 370 369 371 370 return wvsprintfW( buffer, spec, args ); 372 371 } … … 389 388 { 390 389 return (setlocale(category, locale)); 391 390 392 391 /* 393 392 LPSTR categorystr; … … 438 437 { 439 438 // return (_fullpath(buf, path, size)); 440 439 441 440 if (!buf) 442 441 { … … 456 455 { 457 456 // _splitpath( path, drive, dir, fname, ext); 458 457 459 458 /* drive includes : 460 459 directory includes leading and trailing (forward and backward slashes) … … 520 519 { 521 520 // _makepath(path, drive, dir, fname, ext); 522 521 523 522 char ch; 524 523 TRACE("CRTDLL__makepath got %s %s %s %s\n", drive, directory, … … 568 567 { 569 568 // return (_errno()); 570 569 571 570 return &CRTDLL_errno; 572 571 } … … 575 574 /********************************************************************* 576 575 * __doserrno (CRTDLL.26) 577 * 576 * 578 577 * Return the address of the DOS errno (holding the last OS error). 579 578 * @@@PH Note: veeeery strange ... … … 584 583 { 585 584 // return (__doserrno()); 586 585 587 586 return &CRTDLL_doserrno; 588 587 } … … 602 601 { 603 602 // return (_strerror((char*)s)); 604 603 605 604 static char strerrbuff[256]; 606 605 sprintf(strerrbuff,"%s: %s\n",err,CRTDLL_strerror(CRTDLL_errno)); … … 617 616 { 618 617 // perror( s ); 619 618 620 619 char *err_str = CRTDLL_strerror(CRTDLL_errno); 621 620 CRTDLL_fprintf(CRTDLL_stderr,"%s: %s\n",err,err_str); 622 621 CRTDLL_free(err_str); 623 622 } 624 623 625 624 626 625 /********************************************************************* … … 632 631 * The caller does not own the string returned. 633 632 */ 634 extern char *strerror(int errnum); 633 extern char *strerror(int errnum); 635 634 636 635 LPSTR CDECL CRTDLL_strerror (INT err) … … 646 645 { 647 646 //return (signal(sig, ptr)); 648 647 649 648 FIXME("(%d %p):stub.\n", sig, ptr); 650 649 return (void*)-1; … … 668 667 { 669 668 // return (getenv(name)); 670 669 671 670 LPSTR environ = GetEnvironmentStringsA(); 672 671 LPSTR pp,pos = NULL; … … 675 674 for (pp = environ; (*pp); pp = pp + strlen(pp) +1) 676 675 { 677 pos =strchr(pp,'=');678 if (pos)679 length = pos -pp;680 else681 length = strlen(pp);682 if (!strncmp(pp,name,length)) break;676 pos =strchr(pp,'='); 677 if (pos) 678 length = pos -pp; 679 else 680 length = strlen(pp); 681 if (!strncmp(pp,name,length)) break; 683 682 } 684 if ((pp)&& (pos)) 683 if ((pp)&& (pos)) 685 684 { 686 pp = pos+1;687 TRACE("got %s\n",pp);685 pp = pos+1; 686 TRACE("got %s\n",pp); 688 687 } 689 688 FreeEnvironmentStringsA( environ ); … … 696 695 */ 697 696 INT CDECL CRTDLL__except_handler2 ( 698 PEXCEPTION_RECORD rec,699 PEXCEPTION_FRAME frame,700 PCONTEXT context,701 PEXCEPTION_FRAME *dispatcher)702 { 703 FIXME ("exception %lx flags=%lx at %p handler=%p %p %p stub\n",704 rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress,705 frame->Handler, context, dispatcher);706 return ExceptionContinueSearch;697 PEXCEPTION_RECORD rec, 698 PEXCEPTION_FRAME frame, 699 PCONTEXT context, 700 PEXCEPTION_FRAME *dispatcher) 701 { 702 FIXME ("exception %lx flags=%lx at %p handler=%p %p %p stub\n", 703 rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress, 704 frame->Handler, context, dispatcher); 705 return ExceptionContinueSearch; 707 706 } 708 707 … … 725 724 { 726 725 // return (_toascii(c)); 727 726 728 727 return c & 0x7f; 729 728 } … … 755 754 { 756 755 // return (_iscsym(c)); 757 756 758 757 return (isalnum(c) || c == '_'); 759 758 } … … 774 773 { 775 774 // return (_iscsymf(c)); 776 775 777 776 return (isalpha(c) || c == '_'); 778 777 } … … 847 846 { 848 847 if (cf((LPVOID*)match, (LPVOID*)pStart) == 0) 849 return pStart; /* found */848 return pStart; /* found */ 850 849 pStart += elem_size; 851 850 } while (--size); … … 915 914 { 916 915 // return (_toupper(n)); 917 916 918 917 return toupper(c); 919 918 } … … 926 925 { 927 926 // return (_tolower(n)); 928 927 929 928 return tolower(c); 930 929 } … … 947 946 { 948 947 // return (_cabs(c)); 949 948 950 949 return sqrt(c.real * c.real + c.imaginary * c.imaginary); 951 950 } … … 1007 1006 * 1008 1007 * Reset the state of the floating point processor. 1009 * 1008 * 1010 1009 * PARAMS 1011 1010 * None.  - 
      
trunk/src/crtdll/dir.c
r6645 r6712 1 /* $Id: dir.c,v 1.5 2001-09-05 12:14:24 bird Exp $ */2 1 /* 3 2 * CRTDLL drive/directory functions 4 * 3 * 5 4 * Copyright 1996,1998 Marcus Meissner 6 5 * Copyright 1996 Jukka Iivonen … … 58 57 * RETURNS 59 58 * Sucess: 0 60 * 59 * 61 60 * Failure: -1 62 61 */ … … 65 64 dprintf(("CRTDLL: _chdir(%s)\n", 66 65 newdir)); 67 66 68 67 if (!SetCurrentDirectoryA(newdir)) 69 68 { … … 85 84 * RETURNS 86 85 * Sucess: 0 87 * 88 * Failure: 1 86 * 87 * Failure: 1 89 88 */ 90 89 BOOL CDECL CRTDLL__chdrive(INT newdrive) … … 92 91 char buffer[3] = "A:"; 93 92 buffer[0] += newdrive - 1; 94 93 95 94 dprintf(("CRTDLL: _chdrive(%s)\n", 96 95 buffer)); 97 96 98 97 if (!SetCurrentDirectoryA( buffer )) 99 98 { … … 109 108 /********************************************************************* 110 109 * _findclose (CRTDLL.098) 111 * 110 * 112 111 * Free the resources from a search handle created from _findfirst. 113 112 * … … 124 123 dprintf(("CRTDLL: _findclose(%08xh)\n", 125 124 hand)); 126 125 127 126 if (!FindClose((HANDLE)hand)) 128 127 { … … 142 141 * PARAMS 143 142 * fspec [in] File specification string for search, e.g "C:\*.BAT" 144 * 143 * 145 144 * ft [out] A pointer to a find_t structure to populate. 146 145 * … … 156 155 WIN32_FIND_DATAA find_data; 157 156 HANDLE hfind; 158 157 159 158 dprintf(("CRTDLL: _findfirst(%s)\n", 160 159 fspec)); … … 174 173 /********************************************************************* 175 174 * _findnext (CRTDLL.100) 176 * 175 * 177 176 * Return the next matching file/directory from a search hadle. 178 177 * 179 178 * PARAMS 180 179 * hand [in] Search handle from a pervious call to _findfirst 181 * 180 * 182 181 * ft [out] A pointer to a find_t structure to populate. 183 182 * … … 191 190 { 192 191 WIN32_FIND_DATAA find_data; 193 192 194 193 dprintf(("CRTDLL: _findnext(%08xh)\n", 195 194 hand)); 196 195 197 196 if (!FindNextFileA(hand, &find_data)) 198 197 { … … 225 224 { 226 225 // return (_getcwd(buf, size)); 227 226 228 227 char dir[_MAX_PATH]; 229 228 int dir_len = GetCurrentDirectoryA(_MAX_PATH,dir); 230 229 231 230 dprintf(("CRTDLL: _getcwd()\n")); 232 231 233 232 if (dir_len < 1) 234 233 return NULL; /* FIXME: Real return value untested */ … … 259 258 { 260 259 // return (_getdcwd(drive, buffer, maxlen)); 261 260 262 261 static CHAR* dummy; 263 262 264 263 dprintf(("CRTDLL: _getdcwd()\n")); 265 264 266 265 if (!drive || drive == CRTDLL__getdrive()) 267 266 return CRTDLL__getcwd(buf,size); /* current */ … … 306 305 DWORD ret[4]; 307 306 UINT err; 308 307 309 308 dprintf(("CRTDLL: _getdiskfree(%08xh)\n", disk)); 310 309 311 310 if (disk > 26) 312 311 return ERROR_INVALID_PARAMETER; /* CRTDLL doesn't set errno here */ … … 336 335 { 337 336 // return DRIVE_GetCurrentDrive() + 1; 338 337 339 338 char buffer[MAX_PATH]; 340 339 341 340 dprintf(("CRTDLL: _getdrive()\n")); 342 341 343 if (!GetCurrentDirectoryA( sizeof(buffer), buffer )) 344 return 0; 345 if (buffer[1] != ':') 342 if (!GetCurrentDirectoryA( sizeof(buffer), buffer )) 343 return 0; 344 if (buffer[1] != ':') 346 345 return 0; 347 346 return toupper(buffer[0]) - 'A' + 1; … … 358 357 dprintf(("CRTDLL: _mkdir(%s)\n", 359 358 newdir)); 360 359 361 360 if (CreateDirectoryA(newdir,NULL)) 362 361 return 0; … … 369 368 * _rmdir (CRTDLL.255) 370 369 * 371 * Delete a directory 370 * Delete a directory 372 371 * 373 372 */ … … 376 375 dprintf(("CRTDLL: _rmdir(%s)\n", 377 376 dir)); 378 377 379 378 if (RemoveDirectoryA(dir)) 380 379 return 0;  - 
      
trunk/src/crtdll/exit.c
r6645 r6712 1 /* $Id: exit.c,v 1.2 2001-09-05 12:14:24 bird Exp $ */2 1 /* 3 2 * CRTDLL exit/abort/atexit functions 4 * 3 * 5 4 * Copyright 1996,1998 Marcus Meissner 6 5 * Copyright 1996 Jukka Iivonen … … 11 10 * and whether they return to the caller (really!). 12 11 * return do 13 * Name to caller? cleanup? 12 * Name to caller? cleanup? 14 13 * _c_exit Y N 15 14 * _cexit Y Y … … 55 54 56 55 /********************************************************************* 57 * __dllonexit(CRTDLL.25)56 * __dllonexit (CRTDLL.25) 58 57 */ 59 58 VOID CDECL CRTDLL___dllonexit () 60 { 59 { 61 60 dprintf(("__dllonexit not implemented.\n")); 62 61 SetLastError(ERROR_CALL_NOT_IMPLEMENTED); … … 65 64 66 65 /********************************************************************* 67 * _abnormal_termination(CRTDLL.36)66 * _abnormal_termination (CRTDLL.36) 68 67 */ 69 68 int CDECL CRTDLL__abnormal_termination(void) … … 84 83 { 85 84 dprintf2(("CRTDLL: _amsg_exit\n")); 86 85 87 86 // fprintf(stderr,strerror(errnum)); 88 87 // ExitProcess(-1); 89 88 90 89 CRTDLL_fprintf(CRTDLL_stderr,"\nrun-time error:\nError Code %d\n",errnum); 91 90 CRTDLL__exit(255); … … 96 95 * _assert (CRTDLL.041) 97 96 * 98 * Print an assertion message and call abort(). Really only present 97 * Print an assertion message and call abort(). Really only present 99 98 * for win binaries. Winelib programs would typically use libc's 100 99 * version. … … 103 102 { 104 103 dprintf2(("CRTDLL: _assert\n")); 105 104 106 105 CRTDLL_fprintf(CRTDLL_stderr,"Assertion failed: %s, file %s, line %d\n\n", 107 106 (char*)str,(char*)file, line); 108 107 CRTDLL_abort(); 109 108 110 109 // _assert(str, file, line); 111 110 } … … 120 119 dprintf2(("_c_exit(%d)\n",ret)); 121 120 FIXME("not calling CRTDLL cleanup\n"); 122 121 123 122 /* dont exit, return to caller */ 124 123 125 124 ExitProcess(ret); 126 125 } … … 136 135 FIXME("not calling CRTDLL cleanup\n"); 137 136 /* dont exit, return to caller */ 138 137 139 138 ExitProcess(ret); 140 139 } … … 146 145 VOID CDECL CRTDLL__exit(LONG ret) 147 146 { 148 dprintf2(("CRTDLL: _exit (%08xh)\n", 147 dprintf2(("CRTDLL: _exit (%08xh)\n", 149 148 ret)); 150 149 TRACE(":exit code %ld\n",ret); … … 200 199 { 201 200 dprintf2(("CRTDLL: abort\n")); 202 201 203 202 CRTDLL_fprintf(CRTDLL_stderr,"\nabnormal program termination\n"); 204 203 CRTDLL__exit(3); … … 208 207 209 208 /********************************************************************* 210 * atexit (CRTDLL.342)209 * atexit (CRTDLL.342) 211 210 * 212 211 * Register a function to be called when the process terminates. … … 215 214 { 216 215 dprintf(("CRTDLL: atexit\n")); 217 216 218 217 return CRTDLL__onexit(func) == func ? 0 : -1; 219 218 220 219 // if (_atexit_n >= sizeof (_atexit_v) / sizeof (_atexit_v[0])) 221 220 // return -1;  - 
      
trunk/src/crtdll/file.c
r6645 r6712 1 /* $Id: file.c,v 1.3 2001-09-05 12:14:24 bird Exp $ */2 1 /* 3 2 * CRTDLL file functions 4 * 3 * 5 4 * Copyright 1996,1998 Marcus Meissner 6 5 * Copyright 1996 Jukka Iivonen … … 9 8 * 10 9 * Implementation Notes: 11 * Mapping is performed between FILE*, fd and HANDLE's. This allows us to 12 * implement all calls using the Win32 API, support remapping fd's to 10 * Mapping is performed between FILE*, fd and HANDLE's. This allows us to 11 * implement all calls using the Win32 API, support remapping fd's to 13 12 * FILES and do some other tricks as well (like closeall, _get_osfhandle). 14 13 * For mix and matching with the host libc, processes can use the Win32 HANDLE … … 129 128 else 130 129 while(__CRTDLL_fdstart < __CRTDLL_fdend && 131 __CRTDLL_handles[__CRTDLL_fdstart] != INVALID_HANDLE_VALUE)130 __CRTDLL_handles[__CRTDLL_fdstart] != INVALID_HANDLE_VALUE) 132 131 __CRTDLL_fdstart++; 133 132 … … 144 143 { 145 144 TRACE(":fd (%d) allocating FILE*\n",fd); 146 if (fd < 0 || fd >= __CRTDLL_fdend || 145 if (fd < 0 || fd >= __CRTDLL_fdend || 147 146 __CRTDLL_handles[fd] == INVALID_HANDLE_VALUE) 148 147 { … … 179 178 180 179 TRACE(":handles (%d)(%d)(%d)\n",__CRTDLL_handles[0], 181 __CRTDLL_handles[1],__CRTDLL_handles[2]);180 __CRTDLL_handles[1],__CRTDLL_handles[2]); 182 181 183 182 for (i = 0; i < 3; i++) … … 196 195 { 197 196 // return (_access(path, mode)); 198 197 199 198 DWORD attr = GetFileAttributesA(filename); 200 199 … … 203 202 if (!filename) 204 203 { 205 /* FIXME: Should GetFileAttributesA() return this? */204 /* FIXME: Should GetFileAttributesA() return this? */ 206 205 __CRTDLL__set_errno(ERROR_INVALID_DATA); 207 206 return -1; … … 304 303 { 305 304 // return (__eof(_fd)); 306 305 307 306 DWORD curpos,endpos; 308 307 HANDLE hand = __CRTDLL__fdtoh(fd); … … 339 338 { 340 339 // return (_fcloseall()); 341 340 342 341 int num_closed = 0, i = 3; 343 342 … … 362 361 { 363 362 // return (_fdopen(handle, mode)); 364 363 365 364 CRTDLL_FILE* file = __CRTDLL__alloc_fp(fd); 366 365 … … 379 378 { 380 379 // return (_fgetchar()); 381 380 382 381 return CRTDLL_fgetc(CRTDLL_stdin); 383 382 } … … 391 390 * becomes negative. We ensure that _cnt is always 0 after any read 392 391 * so this function is always called. Our implementation simply calls 393 * fgetc as all the underlying buffering is handled by Wines 392 * fgetc as all the underlying buffering is handled by Wines 394 393 * implementation of the Win32 file I/O calls. 395 394 */ … … 411 410 { 412 411 // return (_fileno(f)); 413 412 414 413 TRACE(":FILE* (%p) fd (%d)\n",file,file->_file); 415 414 return file->_file; … … 441 440 { 442 441 // return (_flushall()); 443 442 444 443 int num_flushed = 0, i = 3; 445 444 … … 448 447 { 449 448 if (CRTDLL__commit(i) == -1) 450 if (__CRTDLL_files[i])451 __CRTDLL_files[i]->_flag |= _IOERR;449 if (__CRTDLL_files[i]) 450 __CRTDLL_files[i]->_flag |= _IOERR; 452 451 num_flushed++; 453 452 } … … 466 465 { 467 466 // return(_fputchar(c)); 468 467 469 468 return CRTDLL_fputc(c, CRTDLL_stdout); 470 469 } … … 485 484 /********************************************************************* 486 485 * _fstat (CRTDLL.111) 487 * 486 * 488 487 * Get information about an open file. 489 488 */ … … 491 490 { 492 491 // return (_fstat(file, buf)); 493 492 494 493 DWORD dw; 495 494 BY_HANDLE_FILE_INFORMATION hfi; … … 549 548 { 550 549 /* FIXME: I'm not convinced that I should be copying the 551 * handle here - it may be leaked if the app doesn't 550 * handle here - it may be leaked if the app doesn't 552 551 * close it (and the API docs dont say that it should) 553 552 * Not duplicating it means that it can't be inherited … … 558 557 */ 559 558 DuplicateHandle(GetCurrentProcess(),hand,GetCurrentProcess(), 560 &newhand,0,TRUE,DUPLICATE_SAME_ACCESS );559 &newhand,0,TRUE,DUPLICATE_SAME_ACCESS ); 561 560 } 562 561 return newhand; … … 589 588 { 590 589 // return (_lseek(handle, offset, origin)); 591 590 592 591 LONG ret; 593 592 HANDLE hand = __CRTDLL__fdtoh(fd); … … 778 777 { 779 778 // return (_setmode(fh, mode)); 780 779 781 780 if (mode & _O_TEXT) 782 781 FIXME("fd (%d) mode (%d) TEXT not implemented\n",fd,mode); … … 791 790 { 792 791 // return(_stat(s1, n)); 793 792 794 793 DWORD dw; 795 794 WIN32_FILE_ATTRIBUTE_DATA hfi; … … 827 826 { 828 827 unsigned int ext = tolower(path[plen-1]) | (tolower(path[plen-2]) << 8) 829 | (tolower(path[plen-3]) << 16);828 | (tolower(path[plen-3]) << 16); 830 829 if (ext == EXE || ext == BAT || ext == CMD || ext == COM) 831 mode |= CRTDLL_S_IEXEC;830 mode |= CRTDLL_S_IEXEC; 832 831 } 833 832 } … … 844 843 buf->st_mtime = buf->st_ctime = dw; 845 844 TRACE("\n%d %d %d %d %d %d\n", buf->st_mode,buf->st_nlink,buf->st_size, 846 buf->st_atime,buf->st_mtime, buf->st_ctime);845 buf->st_atime,buf->st_mtime, buf->st_ctime); 847 846 return 0; 848 847 } … … 857 856 { 858 857 // return (_tell(i)); 859 858 860 859 return CRTDLL__lseek(fd, 0, SEEK_CUR); 861 860 } … … 864 863 /********************************************************************* 865 864 * _tempnam (CRTDLL.305) 866 * 865 * 867 866 */ 868 867 LPSTR CDECL CRTDLL__tempnam(LPCSTR dir, LPCSTR prefix) 869 868 { 870 869 // return (_tempnam(dir, prefix)); 871 870 872 871 char tmpbuf[MAX_PATH]; 873 872 … … 891 890 { 892 891 // return (_umask(i)); 893 892 894 893 INT old_umask = __CRTDLL_umask; 895 894 TRACE("umask (%d)\n",umask); … … 977 976 { 978 977 // return (fclose(fp)); 979 978 980 979 return CRTDLL__close(file->_file); 981 980 } … … 990 989 { 991 990 // return (feof(fp)); 992 991 993 992 return file->_flag & _IOEOF; 994 993 } … … 1003 1002 { 1004 1003 // return (ferror(fp)); 1005 1004 1006 1005 return file->_flag & _IOERR; 1007 1006 } … … 1025 1024 { 1026 1025 // return (fgetc(fp)); 1027 1026 1028 1027 char c; 1029 1028 if (CRTDLL__read(file->_file,&c,1) != 1) … … 1051 1050 { 1052 1051 // return (fgets(s, n, fp)); 1053 1052 1054 1053 int cc; 1055 1054 LPSTR buf_start = s; 1056 1055 1057 1056 TRACE(":file(%p) fd (%d) str (%p) len (%d)\n", 1058 file,file->_file,s,size);1057 file,file->_file,s,size); 1059 1058 1060 1059 /* BAD, for the whole WINE process blocks... just done this way to test … … 1089 1088 { 1090 1089 // return (fputs(s, fp)); 1091 1090 1092 1091 return CRTDLL_fwrite(s,strlen(s),1,file); 1093 1092 } … … 1100 1099 { 1101 1100 // return (fprintf(file, format, arg)); 1102 1101 1103 1102 va_list valist; 1104 1103 INT res; … … 1119 1118 { 1120 1119 // return (fopen( filename, mode)); 1121 1120 1122 1121 CRTDLL_FILE* file; 1123 1122 INT flags = 0, plus = 0, fd; … … 1183 1182 { 1184 1183 // return (fputc(c, fp)); 1185 1184 1186 1185 return CRTDLL__write(file->_file, &c, 1) == 1? c : EOF; 1187 1186 } … … 1194 1193 { 1195 1194 // return (fread(ptr, size, n, fp)); 1196 1195 1197 1196 DWORD read = CRTDLL__read(file->_file,ptr, size * nmemb); 1198 1197 if (read <= 0) … … 1204 1203 /********************************************************************* 1205 1204 * freopen (CRTDLL.379) 1206 * 1205 * 1207 1206 */ 1208 1207 CRTDLL_FILE* CDECL CRTDLL_freopen(LPCSTR path, LPCSTR mode,CRTDLL_FILE* file) 1209 1208 { 1210 1209 // return (freopen(filename, mode, fp)); 1211 1210 1212 1211 CRTDLL_FILE* newfile; 1213 1212 INT fd; … … 1257 1256 { 1258 1257 // return (fsetpos(fp, pos)); 1259 1258 1260 1259 return CRTDLL__lseek(file->_file,*pos,SEEK_SET); 1261 1260 } … … 1393 1392 { 1394 1393 // return (fseek(file, offset, whence)); 1395 1394 1396 1395 return CRTDLL__lseek(file->_file,offset,whence); 1397 1396 } … … 1404 1403 { 1405 1404 // return (ftell(fp)); 1406 1405 1407 1406 return CRTDLL__tell(file->_file); 1408 1407 } … … 1429 1428 { 1430 1429 // return (getchar()); 1431 1430 1432 1431 return CRTDLL_fgetc(CRTDLL_stdin); 1433 1432 } … … 1460 1459 */ 1461 1460 for(cc = CRTDLL_fgetc(CRTDLL_stdin); cc != EOF && cc != '\n'; 1462 cc = CRTDLL_fgetc(CRTDLL_stdin))1463 if(cc != '\r') *buf++ = (char)cc;1461 cc = CRTDLL_fgetc(CRTDLL_stdin)) 1462 if(cc != '\r') *buf++ = (char)cc; 1464 1463 1465 1464 *buf = '\0'; … … 1498 1497 { 1499 1498 // return puts( s ); 1500 1499 1501 1500 return CRTDLL_fputs(s, CRTDLL_stdout); 1502 1501 } … … 1512 1511 { 1513 1512 // rewind(fp); 1514 1513 1515 1514 TRACE(":file (%p) fd (%d)\n",file,file->_file); 1516 1515 CRTDLL__lseek(file->_file,0,SEEK_SET); … … 1525 1524 { 1526 1525 // return (remove(file)); 1527 1526 1528 1527 TRACE(":path (%s)\n",path); 1529 1528 if (DeleteFileA(path)) … … 1541 1540 { 1542 1541 // return (rename(old, new2)); 1543 1542 1544 1543 TRACE(":from %s to %s\n",oldpath,newpath); 1545 1544 if (MoveFileExA( oldpath, newpath, MOVEFILE_REPLACE_EXISTING)) … … 1557 1556 { 1558 1557 // setbuf(fp, buf); 1559 1558 1560 1559 TRACE(":file (%p) fd (%d) buf (%p)\n", file, file->_file,buf); 1561 1560 if (buf) … … 1570 1569 * 1571 1570 * lcclnk from lcc-win32 relies on a terminating dot in the name returned 1572 * 1571 * 1573 1572 */ 1574 1573 LPSTR CDECL CRTDLL_tmpnam(LPSTR s) 1575 1574 { 1576 1575 // return (tmpnam(s)); 1577 1576 1578 1577 char tmpbuf[MAX_PATH]; 1579 1578 char* prefix = "TMP"; … … 1600 1599 { 1601 1600 // return (vfprintf(file, format, args)); 1602 1601 1603 1602 /* FIXME: We should parse the format string, calculate the maximum, 1604 1603 * length of each arg, malloc a buffer, print to it, and fwrite that.  - 
      
trunk/src/crtdll/initterm.cpp
r6645 r6712 1 /* $Id: initterm.cpp,v 1.7 2001-09-05 12:14:25 bird Exp $ */2 1 /* 3 2 * DLL entry point … … 56 55 case DLL_THREAD_ATTACH: 57 56 case DLL_THREAD_DETACH: 58 return CRTDLL_Init(hinstDLL, fdwReason, fImpLoad);57 return CRTDLL_Init(hinstDLL, fdwReason, fImpLoad); 59 58 60 59 case DLL_PROCESS_DETACH: 61 CRTDLL_Init(hinstDLL, fdwReason, fImpLoad);62 ctordtorTerm();63 return TRUE;60 CRTDLL_Init(hinstDLL, fdwReason, fImpLoad); 61 ctordtorTerm(); 62 return TRUE; 64 63 } 65 64 return FALSE; … … 91 90 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/ 92 91 93 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab);94 if(dllHandle == 0) 95 return 0UL;92 // dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab); 93 // if(dllHandle == 0) 94 // return 0UL; 96 95 97 96 break; 98 97 case 1 : 99 if(dllHandle) {100 UnregisterLxDll(dllHandle);101 }98 // if(dllHandle) { 99 // UnregisterLxDll(dllHandle); 100 // } 102 101 break; 103 102  - 
      
trunk/src/crtdll/memory.c
r6645 r6712 1 /* $Id: memory.c,v 1.3 2001-09-05 12:14:25 bird Exp $ */2 1 /* 3 2 * CRTDLL memory functions 4 * 3 * 5 4 * Copyright 1996,1998 Marcus Meissner 6 5 * Copyright 1996 Jukka Iivonen … … 33 32 VOID* result; 34 33 if(!(result = HeapAlloc(GetProcessHeap(),0,size)) && new_handler) 35 (*new_handler)();34 (*new_handler)(); 36 35 return result; 37 36 } … … 80 79 { 81 80 // return (_heapchk()); 82 81 83 82 if (!HeapValidate( GetProcessHeap(), 0, NULL)) 84 83 { … … 98 97 { 99 98 // return (_heapmin()); 100 99 101 100 if (!HeapCompact( GetProcessHeap(), 0 )) 102 101 { … … 117 116 { 118 117 // return (_heapset(fill)); 119 118 120 119 INT retVal; 121 120 struct _heapinfo heap; … … 145 144 phe.wFlags = next->_useflag == _USEDENTRY ? PROCESS_HEAP_ENTRY_BUSY : 0; 146 145 147 if (phe.lpData && phe.wFlags & PROCESS_HEAP_ENTRY_BUSY && 146 if (phe.lpData && phe.wFlags & PROCESS_HEAP_ENTRY_BUSY && 148 147 !HeapValidate( GetProcessHeap(), 0, phe.lpData )) 149 148 { … … 181 180 { 182 181 // return (_msize(ptr)); 183 182 184 183 LONG size = HeapSize(GetProcessHeap(),0,mem); 185 184 if (size == -1) … … 216 215 /********************************************************************* 217 216 * malloc (CRTDLL.424) 218 * 217 * 219 218 * Alocate memory from the heap. 220 219 */  - 
      
trunk/src/crtdll/spawn.c
r6645 r6712 1 /* $Id: spawn.c,v 1.3 2001-09-05 12:14:25 bird Exp $ */2 1 /* 3 2 * CRTDLL spawn functions 4 * 3 * 5 4 * Copyright 1996,1998 Marcus Meissner 6 5 * Copyright 1996 Jukka Iivonen … … 25 24 * Implementation Notes: 26 25 * MT Safe - But only because of missing functionality. 27 * 26 * 28 27 * After translating input arguments into the required format for 29 28 * CreateProcess(), the internal function __CRTDLL__spawn() is … … 83 82 84 83 if (!CreateProcessA(exe, args, NULL, NULL, TRUE, 85 flags == _P_DETACH ? DETACHED_PROCESS : 0,86 env, NULL, &si, &pi))84 flags == _P_DETACH ? DETACHED_PROCESS : 0, 85 env, NULL, &si, &pi)) 87 86 { 88 87 __CRTDLL__set_errno(GetLastError()); … … 158 157 { 159 158 // return (_spawnve(i, s1, s2, s3)); 160 159 161 160 LPSTR args = __CRTDLL__argvtos(argv,' '); 162 161 LPSTR envs = __CRTDLL__argvtos(envv,0); … … 187 186 { 188 187 // return system(string); 189 188 190 189 /* FIXME: should probably launch cmd interpreter in COMSPEC */ 191 190 return __CRTDLL__spawn(_P_WAIT, NULL, x, NULL);  
  Note:
 See   TracChangeset
 for help on using the changeset viewer.
  