add copy function

This commit is contained in:
Liam Waldron 2024-02-08 10:24:41 -05:00
parent b7b31abc0e
commit 2fe41b8c0e

View File

@ -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[])
{