/* This file is part of the Neper software package. */
/* Copyright (C) 2003-2014, Romain Quey. */
/* See the COPYING file in the top-level directory. */

#include"ned_input_.h"

void
ned_input (struct IN *pIn, int fargc, char **fargv, int argc, char **argv)
{
  int status;

  ned_input_treatargs (fargc, fargv, argc, argv, pIn);

  if (strlen ((*pIn).modules) == 0)
    ut_print_message (2, 2, "Input data missing.\n");

  // Processing bin 
  if (!((*pIn).bin))
  {
    status = ut_sys_currentbin_path (&((*pIn).bin));
    if (status != 0)
      ut_print_message (2, 0, "Failed to determine binary path.  Use option `-bin'.\n");
  }

  ut_string_fnrs ((*pIn).modules, "all", "-T,-M,-V", 1);
  if (!strcmp ((*pIn).modules, "none"))
      strcpy ((*pIn).modules, "");

  return;
}

void
ned_in_set_zero (struct IN *pIn)
{
  (*pIn).bin = NULL;
  (*pIn).runmode = NULL;
  (*pIn).modules = NULL;
  (*pIn).tests = NULL;

  return;
}

void
ned_in_free (struct IN In)
{
  ut_free_1d_char (In.bin);
  ut_free_1d_char (In.runmode);
  ut_free_1d_char (In.modules);
  ut_free_1d_char (In.tests);

  return;
}
