comp.lang.ada
 help / color / mirror / Atom feed
* getenv in Ada
@ 1998-12-01  0:00 Fernando Tricas
  1998-12-02  0:00 ` Tom Moran
  0 siblings, 1 reply; 5+ messages in thread
From: Fernando Tricas @ 1998-12-01  0:00 UTC (permalink / raw)


Hello, 

is there a procedure or function similar to getenv in Ada95? The idea of
this function is to check (in c and in unix) the value of an environment
variable.

Thank you,

Fernando Tricas





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: getenv in Ada
  1998-12-02  0:00 ` Tom Moran
@ 1998-12-02  0:00   ` Corey Ashford
  1998-12-02  0:00   ` Tucker Taft
  1 sibling, 0 replies; 5+ messages in thread
From: Corey Ashford @ 1998-12-02  0:00 UTC (permalink / raw)


Tom Moran wrote:
> 
> >is there a procedure or function similar to getenv in Ada95?
> No, since many Ada targets have no such thing as an "environment".
> But any compiler targetted to Unix or DOS or Windows probably supplies
> a getenv function or its equivalent in a library.  Look in your
> compiler documentation.

In particular, if your environment supplies the POSIX 1003.5 API,
you can use Posix_Process_Environment.Environment_Value_Of
to read an environment variable.

Cheers

- Corey




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: getenv in Ada
  1998-12-02  0:00 ` Tom Moran
  1998-12-02  0:00   ` Corey Ashford
@ 1998-12-02  0:00   ` Tucker Taft
  1998-12-02  0:00     ` Keith Thompson
  1 sibling, 1 reply; 5+ messages in thread
From: Tucker Taft @ 1998-12-02  0:00 UTC (permalink / raw)


Tom Moran (tmoran@bix.com) wrote:

: >is there a procedure or function similar to getenv in Ada95?

: No, since many Ada targets have no such thing as an "environment".
: But any compiler targetted to Unix or DOS or Windows probably supplies
: a getenv function or its equivalent in a library.  Look in your
: compiler documentation.

Or if you know the name of the function in your C library,
then just define an appropriate Ada subprogram spec for it and use 
pragma Import.  At link-time, make sure the appropriate
C library gets searched.

--
-Tucker Taft   stt@inmet.com   http://www.inmet.com/~stt/
Intermetrics, Inc.  Burlington, MA  USA
An AverStar Company




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: getenv in Ada
  1998-12-02  0:00   ` Tucker Taft
@ 1998-12-02  0:00     ` Keith Thompson
  0 siblings, 0 replies; 5+ messages in thread
From: Keith Thompson @ 1998-12-02  0:00 UTC (permalink / raw)


stt@houdini.camb.inmet.com (Tucker Taft) writes:
> Tom Moran (tmoran@bix.com) wrote:
> 
> : >is there a procedure or function similar to getenv in Ada95?
> 
> : No, since many Ada targets have no such thing as an "environment".
> : But any compiler targetted to Unix or DOS or Windows probably supplies
> : a getenv function or its equivalent in a library.  Look in your
> : compiler documentation.
> 
> Or if you know the name of the function in your C library,
> then just define an appropriate Ada subprogram spec for it and use 
> pragma Import.  At link-time, make sure the appropriate
> C library gets searched.

Note that the getenv function is part of standard C, so any conforming
hosted C implementation must provide it by that name, though the
semantics are implementation-defined.  (A freestanding implementation
of C may or may not provide getenv.)

-- 
Keith Thompson (The_Other_Keith) kst@cts.com <http://www.ghoti.net/~kst> <*>
Qualcomm, San Diego, California, USA  <http://www.qualcomm.com>
I must be a techno-geek.  My mouse is bigger than my phone.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: getenv in Ada
  1998-12-01  0:00 getenv in Ada Fernando Tricas
@ 1998-12-02  0:00 ` Tom Moran
  1998-12-02  0:00   ` Corey Ashford
  1998-12-02  0:00   ` Tucker Taft
  0 siblings, 2 replies; 5+ messages in thread
From: Tom Moran @ 1998-12-02  0:00 UTC (permalink / raw)


>is there a procedure or function similar to getenv in Ada95?
No, since many Ada targets have no such thing as an "environment".
But any compiler targetted to Unix or DOS or Windows probably supplies
a getenv function or its equivalent in a library.  Look in your
compiler documentation.




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1998-12-02  0:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-12-01  0:00 getenv in Ada Fernando Tricas
1998-12-02  0:00 ` Tom Moran
1998-12-02  0:00   ` Corey Ashford
1998-12-02  0:00   ` Tucker Taft
1998-12-02  0:00     ` Keith Thompson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox