Fossil SCM
Add the test-tempname command for testing the file_tempname() routine.
Commit
f1d23f04c00cc6028012240ed0a13092efa7e921d6a8c6ba1af4830ac5dff5d6
Parent
e474c177dfefd5b…
1 file changed
+17
+17
| --- src/file.c | ||
| +++ src/file.c | ||
| @@ -1452,10 +1452,27 @@ | ||
| 1452 | 1452 | #else |
| 1453 | 1453 | fossil_path_free((char *)azDirs[0]); |
| 1454 | 1454 | #endif |
| 1455 | 1455 | } |
| 1456 | 1456 | |
| 1457 | + | |
| 1458 | +/* | |
| 1459 | +** COMMAND: test-tempname | |
| 1460 | +** Usage: fossil test-name BASENAME ... | |
| 1461 | +** | |
| 1462 | +** Generate temporary filenames derived from BASENAME | |
| 1463 | +*/ | |
| 1464 | +void file_test_tempname(void){ | |
| 1465 | + int i; | |
| 1466 | + Blob x = BLOB_INITIALIZER; | |
| 1467 | + for(i=2; i<g.argc; i++){ | |
| 1468 | + file_tempname(&x, g.argv[i]); | |
| 1469 | + fossil_print("%s\n", blob_str(&x)); | |
| 1470 | + blob_reset(&x); | |
| 1471 | + } | |
| 1472 | +} | |
| 1473 | + | |
| 1457 | 1474 | |
| 1458 | 1475 | /* |
| 1459 | 1476 | ** Return true if a file named zName exists and has identical content |
| 1460 | 1477 | ** to the blob pContent. If zName does not exist or if the content is |
| 1461 | 1478 | ** different in any way, then return false. |
| 1462 | 1479 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -1452,10 +1452,27 @@ | |
| 1452 | #else |
| 1453 | fossil_path_free((char *)azDirs[0]); |
| 1454 | #endif |
| 1455 | } |
| 1456 | |
| 1457 | |
| 1458 | /* |
| 1459 | ** Return true if a file named zName exists and has identical content |
| 1460 | ** to the blob pContent. If zName does not exist or if the content is |
| 1461 | ** different in any way, then return false. |
| 1462 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -1452,10 +1452,27 @@ | |
| 1452 | #else |
| 1453 | fossil_path_free((char *)azDirs[0]); |
| 1454 | #endif |
| 1455 | } |
| 1456 | |
| 1457 | |
| 1458 | /* |
| 1459 | ** COMMAND: test-tempname |
| 1460 | ** Usage: fossil test-name BASENAME ... |
| 1461 | ** |
| 1462 | ** Generate temporary filenames derived from BASENAME |
| 1463 | */ |
| 1464 | void file_test_tempname(void){ |
| 1465 | int i; |
| 1466 | Blob x = BLOB_INITIALIZER; |
| 1467 | for(i=2; i<g.argc; i++){ |
| 1468 | file_tempname(&x, g.argv[i]); |
| 1469 | fossil_print("%s\n", blob_str(&x)); |
| 1470 | blob_reset(&x); |
| 1471 | } |
| 1472 | } |
| 1473 | |
| 1474 | |
| 1475 | /* |
| 1476 | ** Return true if a file named zName exists and has identical content |
| 1477 | ** to the blob pContent. If zName does not exist or if the content is |
| 1478 | ** different in any way, then return false. |
| 1479 |