diff --git a/src/mpi/runtime/ompi_mpi_finalize.c b/src/mpi/runtime/ompi_mpi_finalize.c index 72c8cb7861..e53c47b318 100644 --- a/src/mpi/runtime/ompi_mpi_finalize.c +++ b/src/mpi/runtime/ompi_mpi_finalize.c @@ -18,7 +18,6 @@ #include "file/file.h" #include "info/info.h" #include "runtime/runtime.h" -#include "util/common_cmd_line.h" #include "mca/base/base.h" #include "mca/ptl/ptl.h" @@ -137,20 +136,12 @@ int ompi_mpi_finalize(void) return ret; } - if (OMPI_SUCCESS != (ret = ompi_common_cmd_line_finalize())) { - return ret; - } - /* Leave OMPI land */ if (OMPI_SUCCESS != (ret = ompi_finalize())) { return ret; } - if (OMPI_SUCCESS != (ret = ompi_common_cmd_line_finalize())) { - return ret; - } - /* All done */ return MPI_SUCCESS; diff --git a/src/mpi/runtime/ompi_mpi_init.c b/src/mpi/runtime/ompi_mpi_init.c index bfc531d3cb..0951294774 100644 --- a/src/mpi/runtime/ompi_mpi_init.c +++ b/src/mpi/runtime/ompi_mpi_init.c @@ -14,7 +14,6 @@ #include "communicator/communicator.h" #include "group/group.h" #include "info/info.h" -#include "util/common_cmd_line.h" #include "util/show_help.h" #include "errhandler/errhandler.h" #include "errhandler/errcode.h" @@ -68,13 +67,6 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided) char *contact=NULL, **tmp, *nsreplica=NULL, *gprreplica=NULL; char *error; - /* Save command line parameters */ - - if (OMPI_SUCCESS != (ret = ompi_common_cmd_line_init(argc, argv))) { - error = "ompi_common_cmd_line_init() failed"; - goto error; - } - /* Become a OMPI process */ if (OMPI_SUCCESS != (ret = ompi_init(argc, argv))) { diff --git a/src/util/Makefile.am b/src/util/Makefile.am index 4ebeeb2cd0..ed6d4812d7 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am @@ -18,7 +18,6 @@ headers = \ argv.h \ bit_ops.h \ cmd_line.h \ - common_cmd_line.h \ few.h \ if.h \ malloc.h \ @@ -44,7 +43,6 @@ libutil_la_SOURCES = \ asm.S \ argv.c \ cmd_line.c \ - common_cmd_line.c \ few.c \ if.c \ malloc.c \ diff --git a/src/util/cmd_line.h b/src/util/cmd_line.h index a08f705f04..7e0829371f 100644 --- a/src/util/cmd_line.h +++ b/src/util/cmd_line.h @@ -201,8 +201,8 @@ extern "C" { * handle. * * @param cmd OMPI command line handle. - * @param ignore_unknown Whether to ignore unknown tokens in the - * middle of the command line or not. + * @param ignore_unknown Whether to print an error message upon + * finding an unknown token or not * @param argc Length of the argv array. * @param argv Array of strings from the command line. * @@ -213,6 +213,12 @@ extern "C" { * handle can then be queried to see what options were used, what * their parameters were, etc. * + * If an unknown token is found in the command line (i.e., a token + * that is not a parameter or a registered option), the parsing will + * stop (see below). If ignore_unknown is false, an error message + * is displayed. If ignore_unknown is true, the error message is + * not displayed. + * * The contents of argc and argv are not changed during parsing. * argv[0] is assumed to be the executable name, and is ignored during * parsing. It can later be retrieved with @@ -221,7 +227,12 @@ extern "C" { * * - all argv tokens are processed * - the token "--" is found - * - an unrecognized token is found and ignore_unknown is false + * - an unrecognized token is found + * + * Upon any of these conditions, any remaining tokens will be placed + * in the "tail" (and therefore not examined by the parser), + * regardless of the value of ignore_unknown. The set of tail + * tokens is available from the ompi_cmd_line_get_tail() function. * * Note that "--" is ignored if it is found in the middle an expected * number of arguments. For example, if "--foo" is expected to have 3 @@ -233,9 +244,6 @@ extern "C" { * third parameter to the first instance of "foo", and "other" will be * an unrecognized option. * - * Unprocessed tokens are known as the "tail." Any unprocessed tokens - * can be obtained from the ompi_cmd_line_get_tail() function. - * * Invoking this function multiple times on different sets of argv * tokens is safe, but will erase any previous parsing results. */ diff --git a/src/util/common_cmd_line.c b/src/util/common_cmd_line.c deleted file mode 100644 index 9d8d77bec5..0000000000 --- a/src/util/common_cmd_line.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * $HEADER - */ - -#include "ompi_config.h" - -#include "include/constants.h" -#include "util/common_cmd_line.h" - - -/* - * The global variable that everyone accesses - */ -ompi_cmd_line_t *ompi_common_cmd_line = NULL; - - -/* - * Setup the ompi_common_cmd_line variable - */ -int ompi_common_cmd_line_init(int argc, char **argv) -{ - if (NULL == ompi_common_cmd_line) { - ompi_common_cmd_line = OBJ_NEW(ompi_cmd_line_t); - - /* Setup the options that are allowable */ - - ompi_cmd_line_make_opt(ompi_common_cmd_line, 'v', "version", 0, - "Show version of Open MPI and this program"); - - ompi_cmd_line_make_opt(ompi_common_cmd_line, 'h', "help", 0, - "Show help for this function"); - - /* Parse the command line */ - - if (OMPI_SUCCESS != - ompi_cmd_line_parse(ompi_common_cmd_line, true, argc, argv)) { - return OMPI_ERROR; - } - } - - return OMPI_SUCCESS; -} - - -/* - * Free resources associated with the ompi_common_cmd_line variable - */ -int ompi_common_cmd_line_finalize(void) -{ - if (NULL != ompi_common_cmd_line) { - OBJ_RELEASE(ompi_common_cmd_line); - } - - return OMPI_SUCCESS; -} diff --git a/src/util/common_cmd_line.h b/src/util/common_cmd_line.h deleted file mode 100644 index 9a7627cff0..0000000000 --- a/src/util/common_cmd_line.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * $HEADER$ - */ - -/** - * @file - * - * Several command line parameters are common to many/most Open MPI - * executables / commands. This file provides a clearinghouse for - * parsing and holding all these command line options that can be - * retrieved from elsewhere in Open MPI. For example, "--universe - * [name]" - */ - -#ifndef OMPI_COMMON_CMD_LINE_H -#define OMPI_COMMON_CMD_LINE_H - -#include - -/** - * Global variable to hold the parsed set of "common" command line - * parameters. This global variable should be treated as a "read - * only" structure -- various entites in Open MPI can read from this - * structure, but should not write to it. - * - * See the interface defined in cmd_line.h for instructions on how to - * access the data in this variable. - */ -extern ompi_cmd_line_t *ompi_common_cmd_line; - -/** - * Setup for the command line parameters that are common to all/many - * Open MPI executables (e.g., --universe). - * - * @param argv The argv from main(). - * @param argc The argc from main(). - * - * @returns OMPI_SUCCESS Always. - * - * This function sets up a ompi_cmd_line_t for all command line - * parameters that are common to a number of Open MPI executables. It - * then parses the argc and argv and puts the results in the gloabl - * ompi_cmd_line_t. - * - * This function is only invoked by the normal startup of an Open MPI - * process; you should not need to invoke it manually. Anyone who - * wants to access the common command line parameters should use the - * global variable ompi_common_cmd_line. - */ -int ompi_common_cmd_line_init(int argc, char **argv); - -/** - * Release resources allocated by ompi_common_cmd_line_init(). - * - * @returns OMPI_SUCCESS Always. - * - * Self-explanitory; frees the resources associated with the global - * variable ompi_common_cmd_line. This function is invoked by the - * normal shutdown of an Open MPI process; you should not need to - * invoke it manually. - */ -int ompi_common_cmd_line_finalize(void); - - -#endif /* OMPI_COMMON_CMD_LINE_H */