home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 13
/
AACD13.ISO
/
AACD
/
Resources
/
System
/
BoingBag1
/
Contributions
/
Workbench
/
RexxArpLib3p6
/
src
/
env.c
< prev
next >
Wrap
C/C++ Source or Header
|
1998-06-21
|
2KB
|
83 lines
/** Env.c
*
* Implement the Amiga environment access functions for rexxarplib.library.
*
* AUTHOR/DATE: W.G.J. Langeveld, November 1987.
* ============
*
* CURRENT VERSION:
*
* This version has been converted to SAS C 6.5 format. It has been modified
* for modern definition sequences for ANSI compilation. This no longer works
* with OS versions prior to 2.04.
*
* AUTHOR/DATE: Joanne Dow, jdow@bix.com, June 1998.
* ============
*
**/
#include <functions.h>
#include "ralprotos.h"
#include <intuition/intuitionbase.h>
#include <libraries/MyARP.h>
#include <proto/rexxsyslib.h>
#include <dos/var.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "rexxarplib.h"
extern struct ArpBase *ArpBase;
/**
*
* Get an environment variable
*
**/
char *rxf_getenv( long *err, int n, char *args[] )
{
register long exists = 0L;
char result[256];
*err = 0L;
exists = GetVar(args[0], result, 256L, GVF_BINARY_VAR | LV_VAR);
result[255] = 0;
if (exists != -1L)
return(CAS(result));
exists = (long) Getenv(args[0], result, 256L);
if (exists)
return(CAS(result));
else
return(CAS(""));
}
/**
*
* Set an environment variable
*
**/
char *rxf_setenv( long *err, int n, char *args[] )
{
register long test = 0L;
*err = 0L;
if (n > 1)
{
test = SetVar(args[0], args[1], (long) strlen(args[1]),
GVF_GLOBAL_ONLY | LV_VAR);
}
else
{
test = DeleteVar(args[0], LV_VAR);
}
if (test)
return(CAS("1"));
return(CAS("0"));
}