<commit_before>/*
** Author(s):
**  - <NAME> <<EMAIL>>
**
** Copyright (C) 2012 Aldebaran Robotics
*/

#include <iostream>
#include <vector>
#include <map>

#include <qi/os.hpp>
#include <qimessaging/service_directory.hpp>

#include <boost/program_options.hpp>

namespace po = boost::program_options;


int main(int argc, char *argv[])
{
  // declare the program options
  po::options_description desc("Usage:\n  qi-master masterAddress [options]\nOptions");
  desc.add_options()
      ("help", "Print this help.")
      ("master-address",
       po::value<std::string>()->default_value(std::string("tcp://0.0.0.0:5555")),
       "The master address");

  // allow master address to be specified as the first arg
  po::positional_options_description pos;
  pos.add("master-address", 1);

  // parse and store
  po::variables_map vm;
  try
  {
    po::store(po::command_line_parser(argc, argv).
              options(desc).positional(pos).run(), vm);
    po::notify(vm);

    if (vm.count("help"))
    {
      std::cout << desc << "\n";
      return 0;
    }

    if (vm.count("master-address") == 1)
    {
      std::string masterAddress = vm["master-address"].as<std::string>();

      qi::ServiceDirectory sd;
      if (!sd.listen(masterAddress))
      {
        return 1;
      }

      std::cout << "ready." << std::endl;

      sd.join();<commit_msg>fix return 1 for windows in qi-master<commit_after>/*
** Author(s):
**  - <NAME> <<EMAIL>>
**
** Copyright (C) 2012 Aldebaran Robotics
*/

#include <iostream>
#include <vector>
#include <map>

#include <qi/os.hpp>
#include <qimessaging/service_directory.hpp>

#include <boost/program_options.hpp>

namespace po = boost::program_options;


int main(int argc, char *argv[])
{
  // declare the program options
  po::options_description desc("Usage:\n  qi-master masterAddress [options]\nOptions");
  desc.add_options()
      ("help", "Print this help.")
      ("master-address",
       po::value<std::string>()->default_value(std::string("tcp://0.0.0.0:5555")),
       "The master address");

  // allow master address to be specified as the first arg
  po::positional_options_description pos;
  pos.add("master-address", 1);

  // parse and store
  po::variables_map vm;
  try
  {
    po::store(po::command_line_parser(argc, argv).
              options(desc).positional(pos).run(), vm);
    po::notify(vm);

    if (vm.count("help"))
    {
      std::cout << desc << "\n";
      return 0;
    }

    if (vm.count("master-address") == 1)
    {
      std::string masterAddress = vm["master-address"].as<std::string>();

      qi::ServiceDirectory sd;
      if (!sd.listen(masterAddress))
      {
        exit(1);
      }

      std::cout << "ready." << std::endl;

      sd.join();
{'fraction_non_alphanumeric': 0.17819246249542628, 'fraction_numerical': 0.012074643249176729, 'mean_word_length': 3.1740458015267174, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2969588', 'n_tokens_mistral': 937, 'n_tokens_neox': 894, 'n_words': 196}