* Accessing Environment in DECPascal/OSF1
@ 1994-04-26 9:50 Kay Hofmann
1994-04-27 1:14 ` John R. Reagan
0 siblings, 1 reply; 2+ messages in thread
From: Kay Hofmann @ 1994-04-26 9:50 UTC (permalink / raw)
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.
Thanks a lot,
Kay Hofmann
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Accessing Environment in DECPascal/OSF1
1994-04-26 9:50 Accessing Environment in DECPascal/OSF1 Kay Hofmann
@ 1994-04-27 1:14 ` John R. Reagan
0 siblings, 0 replies; 2+ messages in thread
From: John R. Reagan @ 1994-04-27 1:14 UTC (permalink / raw)
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.
---
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1994-04-27 1:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-04-26 9:50 Accessing Environment in DECPascal/OSF1 Kay Hofmann
1994-04-27 1:14 ` John R. Reagan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox