-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from rounnus/dev
Dev
- Loading branch information
Showing
18 changed files
with
573 additions
and
574 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,3 +57,6 @@ dkms.conf | |
/service/ | ||
/autostart/ | ||
.idea | ||
|
||
*.swp | ||
*.swo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,8 +7,10 @@ enable_default_path 1 | |
|
||
[check] | ||
|
||
[done_check] | ||
[done] | ||
|
||
[targets] | ||
|
||
[done_targets] | ||
[done] | ||
[exclude] | ||
[done] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* config.h */ | ||
#ifndef FILE_SORTER_CORE_CONFIG_H | ||
#define FILE_SORTER_CORE_CONFIG_H | ||
|
||
#include <memory.h> | ||
|
||
#define FAILED_TO_PARSE -0x1 | ||
|
||
|
||
// config options. | ||
struct options | ||
{ | ||
unsigned int o_check_interval; // check interval option. | ||
unsigned int o_parse_interval; // parse interval option. | ||
unsigned int o_debug_log:1; // debug log option. | ||
char *o_default_path; // default path option. | ||
unsigned int o_enable_default:1; // enable default path option. | ||
}; | ||
|
||
// config lists. | ||
struct lists | ||
{ | ||
char *(*l_check_list); // the check list of the config. | ||
char *(*l_target_list); // the targests of the config. | ||
char *(*l_exclude_list); // the excludes of the config. | ||
|
||
}; | ||
|
||
// the config file. | ||
struct config | ||
{ | ||
struct options c_options; // the options of the config. | ||
struct lists c_lists; // the lists of the config. | ||
}; | ||
|
||
|
||
/** | ||
Initialize the variable that contains the config | ||
file. | ||
**/ | ||
static void inline init_config(struct config *config) | ||
{ | ||
memset(config, 0x0, sizeof(struct config)); | ||
} | ||
|
||
/** | ||
Parse the config file and save the informations | ||
inside the dst variable. | ||
@param dst The destination of where we put the config. | ||
*/ | ||
extern void parse_config(struct config *dst); | ||
|
||
extern void reparse_config(struct config *dst); | ||
|
||
extern void destroy_config(struct config *src); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#ifndef SORTER_LOGGER_H | ||
#define SORTER_LOGGER_H | ||
|
||
// log tyoes. | ||
#define ERROR 1 | ||
#define WAR 2 | ||
#define LOG 3 | ||
|
||
/** | ||
Logs a message. | ||
@param msg The message to log. | ||
@param type The type of the log. | ||
*/ | ||
extern void logger(const char *msg, int type); | ||
|
||
|
||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#ifndef SORTER_H | ||
#define SORTER_H | ||
|
||
#include <config.h> | ||
|
||
extern void start_sorter(struct config *src); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,32 @@ | ||
#include <manager.h> | ||
#ifdef __unix__ | ||
|
||
#include <malloc.h> | ||
|
||
int main() { | ||
run(); | ||
return 0; | ||
} | ||
#include <config.h> | ||
#include <sorter.h> | ||
|
||
#else | ||
// TODO - include logger. | ||
#endif | ||
|
||
|
||
|
||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
#ifdef __unix__ | ||
struct config config_p; | ||
// initialzize the config. | ||
init_config(&config_p); | ||
|
||
// parse config. | ||
parse_config(&config_p); | ||
|
||
// start procces | ||
start_sorter(&config_p); | ||
|
||
destroy_config(&config_p); | ||
#else | ||
// TODO - call logger and write that the oparating system is not compatiple. | ||
#endif | ||
} |
Oops, something went wrong.