mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-24 02:46:21 +00:00
Add /plugins install command
This commit is contained in:
26
src/common.c
26
src/common.c
@@ -38,6 +38,7 @@
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -155,6 +156,31 @@ mkdir_recursive(const char *dir)
|
||||
return result;
|
||||
}
|
||||
|
||||
gboolean
|
||||
copy_file(const char *const sourcepath, const char *const targetpath)
|
||||
{
|
||||
int ch;
|
||||
FILE *source = fopen(sourcepath, "rb");
|
||||
if (source == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
FILE *target = fopen(targetpath, "wb");
|
||||
if (target == NULL) {
|
||||
fclose(source);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
while((ch = fgetc(source)) != EOF) {
|
||||
fputc(ch, target);
|
||||
}
|
||||
|
||||
fclose(source);
|
||||
fclose(target);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
char*
|
||||
str_replace(const char *string, const char *substr,
|
||||
const char *replacement)
|
||||
|
||||
Reference in New Issue
Block a user