25 #include <sys/types.h>
86 const char *p = strrchr(
src,
'/');
89 sprintf(
path,
"%s/%s",
dst, (p ? p + 1 :
src));
94 if ((fd =
open(
src, O_RDONLY)) < 0)
97 if ((fd2 =
open(
dst, O_CREAT | O_TRUNC | O_WRONLY, sb.st_mode & 0777)) <
103 while ((len =
read(fd, buf,
sizeof(buf))) > 0) {
104 while ((len > 0) && (len2 =
write(fd2, buf, (
size_t)len)) >= 0)
142 sprintf(path2,
"%s/%s",
dst, dp->
d_name);
int G_recursive_copy(const char *src, const char *dst)
Copy recursively source directory to destination directory.
int G_lstat(const char *, struct stat *)
Get file status.
int G_mkdir(const char *)
Creates a new directory.
Header file for msvc/open.c and msvc/creat.c.
DIR * opendir(const char *name)
struct dirent * readdir(DIR *dir)