From: degomme Date: Fri, 5 Apr 2019 15:29:29 +0000 (+0200) Subject: Fix getopt for BSD systems X-Git-Tag: v3.22.2~164^2 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/cf482439821f2e52d3a573c4abe8763be830800a Fix getopt for BSD systems optind should be set to 1, not 0. GNU was just more resilient. --- diff --git a/src/smpi/include/smpi_actor.hpp b/src/smpi/include/smpi_actor.hpp index 264507b131..97d4d2b1f1 100644 --- a/src/smpi/include/smpi_actor.hpp +++ b/src/smpi/include/smpi_actor.hpp @@ -31,7 +31,7 @@ class ActorExt { smpi_trace_call_location_t trace_call_loc_; s4u::ActorPtr actor_ = nullptr; smpi_privatization_region_t privatized_region_ = nullptr; - int optind = 0; /*for getopt replacement */ + int optind = 1; /*for getopt replacement */ std::string tracing_category_ = ""; #if HAVE_PAPI diff --git a/teshsuite/smpi/pt2pt-pingpong/pt2pt-pingpong.c b/teshsuite/smpi/pt2pt-pingpong/pt2pt-pingpong.c index 468bcc6211..6ddb623680 100644 --- a/teshsuite/smpi/pt2pt-pingpong/pt2pt-pingpong.c +++ b/teshsuite/smpi/pt2pt-pingpong/pt2pt-pingpong.c @@ -10,7 +10,6 @@ #include static void test_opts(int* argc, char **argv[]){ -#if defined __linux__ int found = 0, ret; while ((ret = getopt(*argc, *argv, "s")) >= 0) { @@ -23,7 +22,6 @@ static void test_opts(int* argc, char **argv[]){ if (found!=1){ printf("(smpi_)getopt failed ! \n"); } -#endif } int main(int argc, char *argv[])