From a69f8338676e77525c4353c1099137857ca02c33 Mon Sep 17 00:00:00 2001 From: Augustin DEGOMME AD254919 Date: Mon, 18 Jun 2018 14:42:01 +0200 Subject: [PATCH 1/1] add support fort getopt_long_only, as mpimemu uses it --- include/smpi/smpi_helpers.h | 1 + src/smpi/internals/smpi_bench.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/include/smpi/smpi_helpers.h b/include/smpi/smpi_helpers.h index c7107059ec..092d64d089 100644 --- a/include/smpi/smpi_helpers.h +++ b/include/smpi/smpi_helpers.h @@ -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_long_only(x,y,z,a,b) smpi_getopt_long_only(x,y,z,a,b) #endif diff --git a/src/smpi/internals/smpi_bench.cpp b/src/smpi/internals/smpi_bench.cpp index 281d79f41d..56b211e352 100644 --- a/src/smpi/internals/smpi_bench.cpp +++ b/src/smpi/internals/smpi_bench.cpp @@ -443,6 +443,17 @@ void smpi_bench_destroy() 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) { -- 2.20.1