- Timestamp:
- Aug 28, 2006, 3:19:56 AM (19 years ago)
- Location:
- branches/libc-0.6/src/emx
- Files:
-
- 2 edited
-
ChangeLog.LIBC (modified) (1 diff)
-
src/lib/sys/logstrict.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/libc-0.6/src/emx/ChangeLog.LIBC
r2795 r2796 5 5 2006-08-27: knut st. osmundsen <[email protected]> 6 6 - libc: 7 7 8 o Corrected DosSetFHState mask. Fixes #118. 8 9 o Implemented the new length modifiers for *scanf. Adjusted the length -
branches/libc-0.6/src/emx/src/lib/sys/logstrict.c
r2654 r2796 62 62 #include <machine/param.h> 63 63 #include <InnoTekLIBC/thread.h> 64 64 65 65 66 #define INCL_BASE … … 98 99 *******************************************************************************/ 99 100 /** Hex digits. */ 100 static const char gszHexDigits[17] = "0123456789abcdef";101 static const char gszHexDigits[17] = "0123456789abcdef"; 101 102 /** Uppercase hex digits. */ 102 static const char gszHexDigitsUpper[17] = "0123456789ABCDEF"; 103 static const char gszHexDigitsUpper[17] = "0123456789ABCDEF"; 104 /** Pointer to default logger instance. */ 105 static __LIBC_PLOGINST gpDefault; 103 106 104 107 … … 116 119 static int __libc_logVSNPrintf(char *pszBuffer, size_t cchBuffer, const char *pszFormat, va_list args); 117 120 static int __libc_logSNPrintf(char *pszBuffer, size_t cchBuffer, const char *pszFormat, ...) __printflike(3, 4); 121 118 122 119 123 … … 247 251 while (i-- > 0) 248 252 DosClose(ah[i]); 253 254 255 256 257 258 259 260 249 261 } 250 262 } … … 263 275 int cch; 264 276 277 265 278 DosGetInfoBlocks(&pTib, &pPib); 266 279 DosGetDateTime(&dt); 267 268 280 cch = __libc_logSNPrintf(pszMsg, CCHTMPMSGBUFFER, 269 281 "Opened log at %04d-%02d-%02d %02d:%02d:%02d.%02d\n" 270 "Process ID: %#x (%d) Parent PID: %#x (%d) \n",282 "Process ID: %#x (%d) Parent PID: %#x (%d)\n", 271 283 dt.year, dt.month, dt.day, dt.hours, dt.minutes, dt.seconds, dt.hundredths, 272 (int)pPib->pib_ulpid, (unsigned)pPib->pib_ulpid, (int)pPib->pib_ulppid, (unsigned)pPib->pib_ulppid); 284 (int)pPib->pib_ulpid, (unsigned)pPib->pib_ulpid, (int)pPib->pib_ulppid, (unsigned)pPib->pib_ulppid, 285 (int)pPib->pib_ultype); 273 286 DosWrite(pInst->hFile, pszMsg, cch, &cb); 274 287 288 275 289 cch = __libc_logSNPrintf(pszMsg, CCHTMPMSGBUFFER, 276 290 "Exe hmte : %#x (", 277 291 (unsigned)pPib->pib_hmte); 278 292 DosWrite(pInst->hFile, pszMsg, cch, &cb); 279 if (DosQueryModuleName(pPib->pib_hmte, CCHTMPMSGBUFFER , pszMsg))293 if (DosQueryModuleName(pPib->pib_hmte, CCHTMPMSGBUFFER, pszMsg)) 280 294 pszMsg[0] = '\0'; 281 295 cch = strlen(pszMsg); … … 284 298 DosWrite(pInst->hFile, pszMsg, cch, &cb); 285 299 300 286 301 cch = __libc_logSNPrintf(pszMsg, CCHTMPMSGBUFFER, 287 302 "First arg : %s\n" … … 292 307 cch = strlen(psz); 293 308 DosWrite(pInst->hFile, psz, cch, &cb); 294 295 char szMod[CCHMAXPATH]; 309 DosWrite(pInst->hFile, "\n", 1, &cb); 310 311 /* The current drive and directory. */ 312 ULONG ulDisk = 0; 313 ULONG fLogical = 0; 314 if (!DosQueryCurrentDisk(&ulDisk, &fLogical)) 315 { 316 cch = __libc_logSNPrintf(pszMsg, CCHTMPMSGBUFFER, 317 "Cur dir : %c:\\", 318 (char)ulDisk + ('A' - 1)); 319 DosWrite(pInst->hFile, pszMsg, cch, &cb); 320 321 ULONG cchDir = CCHTMPMSGBUFFER - 4; 322 if (DosQueryCurrentDir(ulDisk, (PSZ)pszMsg, &cchDir)) 323 pszMsg[0] = '\0'; 324 cch = strlen(pszMsg); 325 pszMsg[cch++] = '\n'; 326 DosWrite(pInst->hFile, pszMsg, cch, &cb); 327 } 328 329 /* The CRT module. */ 330 char szMod[128]; 296 331 ULONG iObj = ~0; 297 332 ULONG offObj = ~0; 298 333 HMODULE hmod = ~0; 299 334 if (DosQueryModFromEIP(&hmod, &iObj, sizeof(szMod), &szMod[0], &offObj, (uintptr_t)__libc_logInit)) 335 300 336 szMod[0] = '\0'; 337 338 301 339 cch = __libc_logSNPrintf(pszMsg, CCHTMPMSGBUFFER, 302 "\n" 303 "CRT Module: %s hmod=%#lx\n" 340 "CRT Module: %s hmod=%#lx (", 341 szMod, hmod); 342 DosWrite(pInst->hFile, pszMsg, cch, &cb); 343 344 if ( hmod == NULLHANDLE 345 || DosQueryModuleName(hmod, CCHTMPMSGBUFFER - 4, pszMsg)) 346 pszMsg[0] = '\0'; 347 cch = strlen(pszMsg); 348 pszMsg[cch++] = ')'; 349 pszMsg[cch++] = '\n'; 350 DosWrite(pInst->hFile, pszMsg, cch, &cb); 351 352 cch = __libc_logSNPrintf(pszMsg, CCHTMPMSGBUFFER, 304 353 "__libc_logInit: addr %p iObj=%ld offObj=%#lx\n", 305 szMod, hmod,(void *)__libc_logInit, iObj, offObj);354 (void *)__libc_logInit, iObj, offObj); 306 355 DosWrite(pInst->hFile, pszMsg, cch, &cb); 307 356 308 357 /* column headers */ 309 358 cch = __libc_logSNPrintf(pszMsg, CCHTMPMSGBUFFER, 310 359 " Millsecond Timestamp.\n" … … 436 485 static void *__libc_logDefault(void) 437 486 { 438 /** Pointer to default logger instance. */439 static __LIBC_PLOGINST pDefault;440 487 /** Set if we've already tried to init the log, but failed. */ 441 488 static int fAlreadyTried; 442 489 443 if ( pDefault)444 return pDefault;490 if (pDefault) 491 return pDefault; 445 492 else if (!fAlreadyTried) 446 493 { … … 501 548 __libc_logSNPrintf(szFilename, sizeof(szFilename), "libc_%04x.log", getPid()); 502 549 if (__libc_logInit(&DefInst, 0, &DefGrps, szFilename)) 503 pDefault = &DefInst;550 pDefault = &DefInst; 504 551 505 552 /* … … 509 556 } 510 557 511 return pDefault;558 return pDefault; 512 559 } 513 560 … … 2210 2257 } 2211 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419
Note:
See TracChangeset
for help on using the changeset viewer.
