Skip to content

Commit

Permalink
Merge pull request #824 from jkottiku/master
Browse files Browse the repository at this point in the history
Corrected cmd. line options parsing.
  • Loading branch information
jkottiku authored Oct 18, 2024
2 parents a71e949 + 143a3c0 commit 98de216
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions rvs/src/rvsexec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,27 +127,22 @@ int rvs::exec::run() {
logger::to_json(true);
}

// check -c option
string config_file;
if (rvs::options::has_option("-c", &val)) {
config_file = val;
} else {
char buff[1024];
snprintf(buff, sizeof(buff),
"No config file specified . Please use -c <conf file path>:");
rvs::logger::Err(buff, MODULE_NAME_CAPS);
return -1;
}

// Check if pConfig file exists
std::ifstream file(config_file);
if (!file.good()) {
char buff[1024];
snprintf(buff, sizeof(buff),
"%s file is missing.", config_file.c_str());
rvs::logger::Err(buff, MODULE_NAME_CAPS);
return -1;
} else {
file.close();
// Check if conf. file exists
std::ifstream file(config_file);
if (!file.good()) {
char buff[1024];
snprintf(buff, sizeof(buff),
"%s file is missing.", config_file.c_str());
rvs::logger::Err(buff, MODULE_NAME_CAPS);
return -1;
} else {
file.close();
}
}

// construct modules configuration file relative path
Expand Down

0 comments on commit 98de216

Please sign in to comment.