Atmel CAVR-4 Manual De Usuario
![Atmel](https://files.manualsbrain.com/attachments/0369829915bda09f9c2e00fb805a7753579683b5/common/fit/150/50/8d2bf08978ec3e5bc63f4343ac5e91ce8d0e40045619fa520d910d64af8f/brand_logo.png)
CAVR-4
Part 1. Using the compiler
The DLIB runtime environment
73
Environment interaction
According to the C standard, your application can interact with the environment using
the functions
the functions
getenv
and
system
.
Note: The
putenv
function is not required by the standard, and the library does not
provide an implementation of it.
The
getenv
function searches the string, pointed to by the global variable
_ _environ
,
for the key that was passed as argument. If the key is found, the value of it is returned,
otherwise 0 (zero) is returned. By default, the string is empty.
otherwise 0 (zero) is returned. By default, the string is empty.
To create or edit keys in the string, you must create a sequence of null terminated strings
where each string has the format:
where each string has the format:
key=value\0
The last string must be empty. Assign the created sequence of strings to the
_ _environ
variable.
For example:
const char MyEnv[] = ”Key=Value\0Key2=Value2\0”;
_ _environ = MyEnv;
If you need a more sophisticated environment variable handling, you should implement
your own
your own
getenv
, and possibly
putenv
function. This does not require that you rebuild
the library. You can find source templates in the files
getenv.c
and
environ.c
in the
avr\src\lib
directory. For information about overriding default library modules, see
If you need to use the
system
function, you need to implement it yourself. The
system
function available in the library simply returns -1.
If you decide to rebuild the library, you can find source templates in the library project
template. For further information, see Building and using a customized library, page 62.
template. For further information, see Building and using a customized library, page 62.
Note: If you link your application with support for I/O debugging, the functions
getenv
and
system
will be replaced by C-SPY variants. For further information, see
Signal and raise
There are default implementations of the functions
signal
and
raise
available. If
these functions do not provide the functionality that you need, you can implement your
own versions.
own versions.