Alexander Afanasyev | 3fd14f0 | 2014-03-26 14:34:39 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
| 3 | * Copyright (C) 2014 Regents of the University of California. |
| 4 | * See COPYING for copyright and distribution information. |
| 5 | */ |
| 6 | |
Shuo Chen | 9c2477f | 2014-03-13 15:01:06 -0700 | [diff] [blame] | 7 | #include <string> |
| 8 | #include <iostream> |
| 9 | #include <ndn-cpp-dev/face.hpp> |
| 10 | |
| 11 | #include "../storage/storage-handle.hpp" |
| 12 | #include "../storage/sqlite/sqlite-handle.hpp" |
| 13 | #include "../ndn-handle/read-handle.hpp" |
| 14 | |
| 15 | using namespace repo; |
| 16 | |
| 17 | static const string ndnRepoUsageMessage = |
| 18 | "ndn-repo - NDNx Repository Daemon\n" |
| 19 | "-d: set database path\n" |
| 20 | "-h: show help message\n" |
| 21 | "-c: set config file path\n" |
| 22 | ; |
| 23 | |
Alexander Afanasyev | 3fd14f0 | 2014-03-26 14:34:39 -0700 | [diff] [blame] | 24 | int |
Shuo Chen | 9c2477f | 2014-03-13 15:01:06 -0700 | [diff] [blame] | 25 | main(int argc, char** argv) { |
| 26 | int opt; |
| 27 | string dbPath; |
| 28 | string confPath; |
| 29 | while ((opt = getopt(argc, argv, "d:hc:")) != -1) { |
| 30 | switch (opt) { |
| 31 | case 'd': |
| 32 | dbPath = string(optarg); |
| 33 | break; |
| 34 | case 'h': |
| 35 | std::cout << ndnRepoUsageMessage << std::endl; |
| 36 | return 1; |
| 37 | case 'c': |
| 38 | confPath = string(optarg); |
| 39 | break; |
| 40 | default: |
| 41 | break; |
| 42 | } |
| 43 | } |
| 44 | SqliteHandle sqliteHandle(dbPath); |
| 45 | StorageHandle* handle = &sqliteHandle; |
| 46 | |
| 47 | Face face; |
| 48 | ReadHandle readHandle(&face, handle); |
| 49 | if (confPath.empty()) { |
| 50 | confPath = "./repo.conf"; |
| 51 | } |
| 52 | face.processEvents(); |
Alexander Afanasyev | 3fd14f0 | 2014-03-26 14:34:39 -0700 | [diff] [blame] | 53 | return 0; |
| 54 | } |