2004-01-25 22:07:54 +00:00
|
|
|
/*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "lam_config.h"
|
|
|
|
|
|
|
|
#include "mpi.h"
|
|
|
|
#include "mpi/interface/c/bindings.h"
|
2004-02-10 22:15:55 +00:00
|
|
|
#include "lam/lfc/lam_list.h"
|
2004-02-01 22:28:20 +00:00
|
|
|
#include "mpi/info/info.h"
|
2004-02-03 22:34:01 +00:00
|
|
|
#include <string.h>
|
2004-01-25 22:07:54 +00:00
|
|
|
|
|
|
|
#if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES
|
|
|
|
#pragma weak MPI_Info_get_nthkey = PMPI_Info_get_nthkey
|
|
|
|
#endif
|
|
|
|
|
2004-02-01 22:28:20 +00:00
|
|
|
/**
|
|
|
|
* MPI_Info_get_nthkey - Get a key indexed by integer from an 'MPI_Info' obje
|
|
|
|
*
|
|
|
|
* @param info info object (handle)
|
|
|
|
* @param n index of key to retrieve (integer)
|
|
|
|
* @param key character string of at least 'MPI_MAX_INFO_KEY' characters
|
|
|
|
*
|
|
|
|
* @retval MPI_SUCCESS
|
|
|
|
* @retval MPI_ERR_ARG
|
|
|
|
*/
|
2004-01-25 22:07:54 +00:00
|
|
|
int MPI_Info_get_nthkey(MPI_Info info, int n, char *key) {
|
2004-02-03 22:34:01 +00:00
|
|
|
int nkeys;
|
2004-02-11 15:23:43 +00:00
|
|
|
int err;
|
2004-02-03 22:34:01 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 1. Check if info is a valid handle
|
|
|
|
* 2. Check if there are atleast "n" elements
|
|
|
|
* 3. If so, give the nth defined key
|
|
|
|
*/
|
|
|
|
if (NULL == info){
|
|
|
|
printf ("Invalid MPI_Info handle passed\n");
|
|
|
|
return MPI_ERR_ARG;
|
|
|
|
}
|
|
|
|
|
|
|
|
MPI_Info_get_nkeys(info, &nkeys);
|
|
|
|
|
|
|
|
if (nkeys < n) {
|
|
|
|
printf ("Requested key does not exist\n");
|
|
|
|
return MPI_ERR_ARG;
|
|
|
|
} else {
|
|
|
|
/*
|
2004-02-11 15:23:43 +00:00
|
|
|
* Everything seems alright. Call the back end key copy
|
2004-02-03 22:34:01 +00:00
|
|
|
*/
|
2004-02-11 15:23:43 +00:00
|
|
|
err = lam_info_get_nthkey (info, n, key);
|
2004-02-03 22:34:01 +00:00
|
|
|
}
|
2004-02-11 15:23:43 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Have to check whether there are any error condditions. It appears
|
|
|
|
* that there are not too many error conditions from the look of it
|
|
|
|
*/
|
2004-01-25 22:07:54 +00:00
|
|
|
return MPI_SUCCESS;
|
|
|
|
}
|