blob: 5bc2596a939c6178b63eee6680f814a4f88989fe [file] [log] [blame]
Junxiao Shid243d712016-08-19 06:45:31 +00001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (c) 2014-2016, Regents of the University of California,
4 * Arizona Board of Regents,
5 * Colorado State University,
6 * University Pierre & Marie Curie, Sorbonne University,
7 * Washington University in St. Louis,
8 * Beijing Institute of Technology,
9 * The University of Memphis.
10 *
11 * This file is part of NFD (Named Data Networking Forwarding Daemon).
12 * See AUTHORS.md for complete list of NFD authors and contributors.
13 *
14 * NFD is free software: you can redistribute it and/or modify it under the terms
15 * of the GNU General Public License as published by the Free Software Foundation,
16 * either version 3 of the License, or (at your option) any later version.
17 *
18 * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
19 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
20 * PURPOSE. See the GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License along with
23 * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
24 */
25
26#include "legacy-nfdc.hpp"
Junxiao Shi331ade72016-08-19 14:07:19 +000027#include "status-main.hpp"
Junxiao Shid243d712016-08-19 06:45:31 +000028#include "core/version.hpp"
29
Junxiao Shid243d712016-08-19 06:45:31 +000030namespace nfd {
31namespace tools {
32namespace nfdc {
33
Junxiao Shid243d712016-08-19 06:45:31 +000034static int
35main(int argc, char** argv)
36{
Junxiao Shid243d712016-08-19 06:45:31 +000037 if (argc < 2) {
Junxiao Shi2f741322016-08-29 00:53:18 +000038 legacyNfdcUsage();
Junxiao Shid243d712016-08-19 06:45:31 +000039 return 0;
40 }
41
Junxiao Shi2f741322016-08-29 00:53:18 +000042 std::string subcommand(argv[1]);
43 std::vector<std::string> args(argv + 2, argv + argc);
44
45 if (subcommand == "-h") {
46 legacyNfdcUsage();
Junxiao Shid243d712016-08-19 06:45:31 +000047 return 0;
48 }
49
Junxiao Shi2f741322016-08-29 00:53:18 +000050 if (subcommand == "-V") {
Junxiao Shid243d712016-08-19 06:45:31 +000051 std::cout << NFD_VERSION_BUILD_STRING << std::endl;
52 return 0;
53 }
54
Junxiao Shi2f741322016-08-29 00:53:18 +000055 if (subcommand == "legacy-nfd-status") {
56 return statusMain(args);
Junxiao Shi331ade72016-08-19 14:07:19 +000057 }
58
Junxiao Shi2f741322016-08-29 00:53:18 +000059 return legacyNfdcMain(subcommand, args);
Junxiao Shid243d712016-08-19 06:45:31 +000060}
61
62} // namespace nfdc
63} // namespace tools
64} // namespace nfd
65
66int
67main(int argc, char** argv)
68{
69 return nfd::tools::nfdc::main(argc, argv);
70}