/*
 * Copyright (C) 2003-2004 kurt_filters
 * 
 * This file is part of kurt_filters, post-processing framework.
 * 
 * kurt_filters is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * kurt_filters is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
 *
 * $Id: kurt_filters.cpp,v 1.24 2005/03/03 23:03:10 storri Exp $
 *
 * @author Stephen Torri
 *
 * contents:
 */
#include <unistd.h>
#include <iostream>
#include "config.h"
#include <boost/program_options.hpp>

using namespace std;
using namespace boost;
using namespace boost::program_options;

int main (int argc, char *argv[])
{
  int retval = 0;
  string test_file;
  string graph_file;

  options_description general ("General Options");
  general.add_options()
    ("file,f",
     value<string>(),
     "Input test file")
    ("help,h",
     "Produce this help message")
    ("graph,g",
     value<string>(),
     "Output graph of test structure")
    ("version,v","Program version")
    ;

  variables_map vm;
  
  // Parse options
  store ( parse_command_line (argc, argv, general), vm );
  notify (vm);

  if (vm.count("help"))
    {
      cout << general;
      return 0;
    }
  if (vm.count("file"))
    {
      test_file = vm["file"].as<string>();
    }
  if (vm.count("graph"))
    {
      graph_file = vm["graph"].as<string>();
    }
  if (vm.count("version"))
    {
      cout << PACKAGE_STRING << endl;
      return 0;
    }

  try
    {
      if (test_file.size() == 0)
        {
          cerr << "  Input file name is empty." << std::endl
               << std::endl;
          cout << general;
          return 0;
        }
      if (graph_file.size() == 0)
        {
          cerr << "  Output graph file name is empty." << std::endl
               << std::endl;
          cout << general;
          return 0;
        }
    }
  catch (exception& ex)
    {
      cerr << "C++ Exception occurred: " << ex.what() << endl
                << "Exiting..." << endl;
      return 1;
    }

  return retval;
}

