Fossil SCM

Add the "test-file-copy" command for testing the file_copy() procedure.

drh 2014-02-27 23:27 trunk
Commit 190353e90dee70fa089b8a2f6672974516fcef52
1 file changed +16
+16
--- src/file.c
+++ src/file.c
@@ -402,10 +402,26 @@
402402
fwrite(zBuf, 1, got, out);
403403
}
404404
fclose(in);
405405
fclose(out);
406406
}
407
+
408
+/*
409
+** COMMAND: test-file-copy
410
+**
411
+** Usage: %fossil test-file-copy SOURCE DESTINATION
412
+**
413
+** Make a copy of the file at SOURCE into a new name DESTINATION. Any
414
+** directories in the path leading up to DESTINATION that do not already
415
+** exist are created automatically.
416
+*/
417
+void test_file_copy(void){
418
+ if( g.argc!=4 ){
419
+ fossil_fatal("Usage: %s test-file-copy SOURCE DESTINATION", g.argv[0]);
420
+ }
421
+ file_copy(g.argv[2], g.argv[3]);
422
+}
407423
408424
/*
409425
** Set or clear the execute bit on a file. Return true if a change
410426
** occurred and false if this routine is a no-op.
411427
*/
412428
--- src/file.c
+++ src/file.c
@@ -402,10 +402,26 @@
402 fwrite(zBuf, 1, got, out);
403 }
404 fclose(in);
405 fclose(out);
406 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
407
408 /*
409 ** Set or clear the execute bit on a file. Return true if a change
410 ** occurred and false if this routine is a no-op.
411 */
412
--- src/file.c
+++ src/file.c
@@ -402,10 +402,26 @@
402 fwrite(zBuf, 1, got, out);
403 }
404 fclose(in);
405 fclose(out);
406 }
407
408 /*
409 ** COMMAND: test-file-copy
410 **
411 ** Usage: %fossil test-file-copy SOURCE DESTINATION
412 **
413 ** Make a copy of the file at SOURCE into a new name DESTINATION. Any
414 ** directories in the path leading up to DESTINATION that do not already
415 ** exist are created automatically.
416 */
417 void test_file_copy(void){
418 if( g.argc!=4 ){
419 fossil_fatal("Usage: %s test-file-copy SOURCE DESTINATION", g.argv[0]);
420 }
421 file_copy(g.argv[2], g.argv[3]);
422 }
423
424 /*
425 ** Set or clear the execute bit on a file. Return true if a change
426 ** occurred and false if this routine is a no-op.
427 */
428

Keyboard Shortcuts

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