1
1
openmpi/src/util/common_cmd_line.c
Jeff Squyres b053a53823 - In an attempt for better compile times (i.e., less dependencies),
strip down cmd_line.h; remove necessity of including
  include/constants.h and util/argv.h.
- This means that a bunch of other files in the source tree that
  depended on those files having already been included needed to be
  updated to include the relevant file(s)
- In fixing these (^^), added both /* $HEADER$ */ and #include
  "ompi_config.h" in a few files that were missing them.
- change from ompi_cmd_line_create() / ompi_cmd_line_free() to
  OBJ_NEW() / OBJ_RELEASE()
- update mpirun2.cc to allow "-np"
- fix minor problem in mpirun2.cc where two command line params were
  accepting "-h"
- slightly revamped cmd_line.c to use the OBJ_NEW/OBJ_RELEASE
  interface.  Added new function ompi_cmd_line_make_opt3() that allows
  "single dash" parameters.
- Greatly expanded the ompi_cmd_line_t doxygen docs.
- The diff for ompi_cmd_line_t is artificially large because I also
  took the opprotunity to reformat to 4 space tabs.  Sorry.  :-\

This commit was SVN r2308.
2004-08-26 07:56:45 +00:00

56 строки
1.2 KiB
C

/*
* $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;
}