Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add support fort getopt_long_only, as mpimemu uses it
authorAugustin DEGOMME AD254919 <ad254919@cardamome.intra.cea.fr>
Mon, 18 Jun 2018 12:42:01 +0000 (14:42 +0200)
committerAugustin DEGOMME AD254919 <ad254919@cardamome.intra.cea.fr>
Mon, 18 Jun 2018 12:42:01 +0000 (14:42 +0200)
include/smpi/smpi_helpers.h
src/smpi/internals/smpi_bench.cpp

index c710705..092d64d 100644 (file)
@@ -33,5 +33,6 @@ int smpi_getopt (int argc,  char *const *argv,  const char *options);
 
 #define getopt(x,y,z) smpi_getopt(x,y,z)
 #define getopt_long(x,y,z,a,b) smpi_getopt_long(x,y,z,a,b)
 
 #define getopt(x,y,z) smpi_getopt(x,y,z)
 #define getopt_long(x,y,z,a,b) smpi_getopt_long(x,y,z,a,b)
+#define getopt_long_only(x,y,z,a,b) smpi_getopt_long_only(x,y,z,a,b)
 
 #endif
 
 #endif
index 281d79f..56b211e 100644 (file)
@@ -443,6 +443,17 @@ void smpi_bench_destroy()
   samples.clear();
 }
 
   samples.clear();
 }
 
+int smpi_getopt_long_only (int argc,  char *const *argv,  const char *options,
+                      const struct option * long_options, int *opt_index)
+{
+  if (smpi_process())
+    optind = smpi_process()->get_optind();
+  int ret = getopt_long_only (argc,  argv,  options, long_options, opt_index);
+  if (smpi_process())
+    smpi_process()->set_optind(optind);
+  return ret;
+}
+
 int smpi_getopt_long (int argc,  char *const *argv,  const char *options,
                       const struct option * long_options, int *opt_index)
 {
 int smpi_getopt_long (int argc,  char *const *argv,  const char *options,
                       const struct option * long_options, int *opt_index)
 {