Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for filesys.rex

(view source code of filesys.rex as plain text)

  1. /* FileSys, Version 2.00 for OS/2 and Windows */
  2. /* Written by Rob van der Woude               */
  3. /* http://www.robvanderwoude.com              */
  4.  
  5.  
  6. /* Parameter check */
  7. Parse Upper Arg drive dummy
  8. If dummy <> "" Then Call Syntax
  9. If drive = "" Then Do
  10. 	drive = FileSpec( "D", Directory( ) )
  11. End
  12. Else Do
  13. 	If Pos( "?", drive )  >   0 Then Call Syntax
  14. 	If Length( drive )    =   1 Then drive = drive||":"
  15. 	If Length( drive )    >   2 Then Call Syntax
  16. 	If right( drive, 1 ) <> ":" Then Call Syntax
  17. 	If left( drive, 1 )   < "A" Then Call Syntax
  18. 	If left( drive, 1 )   > "Z" Then Call Syntax
  19. End
  20.  
  21. /* What OS? */
  22. Parse Source os .
  23.  
  24. /* OS specific code */
  25. If os = "OS/2" Then Do
  26. 	/* Initialize RexxLib */
  27. 	Call RxFuncAdd "RexxLibRegister", "RexxLib", "RexxLibRegister"
  28. 	Call RexxLibRegister
  29. 	/* Check if specified drive is ready, and get FS type if ready */
  30. 	If DOSDISK( "T", drive ) = -1 Then filesys = "notready"; Else filesys = DOSFILESYS( drive )
  31. End
  32. Else Do
  33. 	/* Initialize RexxUtil */
  34. 	Call RxFuncAdd "sysloadfuncs", "RexxUtil", "sysloadfuncs"
  35. 	Call sysloadfuncs
  36. 	/* Get file system type */
  37. 	filesys = SysFileSystemType( drive )
  38. 	If filesys = ""    Then filesys = "notready"
  39. 	If filesys = "UFS" Then filesys = "unknown"
  40. End
  41.  
  42. /* Display the result */
  43. Say
  44. If filesys = "notready" Then Do
  45. 	Say "Drive "||drive||" is not ready"
  46. End
  47. Else Do
  48. 	Say "File system of drive "||drive||" is "||filesys
  49. End
  50.  
  51. /* End main program */
  52. Exit 0
  53.  
  54.  
  55. Syntax: Procedure
  56. 	Say
  57. 	Say "FileSys, Version 2.00 for OS/2 and Windows"
  58. 	Say "Show the file system type for the specified drive"
  59. 	Say
  60. 	Say "Usage:  FILESYS.REX  [ drive ]"
  61. 	Say
  62. 	Say "If no drive is specified, the current drive is assumed."
  63. 	Say 'Empty CDROM drives will return "not ready".'
  64. 	If os = "OS/2" Then Say "OS/2 version needs Quercus Systems' REXXLIB"
  65. 	Say
  66. 	Say "Written by Rob van der Woude"
  67. 	Say "http://www.robvanderwoude.com"
  68. 	Exit 1
  69. Return
  70.  

page last modified: 2024-02-26; loaded in 0.0241 seconds