Ready for Gera
parent
7ab6cbb099
commit
c604be20f1
|
@ -1,3 +1,6 @@
|
||||||
{
|
{
|
||||||
"makefile.extensionOutputFolder": "./.vscode"
|
"makefile.extensionOutputFolder": "./.vscode",
|
||||||
|
"files.associations": {
|
||||||
|
"config.h": "c"
|
||||||
|
}
|
||||||
}
|
}
|
19
config.h
19
config.h
|
@ -15,13 +15,6 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
// input console checking
|
// input console checking
|
||||||
#define HELP_CONSOLE_OPTION_1 "-h"
|
|
||||||
#define HELP_CONSOLE_OPTION_2 "--help"
|
|
||||||
#define GENKEY_CONSOLE_OPTION "genkey"
|
|
||||||
#define SIGNATURE_CONSOLE_OPTION "sign"
|
|
||||||
#define CHECK_CONSOLE_OPTION "check"
|
|
||||||
#define ENCRYPT_CONSOLE_OPTION "encrypt"
|
|
||||||
#define DECRYPT_CONSOLE_OPTION "decrypt"
|
|
||||||
|
|
||||||
// boolean
|
// boolean
|
||||||
#define BOOL int
|
#define BOOL int
|
||||||
|
@ -34,7 +27,8 @@
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Error codes
|
/// Error codes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
typedef enum {
|
typedef enum
|
||||||
|
{
|
||||||
SUCCESS,
|
SUCCESS,
|
||||||
FAILURE,
|
FAILURE,
|
||||||
NO_ARGUMENTS_FAILURE,
|
NO_ARGUMENTS_FAILURE,
|
||||||
|
@ -45,14 +39,19 @@ typedef enum {
|
||||||
FILENAME_SYMBOL_FAILURE,
|
FILENAME_SYMBOL_FAILURE,
|
||||||
FILENAME_ENDING_FAILURE,
|
FILENAME_ENDING_FAILURE,
|
||||||
FORMAT_FAILURE,
|
FORMAT_FAILURE,
|
||||||
|
EXISTING_NAME_FAILURE,
|
||||||
DEBUG_EXIT_CODE = 100
|
DEBUG_EXIT_CODE = 100
|
||||||
} ERROR_CODE;
|
} ERROR_CODE;
|
||||||
|
|
||||||
// fast funcs
|
// fast funcs
|
||||||
#define swap(a,b); b = a+b; a = b-a; b = b-a;
|
#define swap(a, b) \
|
||||||
|
; \
|
||||||
|
b = a + b; \
|
||||||
|
a = b - a; \
|
||||||
|
b = b - a;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#else
|
#else
|
||||||
#define max(a,b) (a>b)? a : b
|
#define max(a, b) (a > b) ? a : b
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // !CONFIG_H
|
#endif // !CONFIG_H
|
70
main.c
70
main.c
|
@ -1,48 +1,62 @@
|
||||||
#include "structs.h"
|
#include "structs.h"
|
||||||
|
#include <stdlib.h>
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
File new_file;
|
File new_file;
|
||||||
Folder new_folder;
|
Folder new_folder;
|
||||||
createFile("file1", "hehe", &new_file);
|
|
||||||
createFolder("root", &new_folder);
|
createFolder("root", &new_folder);
|
||||||
printf("%s\n", new_file.creation_time);
|
|
||||||
printf("%s\n", new_file.filename);
|
|
||||||
printf("%s\n", new_file.extension);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
printf("\n%s\n", new_folder.creation_time);
|
|
||||||
printf("%s\n", new_folder.filename);
|
|
||||||
printf("%d\n", new_folder.folders_count_cur);
|
|
||||||
printf("%d\n", new_folder.files_count_cur);
|
|
||||||
printf("%d\n", new_folder.files_count_max);
|
|
||||||
printf("%d\n", new_folder.folders_count_max);
|
|
||||||
|
|
||||||
printf("%d\n", new_folder.exists_into);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
printf("\n%d\n", addFolder("sos", &new_folder));
|
printf("\n%d\n", addFolder("sos", &new_folder));
|
||||||
printf("%d\n", new_folder.exists_into);
|
/*printf("%d\n", new_folder.exists_into);
|
||||||
printf("%d\n", new_folder.folders_count_cur);
|
printf("%d\n", new_folder.folders_count_cur);
|
||||||
printf("%d\n", new_folder.files_count_cur);
|
printf("%d\n", new_folder.files_count_cur);
|
||||||
printf("%d\n", new_folder.files_count_max);
|
printf("%d\n", new_folder.files_count_max);
|
||||||
printf("%d\n", new_folder.folders_count_max);
|
printf("%d\n", new_folder.folders_count_max);
|
||||||
printf("%s\n", new_folder.folders[0].creation_time);
|
printf("%s\n", new_folder.folders[0].creation_time);
|
||||||
printf("%s\n", new_folder.folders[0].filename);
|
printf("%s\n", new_folder.folders[0].filename);
|
||||||
|
*/
|
||||||
|
|
||||||
printf("\n%d\n", addFolder("sos2", &new_folder));
|
printf("\n%d\n", addFolder("sos2", &new_folder));
|
||||||
printf("%d\n", new_folder.exists_into);
|
// printf("%d\n", new_folder.exists_into);
|
||||||
printf("%d\n", new_folder.folders_count_cur);
|
// printf("%d\n", new_folder.folders_count_cur);
|
||||||
printf("%d\n", new_folder.files_count_cur);
|
// printf("%d\n", new_folder.files_count_cur);
|
||||||
printf("%d\n", new_folder.files_count_max);
|
// printf("%d\n", new_folder.files_count_max);
|
||||||
printf("%d\n", new_folder.folders_count_max);
|
// printf("%d\n", new_folder.folders_count_max);
|
||||||
printf("%s\n", new_folder.folders[1].creation_time);
|
printf("%s\n", new_folder.folders[1].creation_time);
|
||||||
printf("%s\n", new_folder.folders[1].filename);
|
// printf("%s\n", new_folder.folders[1].filename);
|
||||||
|
|
||||||
printf("%-*d%-*d%-*d\n", 10, 1376513765, 10, 123, 10, 1874);
|
// char name[10];
|
||||||
|
// for (i = 0; i < 400; i++)
|
||||||
|
// {
|
||||||
|
// sprintf(name, "%d", i);
|
||||||
|
// if (i % 2)
|
||||||
|
// {
|
||||||
|
// printf("\ni = %d : %d\n", i, addFile(name, "test", &new_folder));
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// printf("\ni = %d : %d\n", i, addFolder(name, &new_folder));
|
||||||
|
// }
|
||||||
|
// printf("%d\n", new_folder.exists_into);
|
||||||
|
// printf("%d\n", new_folder.folders_count_cur);
|
||||||
|
// printf("%d\n", new_folder.folders_count_max);
|
||||||
|
// printf("%d\n", new_folder.files_count_cur);
|
||||||
|
// printf("%d\n", new_folder.files_count_max);
|
||||||
|
// }
|
||||||
|
|
||||||
|
addFile("file1", "hehe", &new_folder);
|
||||||
|
addFile("file1", "hehe", &new_folder);
|
||||||
|
addFile("file1", "huh", &new_folder);
|
||||||
|
addFile("trash", "hehe", &new_folder);
|
||||||
|
addFile("AvadaBlyad Kedavra", "huy", &new_folder);
|
||||||
|
addFile("Ya v svoyom poznanii nastolko preispolnilsya", "budtobi3", &new_folder);
|
||||||
|
addFolder("Uh suka so smislam", &new_folder);
|
||||||
|
addFolder("Ya v svoyom poznanii nastolko preispolnilsya", &new_folder);
|
||||||
|
addFolder("Ya v svoyom poznanii nastolko preispolnilsya", &new_folder);
|
||||||
|
|
||||||
|
// printf("%-*d%-*d%-*d\n", 10, 1376513765, 10, 123, 10, 1874);
|
||||||
|
|
||||||
|
print_list(&new_folder, 1);
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
146
structs.c
146
structs.c
|
@ -1,40 +1,66 @@
|
||||||
#include "structs.h"
|
#include "structs.h"
|
||||||
|
|
||||||
int check_name(char* name)
|
int check_name(char *name)
|
||||||
{
|
{
|
||||||
int strln = strlen(name);
|
int strln = strlen(name);
|
||||||
int i;
|
int i;
|
||||||
char* symb;
|
char *symb;
|
||||||
|
|
||||||
if(strln > filename_lenth)
|
if (strln > filename_lenth)
|
||||||
return FILENAME_LENGTH_FAILURE;
|
return FILENAME_LENGTH_FAILURE;
|
||||||
|
|
||||||
for(i = 0; i < strln; i ++)
|
for (i = 0; i < strln; i++)
|
||||||
{
|
{
|
||||||
symb = strchr(right_symb, name[i]);
|
symb = strchr(right_symb_name, name[i]);
|
||||||
if(symb == 0)
|
if (symb == 0)
|
||||||
return FILENAME_SYMBOL_FAILURE;
|
return FILENAME_SYMBOL_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(name[strln-1] == '.')
|
if (name[strln - 1] == '.')
|
||||||
return FILENAME_ENDING_FAILURE;
|
return FILENAME_ENDING_FAILURE;
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int createFile(char* file_name, char* extension, File* file)
|
int check_ext(char *ext)
|
||||||
|
{
|
||||||
|
int strln = strlen(ext);
|
||||||
|
int i;
|
||||||
|
char *symb;
|
||||||
|
|
||||||
|
if (strln > extinsion_lenth)
|
||||||
|
return FILENAME_LENGTH_FAILURE;
|
||||||
|
|
||||||
|
for (i = 0; i < strln; i++)
|
||||||
|
{
|
||||||
|
symb = strchr(right_symb_ext, ext[i]);
|
||||||
|
if (symb == 0)
|
||||||
|
return FILENAME_SYMBOL_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ext[strln - 1] == '.')
|
||||||
|
return FILENAME_ENDING_FAILURE;
|
||||||
|
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int createFile(char *file_name, char *extension, File *file)
|
||||||
{
|
{
|
||||||
ERROR_CODE errno;
|
ERROR_CODE errno;
|
||||||
time_t time_now;
|
time_t time_now;
|
||||||
struct tm* time_info;
|
struct tm *time_info;
|
||||||
File result = {"\0","\0","\0"};
|
File result = {"\0", "\0", "\0"};
|
||||||
|
|
||||||
time(&time_now);
|
time(&time_now);
|
||||||
time_info = localtime(&time_now);
|
time_info = localtime(&time_now);
|
||||||
|
|
||||||
strftime (result.creation_time,creation_time_length,"%T %D",time_info);
|
strftime(result.creation_time, creation_time_length, "%T %D", time_info);
|
||||||
|
strftime(result.creation_date, creation_time_length, "%D ", time_info);
|
||||||
|
|
||||||
if((errno = check_name(file_name)) != SUCCESS)
|
if ((errno = check_name(file_name)) != SUCCESS)
|
||||||
|
return errno;
|
||||||
|
|
||||||
|
if ((errno = check_ext(extension)) != SUCCESS)
|
||||||
return errno;
|
return errno;
|
||||||
|
|
||||||
strcpy(result.filename, file_name);
|
strcpy(result.filename, file_name);
|
||||||
|
@ -42,16 +68,18 @@ int createFile(char* file_name, char* extension, File* file)
|
||||||
strcpy(result.extension, extension);
|
strcpy(result.extension, extension);
|
||||||
|
|
||||||
*file = result;
|
*file = result;
|
||||||
|
|
||||||
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int createFolder(char* folder_name, Folder* folder)
|
int createFolder(char *folder_name, Folder *folder)
|
||||||
{
|
{
|
||||||
ERROR_CODE errno;
|
ERROR_CODE errno;
|
||||||
time_t time_now;
|
time_t time_now;
|
||||||
struct tm* time_info;
|
struct tm *time_info;
|
||||||
Folder result = {0, 0, 1, 1, 0, "\0","\0"};
|
Folder result = {0, 0, 1, 1, 0, "\0", "\0"};
|
||||||
|
|
||||||
if((errno = check_name(folder_name)) != SUCCESS)
|
if ((errno = check_name(folder_name)) != SUCCESS)
|
||||||
return errno;
|
return errno;
|
||||||
|
|
||||||
strcpy(result.filename, folder_name);
|
strcpy(result.filename, folder_name);
|
||||||
|
@ -59,12 +87,13 @@ int createFolder(char* folder_name, Folder* folder)
|
||||||
time(&time_now);
|
time(&time_now);
|
||||||
time_info = localtime(&time_now);
|
time_info = localtime(&time_now);
|
||||||
|
|
||||||
strftime (result.creation_time,creation_time_length,"%T %D",time_info);
|
strftime(result.creation_time, creation_time_length, "%T %D", time_info);
|
||||||
|
strftime(result.creation_date, creation_time_length, "%D ", time_info);
|
||||||
|
|
||||||
result.files = (File*) malloc(sizeof(File));
|
result.files = (File *)malloc(sizeof(File));
|
||||||
result.folders = (Folder*) malloc(sizeof(Folder));
|
result.folders = (Folder *)malloc(sizeof(Folder));
|
||||||
|
|
||||||
if(result.files == NULL || result.folders == NULL)
|
if (result.files == NULL || result.folders == NULL)
|
||||||
return MEMORY_ALLOCATION_FAILURE;
|
return MEMORY_ALLOCATION_FAILURE;
|
||||||
|
|
||||||
*folder = result;
|
*folder = result;
|
||||||
|
@ -72,33 +101,41 @@ int createFolder(char* folder_name, Folder* folder)
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int addFolder(char* folder_name, Folder* fld)
|
int addFolder(char *folder_name, Folder *fld)
|
||||||
{
|
{
|
||||||
|
if (fld->exists_into < MAX_EXIST_OBJ)
|
||||||
|
{
|
||||||
int errno, i;
|
int errno, i;
|
||||||
Folder newFolder;
|
Folder newFolder;
|
||||||
Folder* buffer;
|
Folder *buffer;
|
||||||
|
|
||||||
|
for (i = 0; i < fld->folders_count_cur; i++)
|
||||||
|
{
|
||||||
|
if (!strcmp(folder_name, fld->folders[i].filename))
|
||||||
|
return EXISTING_NAME_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
errno = createFolder(folder_name, &newFolder);
|
errno = createFolder(folder_name, &newFolder);
|
||||||
if(errno != SUCCESS)
|
if (errno != SUCCESS)
|
||||||
return errno;
|
return errno;
|
||||||
|
|
||||||
fld->folders[fld->folders_count_cur] = newFolder;
|
fld->folders[fld->folders_count_cur] = newFolder;
|
||||||
fld->exists_into++;
|
fld->exists_into++;
|
||||||
fld->folders_count_cur++;
|
fld->folders_count_cur++;
|
||||||
|
|
||||||
if(fld->folders_count_cur == fld->folders_count_max)
|
if (fld->folders_count_cur == fld->folders_count_max)
|
||||||
{
|
{
|
||||||
fld->folders_count_max <<= 1;
|
fld->folders_count_max <<= 1;
|
||||||
buffer = (Folder*)malloc(sizeof(Folder) * (fld->folders_count_cur));
|
buffer = (Folder *)malloc(sizeof(Folder) * (fld->folders_count_cur));
|
||||||
if(buffer == NULL)
|
if (buffer == NULL)
|
||||||
return MEMORY_ALLOCATION_FAILURE;
|
return MEMORY_ALLOCATION_FAILURE;
|
||||||
for (i = 0; i < fld->folders_count_cur; ++i)
|
for (i = 0; i < fld->folders_count_cur; ++i)
|
||||||
{
|
{
|
||||||
buffer[i] = fld->folders[i];
|
buffer[i] = fld->folders[i];
|
||||||
}
|
}
|
||||||
free(fld->folders);
|
free(fld->folders);
|
||||||
fld->folders = (Folder*)malloc(sizeof(Folder) * (fld->folders_count_max));
|
fld->folders = (Folder *)malloc(sizeof(Folder) * (fld->folders_count_max));
|
||||||
if(fld->folders == NULL)
|
if (fld->folders == NULL)
|
||||||
return MEMORY_ALLOCATION_FAILURE;
|
return MEMORY_ALLOCATION_FAILURE;
|
||||||
for (i = 0; i < fld->folders_count_cur; ++i)
|
for (i = 0; i < fld->folders_count_cur; ++i)
|
||||||
{
|
{
|
||||||
|
@ -110,35 +147,44 @@ int addFolder(char* folder_name, Folder* fld)
|
||||||
fld->folders[fld->folders_count_cur].parent = fld;
|
fld->folders[fld->folders_count_cur].parent = fld;
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int addFile(char* file_name, char* extension, Folder* fld)
|
int addFile(char *file_name, char *extension, Folder *fld)
|
||||||
{
|
{
|
||||||
|
if (fld->exists_into < MAX_EXIST_OBJ)
|
||||||
|
{
|
||||||
int errno, i;
|
int errno, i;
|
||||||
File newFile;
|
File newFile;
|
||||||
File* buffer;
|
File *buffer;
|
||||||
|
|
||||||
|
for (i = 0; i < fld->files_count_cur; i++)
|
||||||
|
{
|
||||||
|
if (!strcmp(extension, fld->files[i].extension) && !strcmp(file_name, fld->files[i].filename))
|
||||||
|
return EXISTING_NAME_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
errno = createFile(file_name, extension, &newFile);
|
errno = createFile(file_name, extension, &newFile);
|
||||||
if(errno != SUCCESS)
|
if (errno != SUCCESS)
|
||||||
return errno;
|
return errno;
|
||||||
|
|
||||||
fld->files[fld->files_count_cur] = newFile;
|
fld->files[fld->files_count_cur] = newFile;
|
||||||
fld->exists_into++;
|
fld->exists_into++;
|
||||||
fld->files_count_cur++;
|
fld->files_count_cur++;
|
||||||
|
|
||||||
if(fld->files_count_cur == fld->files_count_max)
|
if (fld->files_count_cur == fld->files_count_max)
|
||||||
{
|
{
|
||||||
fld->files_count_max <<= 1;
|
fld->files_count_max <<= 1;
|
||||||
buffer = (File*)malloc(sizeof(File) * (fld->files_count_cur));
|
buffer = (File *)malloc(sizeof(File) * (fld->files_count_cur));
|
||||||
if(buffer == NULL)
|
if (buffer == NULL)
|
||||||
return MEMORY_ALLOCATION_FAILURE;
|
return MEMORY_ALLOCATION_FAILURE;
|
||||||
for (i = 0; i < fld->files_count_cur; ++i)
|
for (i = 0; i < fld->files_count_cur; ++i)
|
||||||
{
|
{
|
||||||
buffer[i] = fld->files[i];
|
buffer[i] = fld->files[i];
|
||||||
}
|
}
|
||||||
free(fld->files);
|
free(fld->files);
|
||||||
fld->files = (File*)malloc(sizeof(File) * (fld->files_count_max));
|
fld->files = (File *)malloc(sizeof(File) * (fld->files_count_max));
|
||||||
if(fld->files == NULL)
|
if (fld->files == NULL)
|
||||||
return MEMORY_ALLOCATION_FAILURE;
|
return MEMORY_ALLOCATION_FAILURE;
|
||||||
for (i = 0; i < fld->files_count_cur; ++i)
|
for (i = 0; i < fld->files_count_cur; ++i)
|
||||||
{
|
{
|
||||||
|
@ -150,9 +196,35 @@ int addFile(char* file_name, char* extension, Folder* fld)
|
||||||
fld->files[fld->files_count_cur].parent = fld;
|
fld->files[fld->files_count_cur].parent = fld;
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int print_list(Folder* fld)
|
int print_list(Folder *fld, int mode)
|
||||||
{
|
{
|
||||||
|
int i; // iterator
|
||||||
|
|
||||||
|
if (mode == 0) // simple
|
||||||
|
{
|
||||||
|
printf("Files:\n");
|
||||||
|
for (i = 0; i < fld->files_count_cur; i++)
|
||||||
|
printf("%*s.%-*s\n", filename_lenth, fld->files[i].filename, extinsion_lenth, fld->files[i].extension);
|
||||||
|
printf("Folders:\n");
|
||||||
|
for (i = 0; i < fld->folders_count_cur; i++)
|
||||||
|
printf("%*s\n", filename_lenth, fld->folders[i].filename);
|
||||||
|
}
|
||||||
|
if (mode == 1) // not simple
|
||||||
|
{
|
||||||
|
printf("┌──────────┬──────────┬────────────────────────────────────────────────────┬────────────┐\n");
|
||||||
|
printf("│ Time │ Date │ Filenames │ Extension │\n");
|
||||||
|
printf("├──────────┼──────────┼────────────────────────────────────────────────────┼────────────┤\n");
|
||||||
|
|
||||||
|
for (i = 0; i < fld->files_count_cur; i++)
|
||||||
|
printf("│ %s│ %s│ %*s │ %*s │\n", fld->files[i].creation_time, fld->files[i].creation_date, filename_lenth, fld->files[i].filename, extinsion_lenth, fld->files[i].extension);
|
||||||
|
printf("├──────────┼──────────┼────────────────────────────────────────────────────┼────────────┘\n");
|
||||||
|
printf("│ Time │ Date │ Foldernames │\n");
|
||||||
|
printf("├──────────┼──────────┼────────────────────────────────────────────────────┤\n");
|
||||||
|
for (i = 0; i < fld->folders_count_cur; i++)
|
||||||
|
printf("│ %s│ %s│ %*s │\n", fld->folders[i].creation_time, fld->folders[i].creation_date, filename_lenth, fld->folders[i].filename);
|
||||||
|
printf("└──────────┴──────────┴────────────────────────────────────────────────────┘\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
55
structs.h
55
structs.h
|
@ -3,38 +3,47 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
static const char right_symb[] = " qwertyuiop[]{}asdfghjkl;zxcvbnm,.?!@~`#№$%^&()+-0123456789";
|
#define MAX_EXIST_OBJ 255
|
||||||
|
|
||||||
|
static const char right_symb_name[] = " QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiop[]{}asdfghjkl;zxcvbnm,.?!@~`#№$%^&()+-0123456789";
|
||||||
|
static const char right_symb_ext[] = "QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm0123456789";
|
||||||
|
|
||||||
#define extinsion_lenth 10
|
#define extinsion_lenth 10
|
||||||
#define filename_lenth 50
|
#define filename_lenth 50
|
||||||
#define creation_time_length 17
|
#define creation_time_length 17
|
||||||
|
|
||||||
typedef struct _File{
|
typedef struct _File
|
||||||
char creation_time[creation_time_length+1];
|
{
|
||||||
char filename[filename_lenth+1];
|
char creation_time[creation_time_length + 1];
|
||||||
char extension[extinsion_lenth+1];
|
char creation_date[creation_time_length + 1];
|
||||||
struct _Folder* parent;
|
char filename[filename_lenth + 1];
|
||||||
}File;
|
char extension[extinsion_lenth + 1];
|
||||||
|
struct _Folder *parent;
|
||||||
|
} File;
|
||||||
|
|
||||||
int createFile(char* file_name, char* extension, File* file);
|
int createFile(char *file_name, char *extension, File *file);
|
||||||
|
|
||||||
typedef struct _Folder{
|
typedef struct _Folder
|
||||||
uint8_t files_count_cur;
|
{
|
||||||
uint8_t folders_count_cur;
|
uint16_t files_count_cur;
|
||||||
uint8_t files_count_max;
|
uint16_t folders_count_cur;
|
||||||
uint8_t folders_count_max;
|
uint16_t files_count_max;
|
||||||
uint8_t exists_into;
|
uint16_t folders_count_max;
|
||||||
char creation_time[creation_time_length+1];
|
uint16_t exists_into;
|
||||||
char filename[filename_lenth+1];
|
char creation_time[creation_time_length + 1];
|
||||||
File* files;
|
char creation_date[creation_time_length + 1];
|
||||||
struct _Folder* folders;
|
char filename[filename_lenth + 1];
|
||||||
struct _Folder* parent;
|
File *files;
|
||||||
}Folder;
|
struct _Folder *folders;
|
||||||
|
struct _Folder *parent;
|
||||||
|
} Folder;
|
||||||
|
|
||||||
int createFolder(char* folder_name, Folder* folder);
|
int createFolder(char *folder_name, Folder *folder);
|
||||||
|
|
||||||
int addFolder(char* folder_name, Folder* fld);
|
int addFolder(char *folder_name, Folder *fld);
|
||||||
|
|
||||||
int addFile(char* file_name, char* extension, Folder* fld);
|
int addFile(char *file_name, char *extension, Folder *fld);
|
||||||
|
|
||||||
|
int print_list(Folder *fld, int mode);
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in New Issue