home *** CD-ROM | disk | FTP | other *** search
- program VOLTEST;
- uses
- CRT,DOS,VOL;
-
- (* Type VolumeName declared in VOL as String[11] *)
- (* Type Drive declared in VOL as Byte *)
-
- var
- sel : Byte;
-
- procedure PressKey;
- var
- ch : Char;
- Begin
- Write ('Press any key ...');
- ch:= ReadKey;
- If ch = #0 Then ch:= ReadKey;
- Writeln
- End;
-
- function GetKey (max : Byte) : Byte;
- var
- ch : Char;
- Begin
- Repeat
- ch:= UpCase (ReadKey);
- If ch = #27 Then
- Begin
- GetKey:= 0;
- Exit
- End
- Until (ch >= 'A') OR (ch <= Chr (max+64));
- Write (ch);
- GetKey:= Ord (ch) - 64
- End;
-
- procedure Get_Choice (var sel:byte);
- begin
- Writeln ('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
- Writeln (' A. Add Volume Name');
- Writeln (' B. Change Volume Name');
- Writeln (' C. Delete Volume Name');
- Writeln (' D. Get Volume Name');
- Writeln (' E. (or Esc) = QUIT');
- Writeln;
- Writeln ('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
- Writeln;
- Write ('Press the Proper Letter => ');
- sel:= GetKey (5)
- end;
-
- (*********************************************************************)
- (*********************************************************************)
-
- procedure AV (dr:Drive);
- var
- so,
- st : VolumeName;
- Begin
- Write ('New Volume Label (11 Characters Max) => ');
- Readln (st);
- If Length (st) = 0 Then Exit;
- Writeln;
- If ADDVOL (dr,st) Then
- Writeln ('New Volume Label Added.')
- Else
- Writeln ('ERROR in Adding New Volume Label.');
- Writeln;
- PressKey
- End;
-
- procedure CV (dr:Drive);
- var
- so,
- st : VolumeName;
- Begin
- Writeln;
- so:= GetVol (dr);
- If Length (so) = 0 Then
- Begin
- Writeln ('ERROR in Reading Volume Label or no Volume Label found.');
- Writeln;
- PressKey
- End
- else
- begin
- writeln ('Old Volume Label is ',so);
- write ('New Volume Label (11 Characters Max) => ');
- readln (st);
- if Length (st) > 0 Then
- begin
- writeln;
- if ChgVol (dr,st) Then
- Writeln ('Volume Label Changed.')
- else
- Writeln ('ERROR in Changing Volume Label.');
- writeln;
- pressKey
- end
- end
- end;
-
- procedure DV (dr:Drive);
- Begin
- If DELVOL (dr) Then
- Writeln ('Volume Label Deleted.')
- Else
- Writeln ('ERROR in Deleting Volume Label.');
- Writeln;
- PressKey
- End;
-
- procedure GV (dr:Drive);
- var
- st : VolumeName;
- Begin
- st:= GetVol (dr);
- If Length (st) > 0 Then
- Writeln ('Current Label is ',st)
- Else
- Writeln ('ERROR in Reading Volume Label or no Volume Label found.');
- Writeln;
- PressKey
- End;
-
- (*********************************************************************)
- (* MAIN PROGRAM *)
- (*********************************************************************)
- var dr:Drive;
- Begin
- Repeat
- ClrScr;
- Get_Choice (sel);
- if sel in [1..4] then
- begin
- Writeln;
- Writeln;
- Write ('Drive Letter ( or Esc ) => ');
- dr:= GetKey (26);
- If dr > 0 Then
- begin
- Writeln (':');
- Case sel of
- 1 : AV (dr);
- 2 : CV (dr);
- 3 : DV (dr);
- 4 : GV (dr)
- End
- end
- end
- Until (sel = 5) OR (sel = 0)
- End.