41 lines
966 B
C
41 lines
966 B
C
#include "copytron.h"
|
|
#include <string.h>
|
|
|
|
|
|
copytron_file copytronFileCreate() {
|
|
copytron_file file = {"", 0};
|
|
return file;
|
|
}
|
|
|
|
copytron_flips copytronFlipsCreate() {
|
|
copytron_flips flips;
|
|
flips.file_count = 0;
|
|
for(int i = 0; i < 100; i++) {
|
|
flips.files[i] = copytronFileCreate();
|
|
}
|
|
return flips;
|
|
}
|
|
|
|
int copytronAdd(copytron_flips* flips, copytron_file* file) {
|
|
for(int i = 0; i < 100; i++) {
|
|
if(flips->files[i].file_path_len == 0) {
|
|
flips->files[i] = *file;
|
|
flips->file_count++;
|
|
}
|
|
}
|
|
return flips->file_count;
|
|
}
|
|
|
|
int copytronRemove(copytron_flips* flips, copytron_file* file) {
|
|
for(int i = 0; i < 100; i++) {
|
|
if(flips->file_count != 0) {
|
|
if(strcmp(flips->files[i].path, file->path)) {
|
|
//flips->files[i].path = 0x00;
|
|
flips->files[i].file_path_len = 0;
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
return 1;
|
|
}
|