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

PUBLIC int csoundSetGlobalEnv ( const char *  name,
const char *  value 
)

Set the global value of environment variable 'name' to 'value', or delete variable if 'value' is NULL. It is not safe to call this function while any Csound instances are active. Returns zero on success.

Definition at line 184 of file envvar.c.

{
    int   i;

    if (name == NULL || name[0] == '\0' || (int) strlen(name) >= 32)
      return -1;                        /* invalid name             */
    for (i = 0; i < 16; i++) {
      if ((value != NULL && globalEnvVarName(i)[0] == '\0') ||
          strcmp(name, globalEnvVarName(i)) == 0)
        break;
    }
    if (i >= 16)                        /* not found / no free slot */
      return -1;
    if (value == NULL) {
      globalEnvVarName(i)[0] = '\0';    /* delete existing variable */
      return 0;
    }
    if (strlen(value) >= 480)
      return -1;                        /* string value is too long */
    strcpy(globalEnvVarName(i), name);
    strcpy(globalEnvVarValue(i), value);
    return 0;
}


Generated by  Doxygen 1.6.0   Back to index