[comp.os.os9] Environment Variables

rh2y+@andrew.cmu.edu (Russell E. Hoffman, II) (03/09/90)

What is the appropriate method for reading shell environment variables
from within C programs in os9/68000 V2.1? For that matter, how do you
do it in RMA, as well?

Russell Hoffman
Carnegie Mellon University
rh2y+@andrew.cmu.edu
--------------------------
"<catchy-quotation>" [--- <author-of-quote>]

jejones@mcrware.UUCP (James Jones) (03/09/90)

In article <IZxcCaG00WB_AVJ0g6@andrew.cmu.edu> rh2y+@andrew.cmu.edu (Russell E. Hoffman, II) writes:
>What is the appropriate method for reading shell environment variables
>from within C programs in os9/68000 V2.1? For that matter, how do you
>do it in RMA, as well?

From within C programs, I'd use getenv().  From assembly language, life may be
a little tougher.  Unlike Unix, OS-9 doesn't have a separate environment, so
conventions were established for the parameter string to be used to pass the
environment.  The parsing of that stuff is handled by the code in cstart.r,
which is linked in with every C program (unless you roll your own cstart).
If you have a program written entirely in assembly language, you'll have to
do parsing equivalent to that which cstart.r does, and that of course will
require that you know how that parameter string is built up.  I believe that
an issue of *Pipelines* a while back covered that; Microware may have some
back issues still available.

	James Jones