Add /plugins install command

This commit is contained in:
James Booth
2016-07-12 23:50:21 +01:00
parent 5f393a6d9f
commit 0991699ae6
7 changed files with 218 additions and 106 deletions

View File

@@ -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)