fix errors

This commit is contained in:
Markus 2019-08-17 18:33:24 +02:00
parent ac24ea7906
commit f52a4d6dae
2 changed files with 7 additions and 10 deletions

View File

@ -132,7 +132,7 @@ int loadDefaulOptions(Settings &settings)


} else if (what == "Socks5Proxy") { ///--- } else if (what == "Socks5Proxy") { ///---
if(data.find(":") == std::string::npos) { if(data.find(":") == std::string::npos) {
std::cout << " => Error_Defaults: Ungültiger Socks5 Proxy: " << optarg << std::endl; std::cout << " => Error_Defaults: Ungültiger Socks5 Proxy: '" << data << "'" << std::endl;
return 31; return 31;
} }
std::string ip = data.substr(0, data.find(":")); std::string ip = data.substr(0, data.find(":"));
@ -184,15 +184,14 @@ int loadDefaulOptions(Settings &settings)
} else if (what == "default-CheckMaxDirs") { } else if (what == "default-CheckMaxDirs") {
settings.default_maxDirs = atoi(data.c_str()); settings.default_maxDirs = atoi(data.c_str());
if(std::to_string(settings.default_maxDirs) != data ) { if(std::to_string(settings.default_maxDirs) != data ) {
std::cout << " => Error_Defaults: Ungültige Zahl: " << data << std::endl; std::cout << " => Error_Defaults: default-CheckMaxDirs: Ungültige Zahl: " << data << std::endl;
return 18; return 18;
} }
if(settings.debugMode) if(settings.debugMode)
std::cout << " > Defaults: SuchMuster: " << settings.default_Searchmuster << std::endl; std::cout << " > Defaults: default-CheckMaxDirs: " << settings.default_maxDirs << std::endl;




} else if (what == "default-maxThreads") { } else if (what == "default-maxThreads") {

settings.maxThreads = static_cast<unsigned>(atoi(data.c_str())); settings.maxThreads = static_cast<unsigned>(atoi(data.c_str()));
if(std::to_string(settings.maxThreads) != data ) { if(std::to_string(settings.maxThreads) != data ) {
std::cout << " => Error_Defaults: Ungültige Zahl: " << data << std::endl; std::cout << " => Error_Defaults: Ungültige Zahl: " << data << std::endl;
@ -201,8 +200,6 @@ int loadDefaulOptions(Settings &settings)
if(settings.debugMode) if(settings.debugMode)
std::cout << " > Defaults: MaxThreads: " << settings.maxThreads << std::endl; std::cout << " > Defaults: MaxThreads: " << settings.maxThreads << std::endl;


break;

} else if (what == "FarbloseAusgabe") { } else if (what == "FarbloseAusgabe") {
if(data == "true") if(data == "true")
settings.colorless=true; settings.colorless=true;
@ -400,7 +397,7 @@ int unterOption_default(Settings *settings, int argc, char ** argv)
if(optarg) if(optarg)
settings->default_Searchmuster = optarg; settings->default_Searchmuster = optarg;
if(settings->debugMode) if(settings->debugMode)
std::cout << "SearchMuster: " << settings->default_Searchmuster << std::endl; std::cout << " SearchMuster: " << settings->default_Searchmuster << std::endl;
break; break;
case 'D': case 'D':
if(!optarg) if(!optarg)
@ -411,7 +408,7 @@ int unterOption_default(Settings *settings, int argc, char ** argv)
return 18; return 18;
} }
if(settings->debugMode) if(settings->debugMode)
std::cout << "SearchMuster: " << settings->default_Searchmuster << std::endl; std::cout << "CheckMaxDirs: " << settings->default_maxDirs << std::endl;


break; break;
case 't': case 't':

View File

@ -136,7 +136,7 @@ int ProgramManager::defaultModus(Settings *settings)
} }


//Überprüfe ob ein Muster existiert: //Überprüfe ob ein Muster existiert:
if(settings->default_Searchmuster == "") { if(settings->default_checkDirPath != "" && settings->default_Searchmuster == "") {
std::cout << " => Error: [-m]: Kein Muster angegeben." << std::endl; std::cout << " => Error: [-m]: Kein Muster angegeben." << std::endl;
return 31; return 31;
} }
@ -611,7 +611,7 @@ int ProgramManager::searchModus_update(Settings *settings)


int ProgramManager::listDir(std::string &list,std::string path, int maxDepth) int ProgramManager::listDir(std::string &list,std::string path, int maxDepth)
{ {
if(maxDepth == 0) if(maxDepth <= 0)
return 0; return 0;
else if(!dirExists(path)) { else if(!dirExists(path)) {
std::cout << " => Error: Verzeichnis '" << path << "' existiert nicht oder ist kein Ordner." << std::endl; std::cout << " => Error: Verzeichnis '" << path << "' existiert nicht oder ist kein Ordner." << std::endl;