33 #include <tclap/CmdLine.h> 42 if (opts.has_param(
"working_directory") &&
43 !opts.get_param(
"working_directory").empty())
45 ret = chdir(opts.get_param(
"working_directory").c_str());
47 perror(
"Cannot change working directory");
52 int main(
int argc,
const char **argv)
63 TCLAP::CmdLine cmd(
"Open Source Access Controller",
' ',
65 TCLAP::SwitchArg strict(
"s",
"strict",
66 "Be strict regarding configuration error",
68 TCLAP::ValueArg<std::string> kernelFile(
69 "k",
"kernel-cfg",
"Kernel Configuration file",
true,
"",
"config_file");
70 TCLAP::ValueArg<std::string> working_directory(
71 "d",
"working-directory",
"Leosac's working directory",
false,
"",
76 cmd.add(working_directory);
77 cmd.parse(argc, argv);
78 options.
set_param(
"kernel-cfg", kernelFile.getValue());
79 options.
set_param(
"working_directory", working_directory.getValue());
82 catch (
const TCLAP::ArgException &e)
88 if (set_working_directory(options) != 0)
95 INFO(
"Creating Leosac Kernel...");
97 relaunch = kernel.
run();
99 catch (
const std::exception &e)
101 std::cerr <<
"Exception propagated to main(). Will now exit." 108 std::cerr <<
"Unknown exception in main" << std::endl;
int main(int argc, const char **argv)
This is the header file for a generated source file, GitSHA1.cpp.
UnixShellScript class declaration.
void set_thread_name(const std::string &name)
Set the name of the current thread.
void print_exception(const std::exception &e, int level=0)
Recursively print the exception trace to std::cerr.
static boost::property_tree::ptree make_config(const Leosac::Tools::RuntimeOptions &opt)
Build a property tree from a runtime object object.
bool run()
Main loop of the main thread.