Category : Utilities for DOS and Windows Machines
Archive   : ESET.ZIP
Filename : ESET.PAS

 
Output of file : ESET.PAS contained in archive : ESET.ZIP
{ $DEFINE DEBUGGING}

program eSet;

uses CRT,xCRT,Dos,EnvUnit;

procedure Explain;
begin
writeln;
writeln(MyName,MyExt,' Version 1.1 88/10/07');
writeln;
writeln('Instead of using the SET command type in:');
writeln;
writeln(' ',MyName,' name');
writeln;
writeln('to Edit and then SET the named environment variable.');
writeln;
writeln(' example : ',MyName,' PATH');
writeln;
writeln('Use the Ins,Del,Home,End and "arrow" keys to edit then press:');
writeln(' - Enter to "SET" the new environment variable');
writeln(' - or the Esc key to cancel your changes. ');
writeln;
writeln;
writeln('Author: Mike Babulic');
writeln(' 3827 Charleswood Dr NW Compuserve: 72307,314');
writeln(' Calgary, Alberta, CANADA');
writeln(' T2L 2C7');
writeln;
writeln('THIS PROGRAM IS DONATED TO THE PUBLIC DOMAIN');
writeln;
exit;
end;


procedure Msg(m:String);
begin
writeln;
ClrEol;
writeln(' ',m);
gotoXY(1,whereY-2);
end;

procedure Fatal(m:String);
var errcode : word;
begin
errcode := DosError;
Msg(m);
writeln; writeln;
halt(errcode);
end;

var
env, s : String;
efR : EfResult;
done : Boolean;
firstS : Integer; {first length of s}

procedure NoRoom;
var t : string;
l : integer;
begin
if firstS=0 then
l := EnvSize + length(env)+1+length(s)+1 - MaxEnvSize
else
l := EnvSize + length(s)-firstS - MaxEnvSize;
str(l,t);
t := 'Not enough memory to SET '+env+'. It is '+t+' byte';
if l>1 then t := t+'s';
Msg(t+' too long.')
end;

begin
env := UpperStr(ParamStr(1));
if env='' then
Explain
else begin
{ writeln; gotoXY(1,whereY-1);}
UseRootPSP;
{$IFDEF DEBUGGING}
writeln('EnvSize ',EnvSize,' (',MaxEnvSize,')');
{$ENDIF}
s := FirstNamed(env,#0);
firstS := length(s);
done := (firstS=0) and (EnvSize+length(env) >= MaxEnvSize);
if done then begin
gotoXY(1,whereY-1);
DosError := 8;
Fatal('There is no space for '+env+'.'
+' Try "SET" instead of "'+MyName+'".');
end;
while not done do begin
write(env,'=');
efR := EnterField(s,SizeOf(s),80,1);
Msg('');
done := (efR=efQuit);
if not done then begin
if env='PATH' then
s := UpperStr(s);
done := SetEnv(env,s);
if not done then begin
if DosError = 8 then
NoRoom
else
Fatal('SET '+env+' not done.');
end;
end;
end; {while}
clreol;
write(env,'=',FirstNamed(env,#0));
writeln;
end;
end.

  3 Responses to “Category : Utilities for DOS and Windows Machines
Archive   : ESET.ZIP
Filename : ESET.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/