Junxiao Shi | d243d71 | 2016-08-19 06:45:31 +0000 | [diff] [blame] | 1 | /* -*- 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 Shi | 331ade7 | 2016-08-19 14:07:19 +0000 | [diff] [blame] | 27 | #include "status-main.hpp" |
Junxiao Shi | d243d71 | 2016-08-19 06:45:31 +0000 | [diff] [blame] | 28 | #include "core/version.hpp" |
| 29 | |
Junxiao Shi | d243d71 | 2016-08-19 06:45:31 +0000 | [diff] [blame] | 30 | namespace nfd { |
| 31 | namespace tools { |
| 32 | namespace nfdc { |
| 33 | |
Junxiao Shi | d243d71 | 2016-08-19 06:45:31 +0000 | [diff] [blame] | 34 | static int |
| 35 | main(int argc, char** argv) |
| 36 | { |
Junxiao Shi | d243d71 | 2016-08-19 06:45:31 +0000 | [diff] [blame] | 37 | if (argc < 2) { |
Junxiao Shi | 2f74132 | 2016-08-29 00:53:18 +0000 | [diff] [blame^] | 38 | legacyNfdcUsage(); |
Junxiao Shi | d243d71 | 2016-08-19 06:45:31 +0000 | [diff] [blame] | 39 | return 0; |
| 40 | } |
| 41 | |
Junxiao Shi | 2f74132 | 2016-08-29 00:53:18 +0000 | [diff] [blame^] | 42 | std::string subcommand(argv[1]); |
| 43 | std::vector<std::string> args(argv + 2, argv + argc); |
| 44 | |
| 45 | if (subcommand == "-h") { |
| 46 | legacyNfdcUsage(); |
Junxiao Shi | d243d71 | 2016-08-19 06:45:31 +0000 | [diff] [blame] | 47 | return 0; |
| 48 | } |
| 49 | |
Junxiao Shi | 2f74132 | 2016-08-29 00:53:18 +0000 | [diff] [blame^] | 50 | if (subcommand == "-V") { |
Junxiao Shi | d243d71 | 2016-08-19 06:45:31 +0000 | [diff] [blame] | 51 | std::cout << NFD_VERSION_BUILD_STRING << std::endl; |
| 52 | return 0; |
| 53 | } |
| 54 | |
Junxiao Shi | 2f74132 | 2016-08-29 00:53:18 +0000 | [diff] [blame^] | 55 | if (subcommand == "legacy-nfd-status") { |
| 56 | return statusMain(args); |
Junxiao Shi | 331ade7 | 2016-08-19 14:07:19 +0000 | [diff] [blame] | 57 | } |
| 58 | |
Junxiao Shi | 2f74132 | 2016-08-29 00:53:18 +0000 | [diff] [blame^] | 59 | return legacyNfdcMain(subcommand, args); |
Junxiao Shi | d243d71 | 2016-08-19 06:45:31 +0000 | [diff] [blame] | 60 | } |
| 61 | |
| 62 | } // namespace nfdc |
| 63 | } // namespace tools |
| 64 | } // namespace nfd |
| 65 | |
| 66 | int |
| 67 | main(int argc, char** argv) |
| 68 | { |
| 69 | return nfd::tools::nfdc::main(argc, argv); |
| 70 | } |