Changeset 3148 for trunk/tools
- Timestamp:
- Mar 17, 2000, 8:26:50 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/fastdep/fastdep.c
r3137 r3148 1 /* $Id: fastdep.c,v 1.1 3 2000-03-17 10:42:22bird Exp $1 /* $Id: fastdep.c,v 1.14 2000-03-17 19:26:50 bird Exp $ 2 2 * 3 3 * Fast dependents. (Fast = Quick and Dirty!) … … 293 293 int i; 294 294 const char *pszDepFile = pszDefaultDepFile; 295 char achBuffer[4096]; 295 296 296 297 static char szObjectDir[CCHMAXPATH]; … … 334 335 } 335 336 strlwr(szCurDir); 336 for (i = 0, cSlashes; szCurDir[i] != '\0'; i++) 337 aiSlashes[0] = 0; 338 for (i = 1, cSlashes; szCurDir[i] != '\0'; i++) 337 339 { 338 340 if (szCurDir[i] == '/') … … 506 508 507 509 } 510 else if (argv[argi][0] == '@') 511 { /* 512 * Parameter file (debugger parameter length restrictions led to this): 513 * Create a textbuffer. 514 * Parse the file and create a new parameter vector. 515 * Set argv to the new parameter vector, argi to 0 and argc to 516 * the parameter count. 517 * Restrictions: Parameters enclosed in "" is not implemented. 518 * No commandline parameters are processed after the @file 519 */ 520 char *pszBuffer = (char*)textbufferCreate(&argv[argi][1]); /* !ASSUMS! that pvBuffer is the file string! */ 521 if (pszBuffer != NULL) 522 { 523 char **apszArgs = NULL; 524 char *psz = pszBuffer; 525 int i = 0; 526 527 while (*psz != '\0') 528 { 529 /* find end of parameter word */ 530 char *pszEnd = psz + 1; 531 char ch = *pszEnd; 532 while (ch != ' ' && ch != '\t' && ch != '\n' && ch != '\r' && ch != '\0') 533 ch = *++pszEnd; 534 535 /* allocate more arg array space? */ 536 if ((i % 512) == 0) 537 { 538 apszArgs = realloc(apszArgs, sizeof(char*) * 512); 539 if (apszArgs == NULL) 540 { 541 fprintf(stderr, "error: out of memory. (line=%d)\n", __LINE__); 542 return -8; 543 } 544 } 545 *pszEnd = '\0'; 546 apszArgs[i++] = psz; 547 548 /* next */ 549 psz = pszEnd + 1; 550 ch = *psz; 551 while (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') 552 ch = *++psz; 553 } 554 555 argc = i; 556 argi = 0; 557 argv = apszArgs; 558 continue; 559 } 560 else 561 { 562 fprintf(stderr, "error: could not open parameter file\n"); 563 return -1; 564 } 565 } 508 566 else 509 567 { /* not a parameter! */ 510 568 ULONG ulRc; 511 char achBuffer[4096];512 569 PFILEFINDBUF3 pfindbuf3 = (PFILEFINDBUF3)(void*)&achBuffer[0]; 513 570 HDIR hDir = HDIR_CREATE; … … 1407 1464 1408 1465 strcpy(szFile, pszFilename); 1409 iSlash = *psz == '\\' ? 0: cSlashes;1466 iSlash = *psz == '\\' ? 1 : cSlashes; 1410 1467 while (*psz != '\0') 1411 1468 { … … 1436 1493 /** 1437 1494 * Normalizes the path slashes for the filename. It will partially expand paths too. 1495 * Makes name all lower case too. 1438 1496 * @returns pszFilename 1439 1497 * @param pszFilename Pointer to filename string. Not empty string! … … 1443 1501 char *fileNormalize2(const char *pszFilename, char *pszBuffer) 1444 1502 { 1445 char *psz = pszBuffer;1446 1447 /* expand path? */ 1503 char * psz = pszBuffer; 1504 int iSlash; 1505 1448 1506 if (pszFilename[1] != ':') 1449 { /* relative path */ 1450 int iSlash; 1451 1452 iSlash = *pszFilename == '\\' || *pszFilename == '/' ? 0 : cSlashes; 1507 { 1508 /* iSlash */ 1509 if (*pszFilename == '\\' || *pszFilename == '/') 1510 iSlash = 1; 1511 else 1512 iSlash = cSlashes; 1513 1514 /* interpret . and .. */ 1453 1515 while (*pszFilename != '\0') 1454 1516 { … … 1464 1526 } 1465 1527 else 1466 { /* completed expantion! */1528 { /* completed expantion! - TODO ..\ or .\ may appare within the remaining path too... */ 1467 1529 strncpy(pszBuffer, szCurDir, aiSlashes[iSlash]+1); 1468 1530 strcpy(pszBuffer + aiSlashes[iSlash]+1, pszFilename); … … 1471 1533 } 1472 1534 } 1473 /* else: assume full path */ 1535 else 1536 { /* have drive letter specified - assume ok (TODO)*/ 1537 strcpy(pszBuffer, pszFilename); 1538 } 1474 1539 1475 1540 /* correct slashes */ 1476 1541 while ((pszBuffer = strchr(pszBuffer, '//')) != NULL) 1477 1542 *pszBuffer++ = '\\'; 1543 1544 /* lower case it */ 1545 strlwr(psz); 1478 1546 1479 1547 return psz; … … 2161 2229 || psz[i+1] == '\t' 2162 2230 || psz[i+1] == '\0' 2163 || psz[i+1] == '\\'2231 || (psz[i+1] == '\\' && psz[i+2] == '\0') 2164 2232 ) 2165 2233 ) 2234 { 2235 psz[i] = '\0'; 2236 pvRule = depAddRule(trimR(psz), NULL, NULL); 2237 psz += i + 1; 2238 cch -= i + 1; 2239 fMoreDeps = TRUE; 2166 2240 break; 2241 } 2167 2242 i++; 2168 }2169 2170 if (psz[i] == ':')2171 { /* new rule! */2172 psz[i] = '\0';2173 pvRule = depAddRule(trimR(psz), NULL, NULL);2174 psz += i + 1;2175 cch -= i + 1;2176 fMoreDeps = TRUE;2177 2243 } 2178 2244 }
Note:
See TracChangeset
for help on using the changeset viewer.