home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
RBBS in a Box Volume 1 #3.1
/
RBBSIABOX31.cdr
/
pc_s
/
pathfi.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1985-06-23
|
2KB
|
73 lines
program PATHFIND (output);
{ Although TURBO Pascal itself does not find its own files like
TURBO.MSG, your program can do it ! No difficult installation
programs necessary, just use PATHFIND.
The following function, which you can include in your programs,
returns the string, to which your program environment path is
set. (The function can be changed for searching for COMSPEC or
PROMPT by changing the const PATH_PREFIX.)
If you like this program, please keep your $30.- and have a
German beer on us.
Uploaded for public use by:
Rupert & Wolfgang (RMI Aachen/Germany)
}
type
str = string[255];
(*************************************************************************)
function path_finder : str;
const
path_prefix = 'PATH=';
var nullz,ende : boolean;
c : char;
path_counter,
count1,count2 : integer;
path : str;
begin
nullz := FALSE;
ende := FALSE;
count1 := memw[cseg:$2c];
count2 := 0;
path := '';
repeat
c := chr(mem[count1:count2]);
if c <> #0 then
begin
path := path + c;
nullz := FALSE;
end
else
if (not nullz) then
begin
if pos(path_prefix,path) = 0 then path := ''
else ende := TRUE;
nullz := TRUE;
end
else ende := TRUE;
count2 := succ (count2);
until ende;
delete (path,1,5);
path_finder := path;
end; (* path_finder *)
(*************************************************************************)
begin
writeln ('Your PATH is set to: ',path_finder);
end.