[comp.sys.amiga] <stdlib.h> getenv

roch@uiucdcsb.cs.uiuc.edu (01/22/88)

While looking through the include files for Lattice 4.0, I noticed
that getenv is defined in stdlib.h.  Curious, I tried accessing
the environment variables set by assign, both with and without
the colon, but in each case the null string was returned.  My
program looked like this:

#include <stdlib.h>
#include <stdio.h>

void main()
{
	char *s;

	s = getenv("include"); /* also tried include: */
	printf ("<%s>\n",s);
}

The map file shows that getenv is 0x328 bytes.  Can anyone tell
me what's going on? 
				thanks,
				david roch
				roch@b.uiuc.edu

spencer@eris (Randal m. Spencer [RmS]) (01/24/88)

Recently on *comp.sys.amiga* roch@uiucdcsb.cs.uiuc.edu wrote:
...
...While looking through the include files for Lattice 4.0, I noticed
...that getenv is defined in stdlib.h.  Curious, I tried accessing
...the environment variables set by assign, both with and without
...the colon, but in each case the null string was returned. 

I haven't upgraded my Lattice 3.03 yet (devout Manx user)(I said
*YET*, John!  I'll get to it, around the time I send you Shakespeare:')

So, from a Manx POV I get the impression that you are talking about
Environmental Variables.  Assigns are different.  Assigns are done
with the Assign command, and are logical names of volumes or devices,
Environmental Variables (originated by Jim Goodenow 11) are created
with the Set command.  A version of set is in the PD so you don't 
have to be a Manx person to use it.

Environmental Variables are fully supported under ARP.

Their useful for keeping information (other than pointers to volumes
or devices).  Manx uses them to point the compiler at all places to
look at to find Include files.  It could be used by a terminal program
to tell which serial port to talk to, and what speed to go at without
creating a .vt100rc file.

Try the program you sent to the net again, but first putenv() something
and then getenv() it back.  That should work.

...				david roch


-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Randy Spencer      P.O. Box 4542   Berkeley  CA  94704        (415)222-7595 
spencer@mica.berkeley.edu        I N F I N I T Y         BBS: (415)222-9416
..ucbvax!mica!spencer            s o f t w a r e                  AAA-WH1M
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-