Abandonment of the project
This commit is contained in:
23
main.c
23
main.c
@@ -14,6 +14,8 @@
|
||||
#include "event_loop.h"
|
||||
#include "server.h"
|
||||
#include "utils.h"
|
||||
#include "priv_medium.h"
|
||||
#include "medium_list.h"
|
||||
|
||||
/*
|
||||
* Data
|
||||
@@ -165,6 +167,22 @@ static void server_deinit() {
|
||||
server_close();
|
||||
}
|
||||
|
||||
// Setup the medium based on extension choice.
|
||||
static bool medium_setup() {
|
||||
const char *ext = cli_arg_get("E");
|
||||
int i = 0;
|
||||
for (;;) {
|
||||
if (strcmp(ext, MEDIUM_LIST[i])) {
|
||||
i += 2;
|
||||
continue;
|
||||
}
|
||||
((void (*)())MEDIUM_LIST[i + 1])();
|
||||
return true;
|
||||
}
|
||||
fprintf(stderr, "[!] Extension '%s' is not supported\n", ext);
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Callbacks and main
|
||||
*/
|
||||
@@ -200,6 +218,9 @@ int main(int argc, char **argv) {
|
||||
print_usage_text();
|
||||
return 1;
|
||||
}
|
||||
if (!medium_setup) {
|
||||
return 1;
|
||||
}
|
||||
if (!loop_init(on_fd_event)) {
|
||||
return 1;
|
||||
}
|
||||
@@ -221,6 +242,7 @@ int main(int argc, char **argv) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
pm_init();
|
||||
// Loop
|
||||
while (_to_work) {
|
||||
if (!loop_wait()) {
|
||||
@@ -230,6 +252,7 @@ int main(int argc, char **argv) {
|
||||
fprintf(stderr, "--- loop ---\n");
|
||||
}
|
||||
// Termination
|
||||
pm_deinit();
|
||||
if (_is_server) {
|
||||
server_close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user