Windows will still get semicolons as is the convention on that OS. Signed-off-by: Jesse Lucas --- Engine/envvar.c | 16 +++++++++------- include/sysdep.h | 6 ++++++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Engine/envvar.c b/Engine/envvar.c index 9fe6e10..410743c 100644 --- a/Engine/envvar.c +++ b/Engine/envvar.c @@ -225,7 +225,7 @@ int csoundSetEnv(CSOUND *csound, const char *name, const char *value) } /** - * Append 'value' to environment variable 'name', using ';' as + * Append 'value' to environment variable 'name', using ENVPATHSEP as * separator character. * Returns CSOUND_SUCCESS on success, and CSOUND_ERROR or CSOUND_MEMORY * if the environment variable could not be set for some reason. @@ -236,6 +236,7 @@ int csoundAppendEnv(CSOUND *csound, const char *name, const char *value) const char *oldval; char *newval; int retval; + char sep[2] = {ENVPATHSEP, '\0'}; /* check for valid parameters */ if (UNLIKELY(csound == NULL || !is_valid_envvar_name(name))) @@ -246,12 +247,12 @@ int csoundAppendEnv(CSOUND *csound, const char *name, const char *value) return csoundSetEnv(csound, name, value); if (value == NULL || value[0] == '\0') return CSOUND_SUCCESS; - /* allocate new value (+ 2 bytes for ';' and null character) */ + /* allocate new value (+ 2 bytes for ENVPATHSEP and null character) */ newval = (char*) mmalloc(csound, (size_t) strlen(oldval) + (size_t) strlen(value) + (size_t) 2); /* append to old value */ strcpy(newval, oldval); /* These are safe as space calculated above */ - strcat(newval, ";"); + strcat(newval, sep); strcat(newval, value); /* set variable */ retval = csoundSetEnv(csound, name, newval); @@ -261,7 +262,7 @@ int csoundAppendEnv(CSOUND *csound, const char *name, const char *value) } /** - * Prepend 'value' to environment variable 'name', using ';' as + * Prepend 'value' to environment variable 'name', using ENVPATHSEP as * separator character. * Returns CSOUND_SUCCESS on success, and CSOUND_ERROR or CSOUND_MEMORY * if the environment variable could not be set for some reason. @@ -272,6 +273,7 @@ int csoundPrependEnv(CSOUND *csound, const char *name, const char *value) const char *oldval; char *newval; int retval; + char sep[2] = {ENVPATHSEP, '\0'}; /* check for valid parameters */ if (UNLIKELY(csound == NULL || !is_valid_envvar_name(name))) @@ -282,12 +284,12 @@ int csoundPrependEnv(CSOUND *csound, const char *name, const char *value) return csoundSetEnv(csound, name, value); if (value == NULL || value[0] == '\0') return CSOUND_SUCCESS; - /* allocate new value (+ 2 bytes for ';' and null character) */ + /* allocate new value (+ 2 bytes for ENVPATHSEP and null character) */ newval = (char*) mmalloc(csound, (size_t) strlen(oldval) + (size_t) strlen(value) + (size_t) 2); /* prepend to old value */ strcpy(newval, value); - strcat(newval, ";"); + strcat(newval, sep); strcat(newval, oldval); /* set variable */ retval = csoundSetEnv(csound, name, newval); @@ -441,7 +443,7 @@ char **csoundGetSearchPathFromEnv(CSOUND *csound, const char *envList) else len = -1; for (i = j = 0; i <= len; i++) { - if (s[i] == ';' || s[i] == '\0') { + if (s[i] == ENVPATHSEP || s[i] == '\0') { if (i > j) { tmp = (nameChain_t*) mmalloc(csound, sizeof(nameChain_t) + (i - j) + 1); diff --git a/include/sysdep.h b/include/sysdep.h index 6792961..6a2ca89 100644 --- a/include/sysdep.h +++ b/include/sysdep.h @@ -211,6 +211,12 @@ typedef uint_least16_t uint16; # endif #endif +#define ENVPATHSEP ':' +#ifdef WIN32 +# undef ENVPATHSEP +# define ENVPATHSEP ';' +#endif + #define DIRSEP '/' #ifdef WIN32 # undef DIRSEP -- 1.7.10.4 ------------------------------------------------------------------------------ Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save! http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net