tversion.pp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. { %INTERACTIVE }
  2. {******************************************}
  3. { Used to check the DOS unit }
  4. {------------------------------------------}
  5. { DosVersion routine testing }
  6. {******************************************}
  7. program tversion;
  8. uses dos;
  9. { verifies that the DOSError variable is equal to }
  10. { the value requested. }
  11. Procedure CheckDosError(err: Integer);
  12. var
  13. x : integer;
  14. s :string;
  15. Begin
  16. Write('Verifying value of DOS Error...');
  17. x := DosError;
  18. case x of
  19. 0 : s := '(0): No Error.';
  20. 2 : s := '(2): File not found.';
  21. 3 : s := '(3): Path not found.';
  22. 5 : s := '(5): Access Denied.';
  23. 6 : s := '(6): Invalid File Handle.';
  24. 8 : s := '(8): Not enough memory.';
  25. 10 : s := '(10) : Invalid Environment.';
  26. 11 : s := '(11) : Invalid format.';
  27. 18 : s := '(18) : No more files.';
  28. else
  29. s := 'INVALID DOSERROR';
  30. end;
  31. if err <> x then
  32. Begin
  33. WriteLn('FAILURE. (Value should be ',err,' '+s+')');
  34. end
  35. else
  36. WriteLn('Success.');
  37. end;
  38. Procedure TestDosVersion;
  39. Begin
  40. WriteLn('----------------------------------------------------------------------');
  41. WriteLn(' DOSVERSION ');
  42. WriteLn('----------------------------------------------------------------------');
  43. WriteLn(' Note: Number should be major version followed by minor version. ');
  44. WriteLn('----------------------------------------------------------------------');
  45. CheckDosError(0);
  46. {*------------------------- NOTE -------------------------------------*}
  47. {* This is OS specific. LO -> Major revision, HI -> Minor Revision *}
  48. {*--------------------------------------------------------------------*}
  49. WriteLn('Operating system Version : ',Lo(DosVersion),'.',Hi(DosVersion));
  50. CheckDosError(0);
  51. end;
  52. Begin
  53. TestDosVersion;
  54. end.