#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
+#include <math.h>
#include <unistd.h>
#include "file_size.h"
unsigned long long splitgroesse, int length)
{
struct file_size *rest = (struct file_size *)malloc(length * sizeof(struct file_size));
+ unsigned long long filesize = 0;
int restcount = 0;
FILE *out;
+ // First 32768 bytes are unused by ISO9660
+ splitgroesse -= 32768;
+
out = fopen(output, "w");
for(int i = 0; i <= length; i++) {
+ // ISO9660 filesystem overhead
+ filesize = 33 + strlen(input[i].name) + input[i].fsize;
+ filesize = ceil(filesize/2048) * 2048;
// filesize inklusive overhead
- if(splitgroesse >= input[i].fsize) {
- splitgroesse -= input[i].fsize;
+ if(splitgroesse >= filesize) {
+ splitgroesse -= filesize;
fprintf(out, "%s\n", input[i].name);
} else {
rest[restcount++] = input[i];