Category : Pascal Source Code
Archive   : PROD30S1.ZIP
Filename : CHKPATH.PAS

 
Output of file : CHKPATH.PAS contained in archive : PROD30S1.ZIP

(*
* Copyright 1989 Samuel H. Smith; All rights reserved
*
* This is a component of the ProDoor System.
* Do not distribute modified versions without my permission.
* Do not remove or alter this notice or any other copyright notice.
* If you use this in your own program you must distribute source code.
* Do not use any of this in a commercial product.
*
*)


(*
* chkpath - check for a program in the current PATH list;
* report to stdout if the program is not present
*
*)

{$m 8000,0,0}
{$s-,r-}

program check_path;

uses dos;

const
version = 'ChkPath v1.0 05-06-89 (C) 1989 S.H.Smith';

var
found: boolean;
command: string[128];
path: string[128];


procedure displn(what: string);
begin
writeln(what);
end;

procedure report(what: string);
begin
displn(paramstr(2)+': '+what);
end;


procedure lookfor(ext: string);
var
fname: string[128];
result: string[128];
begin
if not found then
begin
fname := command+ext;
result := fsearch(fname,path);
if result <> '' then
begin
found := true;
if GetEnv('PRODEBUG') = 'ON' then
displn('ProDebug: Program='+result);
end;
end;
end;


var
i: integer;
begin
path := GetEnv('PATH');
command := paramstr(1);
for i := 1 to length(command) do
command[i] := upcase(command[i]);
found := false;

if paramcount = 0 then
begin
displn(version);
displn('Usage: chkpath COMMAND [MESSAGE_PREFIX]');
halt(1);
end;

if path = '' then
report('WARNING: There is no "PATH" variable in the environment!');

lookfor('.EXE');
lookfor('.COM');
lookfor('.BAT');
if not found then
begin
report('Can''t locate program: '+command);
report('Current PATH is: "'+path+'"');
halt(1);
end;

halt(0);
end.


  3 Responses to “Category : Pascal Source Code
Archive   : PROD30S1.ZIP
Filename : CHKPATH.PAS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/