(C) 1998 AROS - The Amiga Research OS


NAME
#include <dos/var.h>
#include <proto/dos.h>

LONG GetVar (name , buffer , size , flags)

LOCATION
In DOSBase at offset 151

SYNOPSIS
STRPTR name
STRPTR buffer
LONG size
LONG flags

FUNCTION
This function will return the value of a local or environmental variable in the supplied buffer.

It is advised to only use ASCII characters with a variable, but this is not required.

If GVF_BINARY_VAR is not specified, this function will stop putting characters into the destination buffer when a '\n' is hit, or the end of the buffer is reached. Otherwise it will complete fill the buffer.

INPUTS
name
the name of the variable you want.
buffer
Space to store the returned variable.
size
Length of the buffer in bytes.
flags
A combination of the type of variable to get (lower 8 bits) and flags that control the value of this function. Current flags are:

GVF_GLOBAL_ONLY
only tries to get a global variable.
GVF_LOCAL_ONLY
only tries to get a local variable.
GVF_BINARY_VAR
do not stop at a '\n' character.
GVF_DONT_NULL_TERM
no NULL termination. This only applies to GVF_BINARY_VAR.

RESULT
Will return the number of characters put in the buffer, or -1 if the variable is not defined. The '\n' character if it exists will not be placed in the buffer.

If the value would overflow the user buffer, then the number of characters copied into the buffer will be returned and the buffer truncated.The buffer will be NULL terminated unless GVF_DONT_NULL_TERM is set.

IoErr() will contain either: ERROR_OBJECT_NOT_FOUND if the variable is not defined. ERROR_BAD_NUMBER if the size of the buffer is 0. the total length of the variable otherwise.

EXAMPLE

SEE ALSO
DeleteVar(), FindVar(), SetVar()

NOTES

BUGS
LV_VAR is the only type that can be global.

INTERNALS
Redo the RESULT documentation.

HISTORY
20.10.1998 hkiel
Amiga Research OS
25.04.1998 bergers
Bugfix. Setenv, Getenv, Set, Get are now working correctly.
05.12.1997 srittau
Fixed warning
02.12.1997 bergers
Hopefully the last revision :-))
30.11.1997 bergers
Yet another bugfix
28.11.1997 bergers
Fixed some bugs
16.08.1997 iaint
These may not always work, but try them anyway
27.01.1997 ldp
Polish
09.12.1996 aros
Added empty templates for all missing functions

Moved #include's into first column