main.cpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #include "nlsr-runner.hpp"
23 #include "version.hpp"
24 
25 int
26 main(int32_t argc, char** argv)
27 {
28  using namespace nlsr;
29 
30  std::string programName(argv[0]);
31 
32  std::string configFileName = "nlsr.conf";
33  bool isDaemonProcess = false;
34 
35  int32_t opt;
36  while ((opt = getopt(argc, argv, "df:hV")) != -1) {
37  switch (opt) {
38  case 'f':
39  configFileName = optarg;
40  break;
41  case 'd':
42  isDaemonProcess = true;
43  break;
44  case 'V':
45  std::cout << NLSR_VERSION_BUILD_STRING << std::endl;
46  return EXIT_SUCCESS;
47  break;
48  case 'h':
49  default:
50  NlsrRunner::printUsage(programName);
51  return EXIT_FAILURE;
52  }
53  }
54 
55  NlsrRunner runner(configFileName, isDaemonProcess);
56 
57  try {
58  runner.run();
59  }
60  catch (const std::exception& e) {
61  std::cerr << e.what() << std::endl;
62  return EXIT_FAILURE;
63  }
64 
65  return EXIT_SUCCESS;
66 }
A wrapper class to instantiate and configure an NLSR object.
Definition: nlsr-runner.hpp:44
int main(int32_t argc, char **argv)
Copyright (c) 2014-2017, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
Definition: main.cpp:26
Copyright (c) 2014-2017, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
void run()
Instantiate, configure, and start the NLSR process.
Definition: nlsr-runner.cpp:41
static void printUsage(const std::string &programName)
Definition: nlsr-runner.cpp:85