29 lines
1.2 KiB
Plaintext
29 lines
1.2 KiB
Plaintext
include c:\cxpl\codes; \intrinsic 'code' declarations
|
|
string 0; \use zero-terminated strings
|
|
int CpuReg, PspSeg, EnvSeg, I, J, C;
|
|
char EnvVar;
|
|
[CpuReg:= GetReg; \access CPU registers
|
|
PspSeg:= CpuReg(9); \get segment address of our PSP
|
|
EnvSeg:= Peek(PspSeg,$2C) + Peek(PspSeg,$2D)<<8;
|
|
EnvVar:= "PATH"; \environment variable
|
|
I:= 0;
|
|
loop [J:= 0;
|
|
loop [C:= Peek(EnvSeg,I); I:= I+1;
|
|
if C = 0 then quit;
|
|
if C = EnvVar(J) then
|
|
[J:= J+1;
|
|
if J = 4 then
|
|
[Text(0, EnvVar); \show env. var.
|
|
loop [C:= Peek(EnvSeg,I); \ and rest of
|
|
I:= I+1; \ its string
|
|
if C = 0 then exit;
|
|
ChOut(0, C);
|
|
];
|
|
];
|
|
]
|
|
else J:= 5; \line must start with environment variable
|
|
];
|
|
if Peek(EnvSeg,I) = 0 then quit; \double 0 = env. var. not found
|
|
];
|
|
]
|