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