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") { ///---
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;
}
std::string ip = data.substr(0, data.find(":"));
@ -184,15 +184,14 @@ int loadDefaulOptions(Settings &settings)
} else if (what == "default-CheckMaxDirs") {
settings.default_maxDirs = atoi(data.c_str());
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;
}
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") {

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

break;

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

break;
case 't':

View File

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

//Ü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;
return 31;
}
@ -611,7 +611,7 @@ int ProgramManager::searchModus_update(Settings *settings)

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