/* sample code to test if a drive is ready */ /* note: This routine does not work under Object-Oriented REXX */ /* */ /* [Tested with OBJREXX 6.00 12 Jul 1996] */ /* [Fixed in OBJREXX 6.00 26 Feb 1997 and newer versions] */ /* */ do forever call lineOut , "Enter the name of the drive to test " , "(RETURN to end): " thisDrive = strip( lineIn() ) if thisDrive = "" then leave if DriveReady( thisDrive ) = 1 then say "The drive <" || thisDrive || "> is ready." else say "The drive <" || thisDrive || "> is not ready." end /* do forever */ exit 0 /* ------------------------------------------------------------------ */ /* function: Check if a drive is ready */ /* */ /* call: DriveReady( testDrive ) */ /* */ /* where: testdrive - Name of the drive to test (e.g. "A:") */ /* */ /* returns: 1 - drive is ready */ /* 0 - drive is not ready */ /* */ /* note: This routine does not work under Object-Oriented REXX */ /* if the line AUTOFAIL=NO is missing in the CONFIG.SYS */ /* */ /* [Tested with OBJREXX 6.00 12 Jul 1996] */ /* [Fixed in OBJREXX 6.00 26 Feb 1997 and newer versions] */ /* */ DriveReady: PROCEDURE parse arg driveToTest ":" . thisRC = 0 /* install a temporary error handler to check */ /* if the drive is ready */ SIGNAL ON NOTREADY Name DriveReadyEnd call stream driveToTest || ":\*", "D" thisRC = 1 DriveReadyEnd: RETURN thisRC