Fossil SCM
Enhance the test-canonical-name command to provide additional file measurement diagnostics.
Commit
7fbaee790a40022986859bf1d9d38fa76fa2d875
Parent
b48f78964e78a0f…
1 file changed
+9
-1
+9
-1
| --- src/file.c | ||
| +++ src/file.c | ||
| @@ -291,21 +291,29 @@ | ||
| 291 | 291 | blob_resize(pOut, file_simplify_name(blob_buffer(pOut), blob_size(pOut))); |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | /* |
| 295 | 295 | ** COMMAND: test-canonical-name |
| 296 | +** Usage: %fossil test-canonical-name FILENAME... | |
| 296 | 297 | ** |
| 297 | 298 | ** Test the operation of the canonical name generator. |
| 299 | +** Also test Fossil's ability to measure attributes of a file. | |
| 298 | 300 | */ |
| 299 | 301 | void cmd_test_canonical_name(void){ |
| 300 | 302 | int i; |
| 301 | 303 | Blob x; |
| 302 | 304 | blob_zero(&x); |
| 303 | 305 | for(i=2; i<g.argc; i++){ |
| 304 | - file_canonical_name(g.argv[i], &x); | |
| 306 | + const char *zName = g.argv[i]; | |
| 307 | + file_canonical_name(zName, &x); | |
| 305 | 308 | printf("%s\n", blob_buffer(&x)); |
| 306 | 309 | blob_reset(&x); |
| 310 | + printf(" file_size = %lld\n", file_size(zName)); | |
| 311 | + printf(" file_mtime = %lld\n", file_mtime(zName)); | |
| 312 | + printf(" file_isfile = %d\n", file_isfile(zName)); | |
| 313 | + printf(" file_isexe = %d\n", file_isexe(zName)); | |
| 314 | + printf(" file_isdir = %d\n", file_isdir(zName)); | |
| 307 | 315 | } |
| 308 | 316 | } |
| 309 | 317 | |
| 310 | 318 | /* |
| 311 | 319 | ** Return TRUE if the given filename is canonical. |
| 312 | 320 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -291,21 +291,29 @@ | |
| 291 | blob_resize(pOut, file_simplify_name(blob_buffer(pOut), blob_size(pOut))); |
| 292 | } |
| 293 | |
| 294 | /* |
| 295 | ** COMMAND: test-canonical-name |
| 296 | ** |
| 297 | ** Test the operation of the canonical name generator. |
| 298 | */ |
| 299 | void cmd_test_canonical_name(void){ |
| 300 | int i; |
| 301 | Blob x; |
| 302 | blob_zero(&x); |
| 303 | for(i=2; i<g.argc; i++){ |
| 304 | file_canonical_name(g.argv[i], &x); |
| 305 | printf("%s\n", blob_buffer(&x)); |
| 306 | blob_reset(&x); |
| 307 | } |
| 308 | } |
| 309 | |
| 310 | /* |
| 311 | ** Return TRUE if the given filename is canonical. |
| 312 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -291,21 +291,29 @@ | |
| 291 | blob_resize(pOut, file_simplify_name(blob_buffer(pOut), blob_size(pOut))); |
| 292 | } |
| 293 | |
| 294 | /* |
| 295 | ** COMMAND: test-canonical-name |
| 296 | ** Usage: %fossil test-canonical-name FILENAME... |
| 297 | ** |
| 298 | ** Test the operation of the canonical name generator. |
| 299 | ** Also test Fossil's ability to measure attributes of a file. |
| 300 | */ |
| 301 | void cmd_test_canonical_name(void){ |
| 302 | int i; |
| 303 | Blob x; |
| 304 | blob_zero(&x); |
| 305 | for(i=2; i<g.argc; i++){ |
| 306 | const char *zName = g.argv[i]; |
| 307 | file_canonical_name(zName, &x); |
| 308 | printf("%s\n", blob_buffer(&x)); |
| 309 | blob_reset(&x); |
| 310 | printf(" file_size = %lld\n", file_size(zName)); |
| 311 | printf(" file_mtime = %lld\n", file_mtime(zName)); |
| 312 | printf(" file_isfile = %d\n", file_isfile(zName)); |
| 313 | printf(" file_isexe = %d\n", file_isexe(zName)); |
| 314 | printf(" file_isdir = %d\n", file_isdir(zName)); |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | /* |
| 319 | ** Return TRUE if the given filename is canonical. |
| 320 |