DL9 envvar.lbr
1 messages in this thread
Hi, I have just gotten back on CIS after a rather long enforced absence and
saw your message. I wrote those programs and a friend uploaded them for me.
They give amigados UNIX-like environment variables accessible from CLI and
user written C programs. If you are at all familiar with UNIX then you have
probably used environment variables consciously or unconsciously. If not,
then I can try to explain and you can ignore the rest of this message.
Environment variables are like having associative or logical memory that is
maintained by the OS, (in this case my programs) that allow you to set up
associations between character strings, that is, you tell the system that you
want it to store two character strings of your choice and that on demand, one
should be translated into the other. Of course you may store as many as you
want, but they are associated in pairs. For example suppose I write a C
program that creates and writes to a file called OUTFILE. Now if ithe C
program I use one of the provided functions: getenv() before opening the
file, thus: filename=getenv("OUTFILE");
fd=fopen(filename,"w");
then if the user in CLI before invoking my program typed: SET OUTFILE TO
DF1:PRINTOUTS/FILE1 then when getenv is called in the C program, the value
returned to filename will be "DF1:PRINTOUTS/FILE1" I could then SET outfile
to something else and run my program again etc there is also a companion
routine setenv() that does inside a C program what SET does in the CLI. Of
course this is not a good example since this kind of thing could have been
done with I/O redirection, but you can use environment variables for example
to set user options in a program, or specify what environment the program is
running in, or allow communication between programs, (one could use setenv,
one use getenv) etc, put SET commands in your startup-file telling how many
disks you have, how much memory etc, then programs could find this out easily
for themselves. They are used for many things in UNIX systems and I needed
them for a project I'm working on, so I uploaded in case anyone else was
interested. Hope this explanation isn't too long or confused.