/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Copyright: * 2014-2016, Danny Robson */ #include "json/flat.hpp" #include "json/except.hpp" #include "io.hpp" #include #include enum { ARG_CMD, ARG_PATH, NUM_ARGS }; int main (int argc, char ** argv) { if (argc != NUM_ARGS) { std::cerr << "Invalid arguments. " << argv[ARG_CMD] << " " << std::endl; return EXIT_FAILURE; } try { const util::mapped_file data (argv[ARG_PATH]); json::flat::parse (util::view{data}.cast ()); } catch (const json::error &x) { std::cerr << "error: " << x.what () << '\n'; return EXIT_FAILURE; } return EXIT_SUCCESS; }