X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d6d03a0a88c2673c9e5c604d63912b77bc17fdd4..5843ccab4e336d47ca34f54e68760ac78d242f36:/teshsuite/smpi/privatization/privatization.c diff --git a/teshsuite/smpi/privatization/privatization.c b/teshsuite/smpi/privatization/privatization.c index 07c2b8fa95..c4ddc7a21b 100644 --- a/teshsuite/smpi/privatization/privatization.c +++ b/teshsuite/smpi/privatization/privatization.c @@ -1,3 +1,7 @@ +/* Copyright (c) 2017-2023. The SimGrid Team. All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ #include #include @@ -5,12 +9,39 @@ static int myvalue = 0; - +static void test_opts(int argc, char* const argv[]) +{ + int found = 0; + static struct option long_options[] = { + {(char*)"long", no_argument, 0, 0 }, + {0, 0, 0, 0 } + }; + while (1) { + int ret = getopt_long_only(argc, argv, "s", long_options, NULL); + if(ret==-1) + break; + + switch (ret) { + case 0: + case 's': + found ++; + break; + default: + printf("option %s", long_options[0].name); + break; + } + } + if (found!=2){ + printf("(smpi_)getopt_long_only failed ! \n"); + } +} int main(int argc, char **argv) { int me; MPI_Init(&argc, &argv); + /* test getopt_long function */ + test_opts(argc, argv); MPI_Comm_rank(MPI_COMM_WORLD, &me);