Compare commits

...

14 Commits

Author SHA1 Message Date
Ralph Lange
ce7943fb44 Update version to 3.15.6, remove "not released" from release notes 2018-10-11 15:24:36 +02:00
Ralph Lange
4e865a03d8 libCom/osi: fix epicsEnvUnset for WIN32 and solaris 2018-10-11 15:12:10 +02:00
Ralph Lange
9a4febd3bc Merge Dirk Zimoch's 'epicsEnvUnset' branch into 3.15 2018-10-11 11:42:19 +02:00
Andrew Johnson
dc5d373b57 Revert "configure: add vpath for CONFIG* and RULES* (look in SRC_DIRS)"
Unfortunately this causes really bad things to happen; the
configure/RULES file is getting overwritten by the contents of
src/libCom/as/RULES, so we need a different approach.

This reverts commit 47c361f135.
2018-10-10 13:04:54 -05:00
Ralph Lange
47c361f135 configure: add vpath for CONFIG* and RULES* (look in SRC_DIRS) 2018-10-10 17:10:14 +02:00
Ralph Lange
9943796f7f libCom/osi: fix recent epicsStdio.h change for gcc 2.x 2018-10-08 15:46:50 +02:00
3cb72ec209 Merge branch '3.15' into epicsEnvUnset
Conflicts:
	documentation/RELEASE_NOTES.html
2018-10-08 11:02:03 +02:00
701ef5b936 mention epicsEnvUnset in RELEASE_NOTES.html 2018-10-08 10:49:25 +02:00
c3995a9d63 added simple test case for epicsEnvUnset 2018-10-08 10:48:09 +02:00
ce3eadde34 add missing epicsEnvUnset to header 2018-10-08 10:37:34 +02:00
Andrew Johnson
62929fcbd1 Adjust the 'git archive' commands in Release Checklist
The tarfile should not include any files that were added to
support our development process and CI build agents. I have
even excluded .gitignore from previous releases.

I had already done this in 3.16, and 7.0 has a script for
generating the tarfile.
2018-10-05 17:43:33 -05:00
Ralph Lange
456a68eb96 Version number update to 3.15.6-rc1-DEV 2018-10-05 17:05:23 +02:00
65714033ea remove compiler warning 2018-10-03 15:29:30 +02:00
7151fbe498 implement epicsEnvUnset 2018-10-03 15:18:59 +02:00
14 changed files with 272 additions and 7 deletions

View File

@@ -39,11 +39,11 @@ EPICS_PATCH_LEVEL = 0
#EPICS_DEV_SNAPSHOT=-pre1-DEV
#EPICS_DEV_SNAPSHOT=-pre2
#EPICS_DEV_SNAPSHOT=-pre2-DEV
EPICS_DEV_SNAPSHOT=-rc1
#EPICS_DEV_SNAPSHOT=-rc1
#EPICS_DEV_SNAPSHOT=-rc1-DEV
#EPICS_DEV_SNAPSHOT=-rc2
#EPICS_DEV_SNAPSHOT=-rc2-DEV
#EPICS_DEV_SNAPSHOT=
EPICS_DEV_SNAPSHOT=
# No changes should be needed below here

View File

@@ -9,13 +9,15 @@
<body lang="en">
<h1 align="center">EPICS Base Release 3.15.6</h1>
<p style="color:red">This version of EPICS Base has not been released yet.</p>
<h2 align="center">Changes made on the 3.15 branch since 3.15.5</h2>
<!-- Insert new items immediately below here ... -->
<h3>Unsetting environment variables</h3>
<p>The new command <code>epicsEnvUnset <i>varname</i></code> can be used to
unset an environment variable.</p>
<h3>Warning indicators in msi (and macLib) output</h3>
<p>The libCom macro expansion library has been modified so that when the

View File

@@ -158,7 +158,7 @@ relevent roles unless the Release Manager designates otherwise:</p>
files and directories that are only used for continuous integration:
<blockquote><tt>
cd base-3.15<br />
git archive --prefix=base-3.15.6-rc1/ R3.15.6-rc1 --output=base-3.15.6-rc1.tar.gz
git archive --prefix=base-3.15.6-rc1/ --output=base-3.15.6-rc1.tar.gz R3.15.6-rc1 configure documentation LICENSE Makefile README src startup
</tt></blockquote>
Create a GPG signature file of the tarfile as follows:
<blockquote><tt>
@@ -285,7 +285,7 @@ relevent roles unless the Release Manager designates otherwise:</p>
generates a gzipped tarfile directly from the repository:
<blockquote><tt>
cd base-3.15<br />
git archive --prefix=base-3.15.6/ R3.15.6 --output=base-3.15.6.tar.gz
git archive --prefix=base-3.15.6/ --output=base-3.15.6.tar.gz R3.15.6 configure documentation LICENSE Makefile README src startup
</tt></blockquote>
Create a GPG signature file of the tarfile as follows:
<blockquote><tt>

View File

@@ -95,6 +95,7 @@ epicsShareFunc long epicsShareAPI
envGetBoolConfigParam(const ENV_PARAM *pParam, int *pBool);
epicsShareFunc long epicsShareAPI epicsPrtEnvParams(void);
epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *value);
epicsShareFunc void epicsShareAPI epicsEnvUnset (const char *name);
epicsShareFunc void epicsShareAPI epicsEnvShow (const char *name);
#ifdef __cplusplus

View File

@@ -110,6 +110,21 @@ static void epicsEnvSetCallFunc(const iocshArgBuf *args)
epicsEnvSet (name, value);
}
/* epicsEnvUnset */
static const iocshArg epicsEnvUnsetArg0 = { "name",iocshArgString};
static const iocshArg * const epicsEnvUnsetArgs[1] = {&epicsEnvUnsetArg0};
static const iocshFuncDef epicsEnvUnsetFuncDef = {"epicsEnvUnset",1,epicsEnvUnsetArgs};
static void epicsEnvUnsetCallFunc(const iocshArgBuf *args)
{
char *name = args[0].sval;
if (name == NULL) {
fprintf(stderr, "Missing environment variable name argument.\n");
return;
}
epicsEnvUnset (name);
}
/* epicsParamShow */
static const iocshFuncDef epicsParamShowFuncDef = {"epicsParamShow",0,NULL};
static void epicsParamShowCallFunc(const iocshArgBuf *args)
@@ -367,6 +382,7 @@ void epicsShareAPI libComRegister(void)
iocshRegister(&pwdFuncDef, pwdCallFunc);
iocshRegister(&epicsEnvSetFuncDef, epicsEnvSetCallFunc);
iocshRegister(&epicsEnvUnsetFuncDef, epicsEnvUnsetCallFunc);
iocshRegister(&epicsParamShowFuncDef, epicsParamShowCallFunc);
iocshRegister(&epicsPrtEnvParamsFuncDef, epicsPrtEnvParamsCallFunc);
iocshRegister(&epicsEnvShowFuncDef, epicsEnvShowCallFunc);

View File

@@ -91,6 +91,7 @@ epicsShareFunc int epicsShareAPI epicsStdoutPutchar(int c);
}
/* Also pull functions into the std namespace (see lp:1786927) */
#if !defined(__GNUC__) || (__GNUC__ > 2)
namespace std {
using ::epicsGetStdin;
using ::epicsGetStdout;
@@ -99,6 +100,7 @@ using ::epicsStdoutPrintf;
using ::epicsStdoutPuts;
using ::epicsStdoutPutchar;
}
#endif /* __GNUC__ > 2 */
#endif /* __cplusplus */

View File

@@ -39,6 +39,16 @@ epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *val
setenv(name, value, 1);
}
/*
* Unset an environment variable
*/
epicsShareFunc void epicsShareAPI epicsEnvUnset (const char *name)
{
iocshEnvClear(name);
unsetenv(name);
}
/*
* Show the value of the specified, or all, environment variables
*/

View File

@@ -0,0 +1,89 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Saskatchewan
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/* osdEnv.c */
/*
* Author: Eric Norum
* Date: May 7, 2001
*
* Routines to modify/display environment variables and EPICS parameters
*
*/
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
#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);
}
}
/*
* Unset an environment variable
* Using putenv with a an existing name plus "=" (without value) deletes
*/
epicsShareFunc void epicsShareAPI epicsEnvUnset (const char *name)
{
iocshEnvClear(name);
if (getenv(name) != NULL)
epicsEnvSet((char*)name, "");
}
/*
* Show the value of the specified, or all, environment variables
*/
epicsShareFunc void epicsShareAPI epicsEnvShow (const char *name)
{
if (name == NULL) {
extern char **environ;
char **sp;
for (sp = environ ; (sp != NULL) && (*sp != NULL) ; sp++)
printf ("%s\n", *sp);
}
else {
const char *cp = getenv (name);
if (cp == NULL)
printf ("%s is not an environment variable.\n", name);
else
printf ("%s=%s\n", name, cp);
}
}

View File

@@ -55,6 +55,18 @@ epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *val
}
}
/*
* Unset an environment variable
* Using putenv with a an existing name but without "=..." deletes
*/
epicsShareFunc void epicsShareAPI epicsEnvUnset (const char *name)
{
iocshEnvClear(name);
if (getenv(name) != NULL)
putenv((char*)name);
}
/*
* Show the value of the specified, or all, environment variables
*/

View File

@@ -36,6 +36,16 @@ epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *val
setenv(name, value, 1);
}
/*
* Unset an environment variable
*/
epicsShareFunc void epicsShareAPI epicsEnvUnset (const char *name)
{
iocshEnvClear(name);
unsetenv(name);
}
/*
* Show the value of the specified, or all, environment variables
*/

View File

@@ -0,0 +1,62 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Saskatchewan
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/* osdEnv.c */
/*
* Author: Eric Norum
* Date: May 7, 2001
*
* Routines to modify/display environment variables and EPICS parameters
*
*/
#include <stdlib.h>
#include <stdio.h>
#define epicsExportSharedSymbols
#include "epicsStdio.h"
#include "envDefs.h"
#include "osiUnistd.h"
#include "iocsh.h"
/*
* Set the value of an environment variable
*/
epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *value)
{
iocshEnvClear(name);
setenv(name, value, 1);
}
/*
* Unset an environment variable
*/
epicsShareFunc void epicsShareAPI epicsEnvUnset (const char *name)
{
iocshEnvClear(name);
unsetenv(name);
}
/*
* Show the value of the specified, or all, environment variables
*/
epicsShareFunc void epicsShareAPI epicsEnvShow (const char *name)
{
if (name == NULL) {
extern char **environ;
char **sp;
for (sp = environ ; (sp != NULL) && (*sp != NULL) ; sp++)
printf ("%s\n", *sp);
}
else {
const char *cp = getenv (name);
if (cp == NULL)
printf ("%s is not an environment variable.\n", name);
else
printf ("%s=%s\n", name, cp);
}
}

View File

@@ -51,6 +51,25 @@ epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *val
}
}
/*
* Unset an environment variable
* Basically destroy the name of that variable because vxWorks does not
* support to really unset an environment variable.
*/
epicsShareFunc void epicsShareAPI epicsEnvUnset (const char *name)
{
char* var;
if (!name) return;
iocshEnvClear(name);
var = getenv(name);
if (!var) return;
var -= strlen(name);
var --;
*var = 0;
}
/*
* Show the value of the specified, or all, environment variables
*/

View File

@@ -62,6 +62,11 @@ epicsEnvTest_SRCS += epicsEnvTest.c
testHarness_SRCS += epicsEnvTest.c
TESTS += epicsEnvTest
TESTPROD_HOST += epicsEnvUnsetTest
epicsEnvUnsetTest_SRCS += epicsEnvUnsetTest.c
testHarness_SRCS += epicsEnvUnsetTest.c
TESTS += epicsEnvUnsetTest
TESTPROD_HOST += epicsErrlogTest
epicsErrlogTest_SRCS += epicsErrlogTest.c
testHarness_SRCS += epicsErrlogTest.c

View File

@@ -0,0 +1,37 @@
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "macLib.h"
#include "envDefs.h"
#include "errlog.h"
#include "epicsUnitTest.h"
#include "testMain.h"
static void check(const char* variable, const char* expected)
{
const char* value;
value = getenv(variable);
if (!testOk((!expected && !value) || (expected && value && strcmp(expected, value) == 0),
"%s = \"%s\"", variable, value))
{
testDiag("should have been \"%s\"", expected);
}
}
MAIN(epicsEnvUnsetTest)
{
eltc(0);
testPlan(3);
check("TEST_VAR_A",NULL);
epicsEnvSet("TEST_VAR_A","test value");
check("TEST_VAR_A","test value");
epicsEnvUnset("TEST_VAR_A");
check("TEST_VAR_A",NULL);
testDone();
return 0;
}