From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8dea6f46dfb95f66 X-Google-Attributes: gid103376,public From: "Norman H. Cohen" Subject: Re: Environment variables Date: 1996/10/31 Message-ID: <3278B9B1.1773@watson.ibm.com>#1/1 X-Deja-AN: 193647099 references: <55819q$mql@newslink.runet.edu> content-type: text/plain; charset=us-ascii organization: IBM Thomas J. Watson Research Center mime-version: 1.0 reply-to: ncohen@watson.ibm.com newsgroups: comp.lang.ada x-mailer: Mozilla 3.0 (Win95; I) Date: 1996-10-31T00:00:00+00:00 List-Id: Christopher J Arnold wrote: > All I want to do is to be able to read the value of environment > variables, such as PATH for example. I've looked around at FAQ's and the > adahome reference pages, but I haven't found anything. This happens to be the example used to illustrate the use of Interfaces.C.Strings on page 989 of Ada as a Second Language. It's only a couple of dozen lines long, including comments. For purposes of illustration, the example there returns a value of type String--the empty string for undefined environment variables and the value of the variable surrounded by '"' characters for defined variables. (This allows an undefined environment variable and an environment variable defined to be the empty string to be represented by two different values of type String.) However, this is probably not the most convenient interface to use. The example is easily modified to behave more like the C getenv function--returning a null access value for an undefined environment variable and an access value pointing to some String value for a defined environment variable. -- Norman H. Cohen mailto:ncohen@watson.ibm.com http://www.research.ibm.com/people/n/ncohen