(view source code of bootdriv.rex as plain text)
/* Check for boot drive */
/* Techniques explained by Dick Goran in his January 1997 Rexx Column in */
/* OS/2 Magazine, found at http://www.toward.com/cfsrexx/os2-mag/9701.htm */
/* Display blank line */
Say
/* Check command line parameters (none required) */
Parse Arg params
If params <> "" Then Call Syntax
/* What OS? */
Parse Source os .
If os = "OS/2" Then Do
/* RLANUTIL.DLL, containg GetBootDrive, was added in Warp Connect */
Call RxFuncAdd "GetBootDrive", "RLANUTIL", "GetBootDrive"
If RxFuncQuery( "GetBootDrive" ) = 0 then do
bootdrive = GetBootDrive()
End
Else Do
/* This should work in any pre Warp OS/2 version too */
path = Value( "PATH", , "OS2ENVIRONMENT" )
Parse Upper Value path With ":\OS2\SYSTEM" -1 bootdrive +2
End
End
Else Do
/* Initialize RexxUtil library */
If RxFuncAdd( "sysloadfuncs", "RexxUtil", "sysloadfuncs" ) = 0 Then Do
Call sysloadfuncs
End
Else Do
Call Syntax "Error initializing RexxUtil"
End
bootdrive = SysBootDrive( )
End
Say "Boot drive = "||bootdrive
Exit 0
Syntax: Procedure
Parse Arg errmsg
If errmsg <> "" Then Say errmsg||"0D0A0D0A"X
Say "BootDriv.rex, Version 2.01 for OS/2 and Windows"
Say "Return drive letter from which computer was booted"
Say
Say "Techniques for OS/2 explained by Dick Goran in his"
Say "January 1997 Rexx Column in OS/2 Magazine, found at"
Say "http://www.toward.com/cfsrexx/os2-mag/9701.htm"
Say
Say "Usage: BOOTDRIV.REX"
Say
Say "Written by Rob van der Woude"
Say "http://www.robvanderwoude.com"
Exit 1
Return
page last modified: 2024-04-16; loaded in 0.0052 seconds