Logo Search packages:      
Sourcecode: csound version File versions  Download package

PUBLIC const char* csoundGetEnv ( CSOUND *  csound,
const char *  name 
)

Get pointer to the value of environment variable 'name', searching in this order: local environment of 'csound' (if not NULL), variables set with csoundSetGlobalEnv(), and system environment variables. If 'csound' is not NULL, should be called after csoundPreCompile() or csoundCompile(). Return value is NULL if the variable is not set.

Get pointer to value of environment variable 'name'. Return value is NULL if the variable is not set.

Definition at line 151 of file envvar.c.

{
    envVarEntry_t **pp, *p;

    if (csound == NULL) {
      int i;
      if (name == NULL || name[0] == '\0')
        return (const char*) NULL;
      for (i = 0; i < 16; i++) {
        if (strcmp(globalEnvVarName(i), name) == 0)
          return (const char*) globalEnvVarValue(i);
      }
      return (const char*) getenv(name);
    }
    pp = getEnvVarChain(csound, name);
    if (pp == NULL)
      return (const char*) NULL;
    p = *pp;
    while (p != NULL && sCmp(p->name, name) != 0)
      p = p->nxt;
    if (p == NULL)
      return (const char*) NULL;
    return (const char*) p->value;
}


Generated by  Doxygen 1.6.0   Back to index