add copy function
This commit is contained in:
parent
b7b31abc0e
commit
2fe41b8c0e
17
libglacier.c
17
libglacier.c
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include <color.h>
|
||||
#include <fcntl.h>
|
||||
#include <libconfig.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
@ -153,6 +154,22 @@ load_setting_from_config()
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
copy_file(char pkg[], char workpkg[])
|
||||
{
|
||||
char cwd[PATH_MAX];
|
||||
FILE *localpkg, *newpkg;
|
||||
|
||||
localpkg = fopen(pkg, "r");
|
||||
newpkg = fopen(workpkg, "a+");
|
||||
|
||||
contents = fgetc(localpkg);
|
||||
while (contents != EOF) {
|
||||
fputc(contents, newpkg);
|
||||
contents = fgetc(localpkg);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user