root/opal/mca/pmix/pmix4x/pmix/src/mca/pinstalldirs/env/pmix_pinstalldirs_env.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. pinstalldirs_env_open

   1 /*
   2  * Copyright (c) 2006-2007 Los Alamos National Security, LLC.  All rights
   3  *                         reserved.
   4  * Copyright (c) 2007      Cisco Systems, Inc.  All rights reserved.
   5  * Copyright (c) 2016      Intel, Inc. All rights reserved
   6  * $COPYRIGHT$
   7  *
   8  * Additional copyrights may follow
   9  *
  10  * $HEADER$
  11  */
  12 
  13 #include <src/include/pmix_config.h>
  14 
  15 #include <stdlib.h>
  16 #include <string.h>
  17 
  18 #include "pmix_common.h"
  19 #include "src/mca/pinstalldirs/pinstalldirs.h"
  20 
  21 static int pinstalldirs_env_open(void);
  22 
  23 
  24 pmix_pinstalldirs_base_component_t mca_pinstalldirs_env_component = {
  25     /* First, the mca_component_t struct containing meta information
  26        about the component itself */
  27     {
  28         PMIX_PINSTALLDIRS_BASE_VERSION_1_0_0,
  29 
  30         /* Component name and version */
  31         "env",
  32         PMIX_MAJOR_VERSION,
  33         PMIX_MINOR_VERSION,
  34         PMIX_RELEASE_VERSION,
  35 
  36         /* Component open and close functions */
  37         pinstalldirs_env_open,
  38         NULL
  39     },
  40     {
  41         /* This component is checkpointable */
  42         PMIX_MCA_BASE_METADATA_PARAM_CHECKPOINT
  43     },
  44 
  45     /* Next the pmix_pinstall_dirs_t install_dirs_data information */
  46     {
  47         NULL,
  48     },
  49 };
  50 
  51 
  52 #define SET_FIELD(field, envname)                                         \
  53     do {                                                                  \
  54         char *tmp = getenv(envname);                                      \
  55          if (NULL != tmp && 0 == strlen(tmp)) {                           \
  56              tmp = NULL;                                                  \
  57          }                                                                \
  58          mca_pinstalldirs_env_component.install_dirs_data.field = tmp;     \
  59     } while (0)
  60 
  61 
  62 static int
  63 pinstalldirs_env_open(void)
  64 {
  65     SET_FIELD(prefix, "PMIX_INSTALL_PREFIX");
  66     SET_FIELD(exec_prefix, "PMIX_EXEC_PREFIX");
  67     SET_FIELD(bindir, "PMIX_BINDIR");
  68     SET_FIELD(sbindir, "PMIX_SBINDIR");
  69     SET_FIELD(libexecdir, "PMIX_LIBEXECDIR");
  70     SET_FIELD(datarootdir, "PMIX_DATAROOTDIR");
  71     SET_FIELD(datadir, "PMIX_DATADIR");
  72     SET_FIELD(sysconfdir, "PMIX_SYSCONFDIR");
  73     SET_FIELD(sharedstatedir, "PMIX_SHAREDSTATEDIR");
  74     SET_FIELD(localstatedir, "PMIX_LOCALSTATEDIR");
  75     SET_FIELD(libdir, "PMIX_LIBDIR");
  76     SET_FIELD(includedir, "PMIX_INCLUDEDIR");
  77     SET_FIELD(infodir, "PMIX_INFODIR");
  78     SET_FIELD(mandir, "PMIX_MANDIR");
  79     SET_FIELD(pmixdatadir, "PMIX_PKGDATADIR");
  80     SET_FIELD(pmixlibdir, "PMIX_PKGLIBDIR");
  81     SET_FIELD(pmixincludedir, "PMIX_PKGINCLUDEDIR");
  82 
  83     return PMIX_SUCCESS;
  84 }

/* [<][>][^][v][top][bottom][index][help] */