Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
try to handle getopt internal global variable
[simgrid.git] / src / smpi / internals / smpi_bench.cpp
index 423fe6e..7f1ae4a 100644 (file)
@@ -12,6 +12,7 @@
 #include "src/mc/mc_replay.hpp"
 #include "src/simix/ActorImpl.hpp"
 #include "xbt/config.hpp"
+#include "getopt.h"
 
 #include <unordered_map>
 
@@ -430,3 +431,20 @@ void smpi_bench_destroy()
 {
   samples.clear();
 }
+
+int smpi_getopt_long (int argc,  char *const *argv,  const char *options,
+                      const struct option * long_options, int *opt_index)
+{
+  optind = smpi_process()->get_optind();
+  int ret = getopt_long (argc,  argv,  options, long_options, opt_index);
+  smpi_process()->set_optind(optind);
+  return ret;
+}
+
+int smpi_getopt (int argc,  char *const *argv,  const char *options)
+{
+  optind = smpi_process()->get_optind();
+  int ret = getopt (argc,  argv,  options);
+  smpi_process()->set_optind(optind);
+  return ret;
+}