some small updates

This commit is contained in:
jakani24
2024-01-14 12:54:07 +01:00
parent 343720365a
commit f1ca006998
36 changed files with 128 additions and 99 deletions

View File

@@ -4,6 +4,7 @@
#include "log.h"
#include "well_known.h"
#include "scan.h"
#include "app_ctrl.h"
void split(char* input,char*delimiter, char* out1, char* out2) {
//split a string at the delimiter. the delimiter only occurs once. so the first part is out1 and the second part is out2
int i = 0;
@@ -28,22 +29,26 @@ void split(char* input,char*delimiter, char* out1, char* out2) {
}
}
}
int start_thread(const char*command) {
char*out2= new char[100]; //for the command
char*out1 = new char[300]; //for the arguments
split((char*)command, (char*)";", (char*)out1, (char*)out2);
int start_thread(const char* command) {
if (can_run_thread()) {
char* out2 = new char[100]; //for the command
char* out1 = new char[300]; //for the arguments
split((char*)command, (char*)";", (char*)out1, (char*)out2);
//printf("out1: %s\n", out1);
//printf("out2: %s\n", out2);
//determine what should be executed
if(strcmp(out1,"scanfile")==0){
//start a new thread with the scanfile function
std::thread t1(action_scanfile, out2);
//printf("out1: %s\n", out1);
//printf("out2: %s\n", out2);
//determine what should be executed
if (strcmp(out1, "scanfile") == 0) {
//start a new thread with the scanfile function
std::thread t1(action_scanfile, out2);
}
else if (strcmp(out1, "scanfolder") == 0) {
//start a new thread with the scanfolder function
std::thread t1(action_scanfolder, out2);
}
delete[] out1;
delete[] out2;
}
delete[] out1;
delete[] out2;
return 0;
}