Fossil SCM

Enhance the test-canonical-name command to provide additional file measurement diagnostics.

drh 2010-09-18 20:08 trunk
Commit 7fbaee790a40022986859bf1d9d38fa76fa2d875
1 file changed +9 -1
+9 -1
--- src/file.c
+++ src/file.c
@@ -291,21 +291,29 @@
291291
blob_resize(pOut, file_simplify_name(blob_buffer(pOut), blob_size(pOut)));
292292
}
293293
294294
/*
295295
** COMMAND: test-canonical-name
296
+** Usage: %fossil test-canonical-name FILENAME...
296297
**
297298
** Test the operation of the canonical name generator.
299
+** Also test Fossil's ability to measure attributes of a file.
298300
*/
299301
void cmd_test_canonical_name(void){
300302
int i;
301303
Blob x;
302304
blob_zero(&x);
303305
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);
305308
printf("%s\n", blob_buffer(&x));
306309
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));
307315
}
308316
}
309317
310318
/*
311319
** Return TRUE if the given filename is canonical.
312320
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button