home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
MBUG
/
MBUG053.ARC
/
U.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1979-12-31
|
5KB
|
142 lines
Program U; { Show USER status }
{*************************************}
{*************************************
** Program : U May 1987 **
** **
** A Utility to Indicate which **
** User areas on the currently **
** logged disc are occupied. **
** **
** Author : Robert A Smith. **
** Briar Hill. Melb. **
** Victoria 3088. **
** **
** Version : 1.1 **
** Date : 25-5-87 **
*************************************}
Type {Image of System File Control Block}
FCBlock = Array[0..15] of Byte;
Const
SetDMA = 26; {BDOS Function Call}
SetUser = 32; {BDOS Function Call}
GetUser = 32; {BDOS Function Call}
SearchFirst = 17; {BDOS Function Call}
HiLightOn = #27#41; {Sequence to start inverse chars}
HiLightOff = #27#40; {Sequence to stop inverse chars}
SearchMask : FCBlock {Wild-Card mask }
= (0,63,63,63,63,63,63,63,63,63,63,63,0,0,0,0);
Var
Occupied : Array[0..15] of Boolean; {'Occupied User' flag register}
DMAbuffer : Array[1..128] of Byte; {Buffer used for disc search}
FCBbuffer : FCBlock; {FCB used for Wild-Card search}
Count, {General counter}
User, {User search pointer}
CurrentUser : Integer; {Current User number storage}
Procedure InitialiseDMA;
{**********************}
Begin
{Call System to set temporary read buffer}
Bdos(SetDMA,Addr(DMAbuffer));
End;
Procedure InitialiseFCB;
{**********************}
Begin
{Put search mask into search File Control Block}
Move(SearchMask,FCBbuffer,Sizeof(FCBlock));
End;
Procedure GetCurrentUser;
{***********************}
Begin
{Call System to obtain current User number}
CurrentUser:=Bdos(GetUser,255);
End;
Procedure SearchForOccupiedUsers;
{*******************************}
Begin
Gotoxy(9,4); Write ('Now checking User ');
Delay(1000); {Cosmetic delay}
{Set-up loop to search all User numbers}
For User:=0 to 15 do
Begin
{Initialise, or reset, flag for a User}
Occupied[User]:=False;
{Call System to change to this User}
Bdos(SetUser,User);
{Advise what User is being searched}
Gotoxy(27,4); Write (User:2);
{Call System to search this User for any file}
If Bdos(SearchFirst,Addr(FCBbuffer)) < 255
{If a file is found, set flag for this User}
Then Occupied[User]:=True;
End;
End;
Procedure DisplayHeading;
{***********************}
Begin
{Output a line of dashes}
Gotoxy( 8,2); For Count:=1 to 65 do Write ('-');
{Display heading}
Gotoxy(20,2); Writeln (' Users containing files on current disc ');
Writeln;
End;
Procedure DisplayResults;
{***********************}
Begin
Gotoxy(8,4);
{Set-up loop to display status of all Users}
For User:=0 to 15 do
Begin
If Occupied[User]
{Show User number in inverse}
Then Write (' ',HiLightOn,User:2,' ',HiLightOff)
{Show User number in normal}
Else Write (' ', User:2,' ' );
End;
Writeln;
End;
Procedure RestoreCurrentUser;
{***************************}
Begin
{Restore original User number}
Bdos(SetUser,CurrentUser);
End;
Procedure DisplayCurrentUser;
{***************************}
Begin
{Output a line of dashes}
Gotoxy( 8,6); For Count:=1 to 65 do Write ('-');
{Display original User number}
Gotoxy(30,6); Writeln (' Current User is ',CurrentUser:2,' ');
End;
BEGIN{Actual program starts here}
{Clear the screen}
Clrscr;
{Set-up an area in memory for incoming disc data}
InitialiseDMA;
{Set-up an area in memory for disc search information}
InitialiseFCB;
{Display on screen what the program is about}
DisplayHeading;
{Obtain current User number for later restoration}
GetCurrentUser;
{Check-out each User for files & display progress}
SearchForOccupiedUsers;
{Display each User, hilighting those found containing files}
DisplayResults;
{Re-establish original User number}
RestoreCurrentUser;
{Display original User number for Operators benefit}
DisplayCurrentUser;
END.
User number}
Bdos(SetUser,CurrentUser);
End;
Procedure DisplayCurrentUser;
{***************