Implement commits

This commit is contained in:
womax
2024-05-30 06:51:27 +02:00
parent 135dd8d4eb
commit d20d295817
17 changed files with 709 additions and 331 deletions

View File

@@ -1,4 +1,5 @@
#include <math.h>
#include <stdio.h>
#include "utils.h"
@@ -9,3 +10,15 @@ int decimal_len(size_t size)
return floor(log10(size)) + 1;
}
int get_top_folder(char* path, char* top_folder, char* left)
{
int i = 0;
for (;path[i] != '/' && path[i] != '\0'; i++);
if (path[i] == '\0') return 0;
path[i] = '\0';
sprintf(top_folder, "%s", path);
sprintf(left, "%s", path + i + 1);
path[i] = '/';
return 1;
}