Darwin's osdEnv.c was updated while I was working on this, changed my updated version to match.

This commit is contained in:
Keenan Lang
2014-09-02 16:55:32 -05:00
parent ee197893e7
commit 85936ff34c

View File

@@ -25,44 +25,21 @@
* Starting in Mac OS X 10.5 (Leopard) shared libraries and
* bundles don't have direct access to environ (man environ).
*/
# include <crt_externs.h>
# define environ (*_NSGetEnviron())
#include <crt_externs.h>
#define environ (*_NSGetEnviron())
#define epicsExportSharedSymbols
#include "epicsStdio.h"
#include <errlog.h>
#include <cantProceed.h>
#include <envDefs.h>
#include <osiUnistd.h>
#include "epicsFindSymbol.h"
#include <iocsh.h>
/*
* Set the value of an environment variable
* Leaks memory, but the assumption is that this routine won't be
* called often enough for the leak to be a problem.
*/
epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *value)
{
char *cp;
iocshEnvClear(name);
cp = mallocMustSucceed (strlen (name) + strlen (value) + 2, "epicsEnvSet");
strcpy (cp, name);
strcat (cp, "=");
strcat (cp, value);
if (putenv (cp) < 0) {
errPrintf(
-1L,
__FILE__,
__LINE__,
"Failed to set environment parameter \"%s\" to \"%s\": %s\n",
name,
value,
strerror (errno));
free (cp);
}
setenv(name, value, 1);
}
/*