(C) 1998 AROS - The Amiga Research OS


NAME

STRPTR Getenv (string , buffer , size )

LOCATION
In ArpBase at offset 47

SYNOPSIS
char * string
char * buffer
ULONG size

FUNCTION
This function provides an environment variable mechanism compatible with MANX. Note that this call is more efficient than using the manx getenv() function call when arplibrary is installed.

INPUTS
string
- pointer to an environment variable name.
buffer
- a user allocated area which will be used to store the value associated with the environment variable. This may be NULL.
size
- size of buffer region in bytes.
RESULT
If found, a pointer to the start of the value string for that variable will be returned. If buffer is non-null, then as much of the value string as allowed by size will be copied into the user buffer. ADDTIONAL CONSIDERATIONS MANX was the first to implement environment variables on the Amiga. As a result, we are trying to be compatible with their implementation. Note that this function is NOT equivalent to MANX getenv() call, but can easily be constructed using this this function. Note also that all calls by MANX will be handled by arplibrary when it is installed. You would be wise to run as Forbidden all code which examines the environment space of the arp.library (for example, using the return value of this function). As an example, the following code performs identically to the manx getenv() function: char getenv(variable) char *variable; { char *temp; static char *buffer; free(buffer); // Free memory from last call Forbid(); temp = Getenv(name, 0L, 0L); if (!temp) Permit(), return(0); buffer = malloc(strlen(temp)); strcpy(buffer, temp); Permit(); return (buffer); }

EXAMPLE
SEE ALSO

NOTES

BUGS
If size is not large enough, the complete value of that environment variable will not be copied to the user buffer.

INTERNALS

HISTORY
20.10.1998 hkiel
Amiga Research OS
28.03.1998 bergers
Some new functions.