Fossil SCM
Add the "test-file-copy" command for testing the file_copy() procedure.
Commit
190353e90dee70fa089b8a2f6672974516fcef52
Parent
f991688730b21e4…
1 file changed
+16
+16
| --- src/file.c | ||
| +++ src/file.c | ||
| @@ -402,10 +402,26 @@ | ||
| 402 | 402 | fwrite(zBuf, 1, got, out); |
| 403 | 403 | } |
| 404 | 404 | fclose(in); |
| 405 | 405 | fclose(out); |
| 406 | 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 | +} | |
| 407 | 423 | |
| 408 | 424 | /* |
| 409 | 425 | ** Set or clear the execute bit on a file. Return true if a change |
| 410 | 426 | ** occurred and false if this routine is a no-op. |
| 411 | 427 | */ |
| 412 | 428 |
| --- 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 |