From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,e3cd469828877a21 X-Google-Attributes: gidfee84,public X-Google-ArrivalTime: 1994-04-27 03:09:00 PST Path: gmd.de!nntp.gmd.de!xlink.net!howland.reston.ans.net!math.ohio-state.edu!sdd.hp.com!decwrl!pa.dec.com!src.dec.com!crl.dec.com!jac.zko.dec.com!hiyall.enet.dec.com!reagan From: reagan@hiyall.enet.dec.com (John R. Reagan) Newsgroups: comp.unix.osf.osf1 Subject: Re: Accessing Environment in DECPascal/OSF1 Date: 26 APR 94 21:14:41 Organization: Digital Equipment Corporation Message-ID: <2pkeqj$7om@jac.zko.dec.com> References: <2pio4e$958@cisun2000.unil.ch> NNTP-Posting-Host: HIYALL In article <2pio4e$958@cisun2000.unil.ch>, khofmann@isrec-sun1.unil.ch (Kay Hofmann) writes... >Is there a way in DECpascal (or, possibly in all DEC languages for OSF1) to >access the environment variables of unix? I didn't find nay hints in the >language reference and user manuals. > You can use the getenv(3) routine from libc. Since Pascal's strings aren't nul-terminated, you need to do some extra work to deal with them. Here's a working example: program getenv(input,output); type str255 = packed array [1..255] of char; strptr = ^str255; var envname : string(255); envvalue : strptr; function getenv( name : str255 ) : strptr; external; begin write('Environment variable to convert? '); readln(envname); envvalue := getenv(envname + chr(0)); writeln('Value is ',substr(envvalue^,1,index(envvalue^,chr(0)))); end. --- John Reagan Digital Equipment Corporation reagan@hiyall.enet.dec.com Disclaimer: The opinions and statements expressed by me are not necessarily those of Digital Equipment Corporation. ---