This is Unofficial EPICS BASE Doxygen Site
osdEnv.c File Reference
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
#include "epicsStdio.h"
#include <errlog.h>
#include <cantProceed.h>
#include <envDefs.h>
#include <osiUnistd.h>
#include "epicsFindSymbol.h"
#include <iocsh.h>
+ Include dependency graph for osdEnv.c:

Go to the source code of this file.

Functions

LIBCOM_API void epicsStdCall epicsEnvSet (const char *name, const char *value)
 Set an environment variable's value. More...
 
LIBCOM_API void epicsStdCall epicsEnvUnset (const char *name)
 Clear the value of an environment variable. More...
 
LIBCOM_API void epicsStdCall epicsEnvShow (const char *name)
 Print value of an environment variable, or all variables. More...
 

Function Documentation

LIBCOM_API void epicsStdCall epicsEnvSet ( const char *  name,
const char *  value 
)

Set an environment variable's value.

The setenv() routine is not available on all operating systems. This routine provides a portable alternative for all EPICS targets.

Parameters
nameEnvironment variable name.
valueNew value for environment variable.

Definition at line 32 of file osdEnv.c.

33 {
34  if (!name) return;
35  iocshEnvClear(name);
36  setenv(name, value, 1);
37 }
Definition: link.h:174
void epicsStdCall iocshEnvClear(const char *name)
Definition: iocsh.cpp:1054
LIBCOM_API void epicsStdCall epicsEnvShow ( const char *  name)

Print value of an environment variable, or all variables.

Parameters
nameEnvironment variable name, or NULL to show all.

Definition at line 52 of file osdEnv.c.

53 {
54  if (name == NULL) {
55  extern char **environ;
56  char **sp;
57 
58  for (sp = environ ; (sp != NULL) && (*sp != NULL) ; sp++)
59  printf ("%s\n", *sp);
60  }
61  else {
62  const char *cp = getenv (name);
63  if (cp == NULL)
64  printf ("%s is not an environment variable.\n", name);
65  else
66  printf ("%s=%s\n", name, cp);
67  }
68 }
#define printf
Definition: epicsStdio.h:41
#define NULL
Definition: catime.c:38
#define environ
Definition: osdEnv.c:26
LIBCOM_API void epicsStdCall epicsEnvUnset ( const char *  name)

Clear the value of an environment variable.

Parameters
nameEnvironment variable name.

Definition at line 43 of file osdEnv.c.

44 {
45  iocshEnvClear(name);
46  unsetenv(name);
47 }
void epicsStdCall iocshEnvClear(const char *name)
Definition: iocsh.cpp:1054