1 #include "internal/print_content.hpp"
2 #include "internal/storage_backend_serialized.hpp"
5 #include "libdbuspolicy1-private.h"
9 static const struct option options[] = {
10 {"system", no_argument, 0, 0 },
11 {"session", no_argument, 0, 0},
15 static void print_help(const char *name) {
17 cout << "usage: " << name << " [-i serialized filename] [-v]" << endl;
18 cout << " " << name << " {--system|--session} [-v]" << endl;
19 cout << " -v - just verify, don't print anything" << endl;
20 cout << " -x - print rule as xml format" << endl;
24 int main(int argc, char *argv[]) {
25 std::string input_filename;
27 bool just_verify = false;
28 bool xml_format = false;
37 c = getopt_long(argc, argv, "i:v:x", options, &option_index);
43 if (option_index == 0)
44 input_filename = system_bus_conf_file_primary();
46 input_filename = session_bus_conf_file_primary();
47 input_filename.append(".serialized");
50 input_filename = optarg;
65 input_filename = argv[optind];
67 if (input_filename.empty()) {
68 cout << "No input filename" << endl;
73 tslog::init(tslog::ldp_log_level::DEFAULT);
75 ldp_serialized::StorageBackendSerialized storage;
77 if (!storage.init(input_filename.c_str(), true)) {
79 cout << input_filename << ": FAILED" << endl;
84 cout << input_filename << ": OK" << endl;
88 storage.printContent(xml_format);