From: reagan@hiyall.enet.dec.com (John R. Reagan)
Subject: Re: Accessing Environment in DECPascal/OSF1
Date: 26 APR 94 21:14:41 [thread overview]
Message-ID: <2pkeqj$7om@jac.zko.dec.com> (raw)
In-Reply-To: 2pio4e$958@cisun2000.unil.ch
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.
---
prev parent reply other threads:[~1994-04-27 1:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1994-04-26 9:50 Accessing Environment in DECPascal/OSF1 Kay Hofmann
1994-04-27 1:14 ` John R. Reagan [this message]
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox