Differences From:
File
src/file.c
part of check-in
[2ecc407d9b]
- The "extra" and "clean" commands ignore the repository file if the
repository happens to be within the check-out. Ticket c7b35be88.
by
drh on
2008-07-23 13:01:23.
[view]
To:
File
src/file.c
part of check-in
[9236f0c086]
- Get cloning working for local files without the use of network I/O.
Ticket b3482d580e.
by
drh on
2008-10-05 12:34:14.
[view]
@@ -51,8 +51,26 @@
if( stat(zFilename, &buf)!=0 ){
return -1;
}
return buf.st_mtime;
+}
+
+/*
+** Copy the content of a file from one place to another.
+*/
+void file_copy(const char *zFrom, const char *zTo){
+ FILE *in, *out;
+ int got;
+ char zBuf[8192];
+ in = fopen(zFrom, "rb");
+ if( in==0 ) fossil_fatal("cannot open \"%s\" for reading", zFrom);
+ out = fopen(zTo, "wb");
+ if( out==0 ) fossil_fatal("cannot open \"%s\" for writing", zTo);
+ while( (got=fread(zBuf, 1, sizeof(zBuf), in))>0 ){
+ fwrite(zBuf, 1, got, out);
+ }
+ fclose(in);
+ fclose(out);
}
/*
** Return TRUE if the named file is an ordinary file. Return false