a step to the leak-free `main()`, as we use a smart pointer to manage
the lifecycle of `cct`, it'd be better to let the RAII to do its job.
Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit
3aef54b214754713e9eaf536ca0fdb95f60e8ebe)
if (pos == string::npos) {
cerr << "expecting argument like 'key=value' for --filter-key-value (not '" << val << "')" << std::endl;
usage();
- exit(1);
+ return EXIT_FAILURE;
}
string key(val, 0, pos);
string value(val, pos+1);
}
cerr << std::endl;
usage();
- exit(1);
+ return EXIT_FAILURE;
}
}
}
cct->_log->flush();
if (action == "help") {
usage();
- exit(0);
+ return EXIT_SUCCESS;
} else if (action == "list-sections") {
return list_sections(section_list_prefix, filter_key, filter_key_value);
} else if (action == "lookup") {
} else {
cerr << "You must give an action, such as --lookup or --list-all-sections." << std::endl;
cerr << "Pass --help for more help." << std::endl;
- exit(1);
+ return EXIT_FAILURE;
}
}