
#include "mergefiles.hpp"

#include "io.hpp"
//#include "mcutout.hpp"
#include <sys/param.h> // NAME_MAX PATH_MAX


#include <string>
#include <vector>

#include <string.h>




using namespace std;



string mergefiles(const vector<string> filenames)
{
   const size_t fcnt = filenames.size();
   char ffs[fcnt][PATH_MAX+NAME_MAX];

   size_t i = 0;
   for(string filename : filenames)
      strcpy(ffs[i++], filename.c_str());
/* 
   char * fitsfs[fcnt];
   for(i=0;i<fcnt;i++) fitsfs[i] = ffs[i];

   struct merge_files mf = {"/tmp",".","X"};// = mroot mresdir prefix
   char m_result[PATH_MAX+NAME_MAX];

  
   int rc = M4VL_mergefiles(&mf, fcnt, fitsfs, m_result, PATH_MAX+NAME_MAX);
   if(rc != 0) cerr << "M4VL_mergefiles returned rc: " << to_string(rc) << endl;

   return string(m_result);
*/
   return string("FIXME was implemented with M4VL_mergefiles which is common-internal. Re-implement with xmergefiles which is commp-API.");
}



