home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / newc_dev / dinfo120.lha / DiskInfo1.20.TXT < prev    next >
Text File  |  1992-10-04  |  26KB  |  795 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.                                  DiskInfo
  12.  
  13.  
  14.  
  15.                                Version 1.20
  16.                               03 October 1992
  17.  
  18.  
  19.                           Written by Gregg Giles
  20.  
  21.                         Security Leak Publications
  22.                           3330 Kinsrow Avenue 217
  23.                         Eugene, OR 97401-8824, USA
  24.  
  25.                      Internet: ggiles@cie.uoregon.edu
  26.                                 BIX: ggiles
  27.                            AmigaX: 503/342-2144
  28.  
  29.           Thanks to Andy Finkel and Michael Sinz for their help.
  30.  
  31.   This program is public domain. Spread it at will - populate the world!
  32.     Donations and contributions will be accepted, but are not demanded.
  33.                 Suggestions and ideas are always welcomed.
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67. PURPOSE
  68.  
  69. DiskInfo is a tool which can be used to display information about any Amiga
  70. storage media, including disks, hard disks and memory.  It  is  capable  of
  71. creating global environmental variables which can be used by  any  AmigaDOS
  72. or ARexx script. It can be executed as an AmigaDOS command from either  the
  73. Workbench or the Shell.
  74.  
  75. The goal of this program is to  evolve  into  worthy  replacement  for  the
  76. Workbench "c:Info" command.
  77.  
  78.  
  79.  
  80.  
  81.  
  82. FEATURES
  83.  
  84. The following are the main features of this program:
  85.  
  86.    - Displays device capacity, usage, and available space in bytes and
  87.      blocks (also shows bytes per block)
  88.  
  89.    - Creates global environmental variables usable by ARexx and AmigaDOS
  90.  
  91.    - Recognizes and displays the following Amiga file systems:
  92.      DOS0: Standard ("Old") File System (OFS)
  93.      DOS1: Fast File System (FFS)
  94.      DOS2: Standard File System, International mode (OFS)
  95.      DOS3: Fast File System, International mode (FFS)
  96.      DOS4: Directory Caching Standard File System, International
  97.            mode (DC-OFS)
  98.      DOS5: Directory Caching Fast File System, International
  99.            mode (DC-FFS)
  100.  
  101.    - Shows current device status (validated, validating, read only)
  102.  
  103.    - Workbench 2.04, 2.1, and 3.0 compatible
  104.  
  105.    - Standard command line parsing conforming to "Amiga User Interface
  106.      Style Guide"
  107.  
  108.    - Enforcer "Hit Free"
  109.  
  110.  
  111.  
  112.  
  113.  
  114. REQUIREMENTS
  115.  
  116. For this program to operate properly, you must have the following:
  117.  
  118.    - An Amiga (any model)
  119.  
  120.    - Workbench 2.04, Workbench 2.1, or Workbench 3.0
  121.  
  122.    - A working knowledge of the Workbench or Shell environments
  123.  
  124.    - The DiskInfo program
  125.  
  126.  
  127.  
  128.  
  129.  
  130. USAGE
  131.  
  132. This program may be executed  from  the  Workbench  using  the  "Workbench/
  133. Execute Command..." option, or from the  Shell.  Usage  is  the  same  from
  134. either environment:
  135.  
  136.    DiskInfo <device> [SETENV [BytesPerBlock][DiskName][DiskStatus]
  137.             [DiskType][Errors][FreeBlocks][FreeBytes][InUnit][InUse]
  138.             [PercentFull][SizeBlocks][SizeBytes][UsedBlocks]
  139.             [UsedBytes][All]] [QUIET]
  140.  
  141.  
  142. The "<device>", of course, is the name of any storage device or volume. The
  143. other arguments shown below are explained  later  in  this  manual.  If  no
  144. device is specified or if any argument is improperly  used,  the  following
  145. will be displayed:
  146.  
  147. DiskInfo (Version 1.20) by Gregg Giles
  148. Purpose: Gives a complete status report on any mounted AmigaDOS device.
  149. Usage  : DiskInfo <device> [SETENV [BytesPerBlock][DiskName][DiskStatus]
  150.          [DiskType][Errors][FreeBlocks][FreeBytes][InUnit][InUse]
  151.          [PercentFull][SizeBlocks][SizeBytes][UsedBlocks][UsedBytes][All]]
  152.          [QUIET]
  153.  
  154.  
  155.  
  156.  
  157.  
  158. USAGE EXAMPLES
  159.  
  160. These examples assume  that  you  have  booted  from  your  Workbench  2.04
  161. distribution disk, and your Extras disk is in DF1:. Issue this command:
  162.  
  163.    1> DiskInfo DF0:
  164.  
  165. Most information of interest to the average user  will  be  displayed,  and
  166. will appear like this (or similar to it):
  167.  
  168. Name  : Workbench2.0:        Errors : 0                    Bytes   Blocks
  169. Status: Write Protected      Full   : 94.20 %    Size:    857904     1758
  170. Type  : Amiga OFS (DOS0)     In Unit: 0          Used:    808128     1656
  171. Block : 488 bytes            In Use : Yes        Free:     49776      102
  172.  
  173. Issuing the following command will show what resides on the Extras disk:
  174.  
  175.    1> DiskInfo DF1:
  176.  
  177. Something similar to the following will appear:
  178.  
  179. Name  : Extras2.0:           Errors : 0                    Bytes   Blocks
  180. Status: Write Protected      Full   : 84.64 %    Size:    857904     1758
  181. Type  : Amiga OFS (DOS0)     In Unit: 0          Used:    726144     1488
  182. Block : 488 bytes            In Use : Yes        Free:    131760      270
  183.  
  184. This, of course, is assuming that no errors occur. Further  explanation  of
  185. each field can be found in the section "Explanation Of Fields".
  186.  
  187. Logical devices created using the "Assign" command may be used in place  of
  188. a physical storage device (ie: "c:", "libs:", "devs:",  etc.)  However,  in
  189. such cases, information about the physical  media  on  which  that  logical
  190. device resides will be displayed.
  191.  
  192. For example, assuming you booted  from  your  Workbench  2.04  distribution
  193. disk, use this command and view the ensuing results (notice that the "name"
  194. field gives the complete path to the logical device specified):
  195.  
  196.    1> DiskInfo C:
  197.  
  198. Name  : Workbench2.0:C       Errors : 0                    Bytes   Blocks
  199. Status: Write Protected      Full   : 94.20 %    Size:    857904     1758
  200. Type  : Amiga OFS (DOS0)     In Unit: 0          Used:    808128     1656
  201. Block : 488 bytes            In Use : Yes        Free:     49776      102
  202.  
  203. In order to quiet all output to the console, use the QUIET flag. Only error
  204. messages and  usages  templates  are  not  suppressed  by  this  flag.  The
  205. following example has the result of accomplishing nothing (even redirection
  206. of output would be pointless here):
  207.  
  208.    1> DiskInfo WORK: QUIET
  209.  
  210. To create environmental variables,  the  argument  SETENV  must  always  be
  211. supplied. The following example will create variables for the disk's  name,
  212. the disk's type, the number of blocks used, the number of bytes  free,  and
  213. the number of errors on the disk:
  214.  
  215.    1> DiskInfo WORK: SETENV DiskName DiskType UsedBlocks FreeBytes Errors
  216.  
  217. Global environmental variables of the  same  names  will  then  be  created
  218. automatically in the "ENV:DiskInfo" directory. If  there  are  any  errors,
  219. then you will be notified.
  220.  
  221. In order to create all possible environmental variables, use the  following
  222. command. This time, we wish to make sure there is no output to the  console
  223. (ie: the screen), so we'll use the QUIET flag:
  224.  
  225.    1> DiskInfo SYSTEM: SETENV ALL QUIET
  226.  
  227. Other examples of using DiskInfo include:
  228.  
  229.             Command              Shows information about...
  230.  
  231.             DiskInfo DF0:        Disk in unit 0 (DF0:)
  232.             DiskInfo DF1:        Disk in unit 1 (DF1:)
  233.             DiskInfo DF2:        Disk in unit 2 (DF2:)
  234.             DiskInfo DH0:        Hard disk partition DH0:
  235.             DiskInfo DH1:        Hard disk partition DH1:
  236.             DiskInfo RAM:        The RAM: disk
  237.             DiskInfo RAD:        The RAD: disk
  238.             DiskInfo Extras2.0:  A volume named "Extras2.0"
  239.             DiskInfo Pictures1:  A volume name "Pictures1"
  240.  
  241.  
  242.  
  243.  
  244.  
  245. EXPLANATION OF FIELDS AND GLOBAL ENVIRONMENTAL VARIABLES
  246.  
  247. The program displays rougly a dozen fields when  executed  (assuming  there
  248. are no errors). "Field" refers to the name of  the  field  shown  when  the
  249. program is executed normally. "Variable" shows the  complete  path  of  the
  250. global environmental variable created when "Argument" is  supplied  by  the
  251. user as part of the command line. (For more information on  how  to  create
  252. and make use of global environmental variables,  see  the  sections  "Usage
  253. Examples", "Using Global Environmental  Variables  (AmigaDOS  and  ARexx)",
  254. "Appendix 1: Using DiskInfo With An ARexx script", and "Appendix  2:  Using
  255. DiskInfo With An AmigaDOS Script" in this manual.)
  256.  
  257. All possible fields and their  corresponding  environmental  variables  are
  258. described as follows.
  259.  
  260. Field   : NAME
  261. Argument: DiskName
  262. Variable: ENV:DiskInfo/DiskName
  263. Purpose : Name of the disk (or volume) being examined.
  264. Output  : A valid Amiga disk name. If a logical device name is given, a
  265.           full path name will be displayed.
  266.  
  267.  
  268. Field   : STATUS
  269. Argument: DiskStatus
  270. Variable: ENV:DiskInfo/DiskStatus
  271. Purpose : Physical status of the disk.
  272. Output  : Possible results include:
  273.  
  274.    "Write Protected":
  275.       Disk is write protected and can only be read from, not written to.
  276.       This also means that files on the disk can not be edited or deleted.
  277.    "Validating":
  278.       The disk's structure has been corrupted, and AmigaDOS is attempting
  279.       to correct the problem.
  280.    "Validated":
  281.       The disk's structure is stable, and thus can be written to or read
  282.       from. Files can be edited and deleted.
  283.    "Unknown":
  284.       The disk's status cannot be determined.
  285.  
  286.  
  287. Field   : TYPE
  288. Argument: DiskType
  289. Variable: ENV:DiskInfo/DiskType
  290. Purpose : Type of disk.
  291. Output  : Possible results include:
  292.  
  293.    "Amiga OFS (DOS0)":
  294.       The Standard File System format which appeared on the original
  295.       Amiga 1000 and which is still in use. Also known as the "Old File
  296.       System" (OFS). All disks formatted using the "Format" command under
  297.       Workbench 1.0-2.04 were, by default, OFS format disks. OFS uses 488
  298.       bytes per block, and is rather slow.
  299.    "Amiga FFS (DOS1)":
  300.       The Fast File System (FFS) format introduced in Workbench 1.3 (for
  301.       hard disk users only). Workbench 2.04 introduced the capability to
  302.       format disks using FFS. The main goal of FFS was to speed up seek
  303.       times. Workbench 2.04-3.0 are capable of formatting FFS disks. FFS
  304.       uses 512 bytes per block, and is faster than FFS.
  305.    "Amiga OFS (DOS2)":
  306.       The "International" version of the Standard File System (OFS). This
  307.       version of the filesystem resolves bugs present in the original OFS
  308.       (DOS0). Has the same features of OFS (DOS0). Introduced in Workbench
  309.       2.1, and present in Workbench 3.0.
  310.    "Amiga FFS (DOS3)":
  311.       The "International" version of the Fast File System (FFS). This
  312.       version of the filesystem resolves bugs present in the original FFS
  313.       (DOS1). Has the same features of FFS (DOS1). Introduced in Workbench
  314.       2.1, and present in Workbench 3.0.
  315.    "Amiga DC-OFS (DOS4)":
  316.       The Disk Caching version of the Standard File System (OFS)
  317.       introduced in Workbench 3.0. The main goal of DC-OFS is to speed up
  318.       3.5" disk access times. Uses 488 bytes per block.
  319.    "Amiga DC-FFS (DOS5):"
  320.       The Disk Caching version of the Fast File System (FFS) introduced in
  321.       Workbench 3.0. The main goal of DC-FFS is to speed up 3.5" disk
  322.       access times. Uses 512 bytes per block.
  323.    "Unknown (????)":
  324.       The format of the disk cannot be determined. Possibly a disk format
  325.       not known about at the time of the creation of this program.
  326.  
  327. Note: Subsequent versions of this program may  be  able  to  recognize  the
  328. following disk types: BAD  (unreadable/corrupted),  KICK  (Amiga  Kickstart
  329. disk), NDOS (format of the disk is good, but it  does  not  use  any  known
  330. AmigaDOS format; possibly a proprietary file format  such  as  those  often
  331. used as copy protection for games).
  332.  
  333.  
  334.  
  335. Field   : BLOCK
  336. Argument: BytesPerBlock
  337. Variable: ENV:DiskInfo/BytesPerBlock
  338. Purpose : The number of bytes that compose one block on the disk.
  339. Output  : A positive numeric value.
  340.  
  341.  
  342. Field   : ERRORS
  343. Argument: Errors
  344. Variable: ENV:DiskInfo/Errors
  345. Purpose : Number of read/write errors on the disk.
  346. Output  : A positive numeric value.
  347.  
  348.  
  349. Field   : FULL
  350. Argument: PercentFull
  351. Variable: ENV:DiskInfo/PercentFull
  352. Purpose : Percentage of the disk which is full.
  353. Output  : A positive numeric percentage (accurate to the hundredth of a
  354.           percent).
  355.  
  356.  
  357. Field   : IN UNIT
  358. Argument: InUnit
  359. Variable: ENV:DiskInfo/InUnit
  360. Purpose : AmigaDOS unit number in which the disk resides.
  361. Output  : Possible results include:
  362.  
  363.    -1: The RAM: device
  364.    0 : Floppy disk DF0:
  365.    1 : Floppy disk DF1:
  366.    2 : Floppy disk DF2:
  367.    x : Any unknown unit number, where (x) is the number of that unit.
  368.        (Note: Some hard disk partitions may appear as unit 0.)
  369.  
  370.  
  371. Field   : IN USE
  372. Argument: InUse
  373. Variable: ENV:DiskInfo/InUse
  374. Purpose : Message telling if the disk is currently in use.
  375. Output  : Possible results include:
  376.  
  377.    "Yes": The disk is in use.
  378.    "No" : The disk is not in use.
  379.  
  380.  
  381. Field   : SIZE (BYTES)
  382. Argument: SizeBytes
  383. Variable: ENV:DiskInfo/SizeBytes
  384. Purpose : Total byte storage capacity of the disk.
  385. Output  : A positive numeric value. Note that this is the total actual
  386.           storage possible. The Amiga file system will reduce the total
  387.           available free storage space.
  388.  
  389.  
  390. Field   : SIZE (BLOCKS)
  391. Argument: SizeBlocks
  392. Variable: ENV:DiskInfo/SizeBlocks
  393. Purpose : Total block storage capacity of the disk.
  394. Output  : A positive numeric value.
  395.  
  396.  
  397. Field   : USED (BYTES)
  398. Argument: UsedBytes
  399. Variable: ENV:DiskInfo/UsedBytes
  400. Purpose : Number of bytes of the disk which have been used.
  401. Output  : A positive numeric value.
  402.  
  403.  
  404. Field   : USED (BLOCKS)
  405. Argument: UsedBlocks
  406. Variable: ENV:DiskInfo/UsedBlocks
  407. Purpose : Number of blocks of the disk which have been used.
  408. Output  : A positive numeric value.
  409.  
  410.  
  411. Field   : FREE (BYTES)
  412. Argument: FreeBytes
  413. Variable: ENV:DiskInfo/FreeBytes
  414. Purpose : Number of bytes of the disk which are not yet used.
  415. Output  : A positive numeric value.
  416.  
  417.  
  418. Field   : FREE (BLOCKS)
  419. Argument: FreeBlocks
  420. Variable: ENV:DiskInfo/FreeBlocks
  421. Purpose : Number of blocks of the disk which are not yet used.
  422. Output  : A positive numeric value.
  423.  
  424.  
  425.  
  426.  
  427.  
  428. USING GLOBAL ENVIRONMENTAL VARIABLES (AMIGADOS AND AREXX)
  429.  
  430. Global environmental variables  were  introduced  to  the  Amiga  operating
  431. system under Workbench 1.3, and are becoming commonly used by more and more
  432. applications. These variables are created by various applications  so  that
  433. other applications and scripts can make use of their contents. For example,
  434. the  Workbench  creates  two  environmental  variables:   "Workbench"   and
  435. "Kickstart". The environmental variable "Workbench"  contains  the  version
  436. number of the Workbench software, and the "Kickstart" version contains  the
  437. version number of the Kickstart ROM chip. (These two variables  are  useful
  438. for applications that want to quickly know what version  of  the  operating
  439. system is being run.) If you would like  to  view  the  contents  of  these
  440. variables, give the following command in a Shell:
  441.  
  442.    1> echo Workbench version: $Workbench. Kickstart version: $Kickstart.
  443.  
  444. All environmental variables  are  stored  in  the  "ENV:"  directory.  Some
  445. applications will create their own directories in  ENV:  which  will  store
  446. variables specific only to that application; DiskInfo does just  this.  The
  447. format used to view these variables is as follows  (where  "Directory_Name"
  448. is the name of the directory containing the variable,  and  "Variable_Name"
  449. is the actual name of the variable):
  450.  
  451.    echo ${ENV:[Directory_Name]/[Variable_Name]}
  452.  
  453. DiskInfo stores all of its variables in the  "ENV:DiskInfo"  directory.  If
  454. this directory doesn't  exist  when  the  user  wants  DiskInfo  to  create
  455. variables, then it will be automatically created (note: this directory  and
  456. all  variables  within  it  are  lost  when  the  machine   is   reset   or
  457. powered-down.) The following Shell commands will create some variables  and
  458. then display them:
  459.  
  460.    1> DiskInfo RAM: SETENV DISKNAME DISKTYPE USEDBYTES QUIET
  461.    1> echo ${env:diskinfo/DiskName}
  462.    1> echo ${env:diskinfo/DiskType}
  463.    1> echo ${env:diskinfo/UsedBytes}
  464.  
  465. The  first  command  will  tell  DiskInfo  to  create  three  environmental
  466. variables called DiskName, DiskType, and UsedBytes (DiskInfo argument names
  467. will always correspond to the name of the variable created;  ie:  Supplying
  468. the  argument  "DISKNAME"  creates  a  variable  called  "DiskName",  which
  469. contains the name of the disk in question.) The QUIET flag prevents  output
  470. to the Shell. (This is not necessary in order to create or read variables -
  471. it is only done here to stop output to the  console;  that  is,  to  reduce
  472. clutter on the screen.)
  473.  
  474. The second through fourth commands will display (one by one)  each  of  the
  475. three variables just created. This is the exact method that should be  used
  476. in AmigaDOS scripts to create and show DiskInfo variables.
  477.  
  478. The variables which this program creates are global in scope,  which  means
  479. that they can be accessed by any application or any Shell  running  on  the
  480. system. ("Local" environmental variables have a scope which is  limited  to
  481. the Shell from which they were created.) This means that any application or
  482. script (be it AmigaDOS or ARexx) can quickly make use  of  the  information
  483. stored in these variables with great ease.
  484.  
  485. The "Using The System Software" manual provided  with  your  Amiga  is  the
  486. definitive resource on environmental variables and how they  can  be  used.
  487. For that reason, this manual will only detail  how  to  use  the  variables
  488. created by this program.
  489.  
  490. One practical application for the  variables  created  by  DiskInfo  is  in
  491. script-based disk-catalog programs. If, for example, you created  a  script
  492. which was to catalog the names and storage capacity of all of  your  disks,
  493. you could have DiskInfo create two variables: one containing the disk name,
  494. and the other containing the disk capacity. You could then have your script
  495. read these variables and use them as you desire.  (An  example  of  how  to
  496. create and display these variables from an AmigaDOS script is  provided  in
  497. Appendix 2.)
  498.  
  499. ARexx is  in  itself  a  powerful  and  easy-to-use  interpreted  scripting
  500. language that is provided with the Amiga operating system  (Workbench  2.04
  501. and later). Using ARexx,  users  can  quite  literally  design  a  powerful
  502. disk-catalog program using  the  functions  made  available  to  them  with
  503. DiskInfo. All the user must do is create the interface using ARexx, and use
  504. the environmental variables created by DiskInfo to fill in the information.
  505. For a complete list of disk contents, this user can simply have ARexx  call
  506. the "c:Dir" command - no special programming talent is required! An example
  507. of how to create and display  these  variables  from  an  ARexx  script  is
  508. provided in Appendix 1.) For additional information on  ARexx  and  how  it
  509. works, refer to the "Using The System Software" manual provided  with  your
  510. Amiga system.
  511.  
  512. Appendix 1 provides a complete example of  using  DiskInfo's  environmental
  513. variables from an ARexx script. Appendix 2 gives an example of using  those
  514. same  variables  from  an  AmigaDOS  script.  More  examples  of   creating
  515. environmental variables can be found in the "Usage Examples" section.
  516.  
  517.  
  518.  
  519.  
  520.  
  521. PROGRAM INTEGRITY AND BUGS
  522.  
  523. It is the author's goal to keep this program as  stable,  correct,  and  as
  524. bug-free as possible. For this reason it  employs  careful  error  checking
  525. techniques, particularly when dealing with  locks  and  memory.  Everything
  526. which is opened is closed,  even  when  errors  occur.  As  an  Amiga  user
  527. himself, the author loves cleanly written programs, particularly those that
  528. don't suck up system resources when they screw up.
  529.  
  530. This program has its own built-in  error  messages,  and  all  are  largely
  531. self-explanitory. These error messages generally only appear when the  user
  532. has done something incorrectly (ie: trying to examine a  disk  in  a  drive
  533. when no disk is present).
  534.  
  535. However, should you discover any bugs in this program, please  record  them
  536. and contact me immediately so that they may  be  corrected  and  the  fixed
  537. version of the program released.
  538.  
  539.  
  540.  
  541.  
  542.  
  543. REVISIONS AND PLANNED ENHANCEMENTS
  544.  
  545. Planned Enhancements:
  546.  
  547. Enable recognition of disk formats other than  AmigaDOS,  including  MS-DOS
  548. disks (720k and 1.44MB).
  549.  
  550. Enable display  of  all  mounted  devices  simultaneously,  much  like  the
  551. AmigaDOS Info command when used with no flags.
  552.  
  553. A Workbench window interface. Due to the increasing number of features that
  554. will eventually make its way into this code, it might be necessary.
  555.  
  556. CD-ROM (ISO-9660) support.
  557.  
  558.  
  559.  
  560. Changes since the previous version: 
  561.  
  562. Recognition of new Amiga-specific file systems added: DOS2, DOS3, DOS4, and
  563. DOS5.
  564.  
  565. Added Workbench 2.04 standard command line parsing which  conforms  to  the
  566. "Amiga User Interface Style Guide". This had the effect  of  reducing  code
  567. size, system  overhead  requirements,  and  permitting  the  display  of  a
  568. standardized template when issuing "DiskInfo ?" at the command line.
  569.  
  570. Ability to create global environmental variables  added.  A  user  may  now
  571. specify any of the following command line parameters (when using the SETENV
  572. parameter),  and  a  corresponding  variable  will  be   created   in   the
  573. "ENV:DiskInfo" directory: BYTESPERBLOCK,  DISKNAME,  DISKSTATUS,  DISKTYPE,
  574. ERRORS, FREEBLOCKS,  FREEBYTES,  INUNIT,  INUSE,  PERCENTFULL,  SIZEBLOCKS,
  575. SIZEBYTES, USEDBLOCKS, and USEDBYTES. The argument ALL will  prevent  users
  576. from having to type all of the arguments in order to  create  all  possible
  577. environmental variables.
  578.  
  579. New argument: QUIET. This argument stops all output to  the  console,  with
  580. the exception of error messages, the template, and the usage message.
  581.  
  582. Compatible with Workbench 2.1 and 3.0.
  583.  
  584.  
  585.  
  586.  
  587.  
  588. APPENDIX 1: USING DISKINFO WITH AN AREXX SCRIPT
  589.  
  590. While DiskInfo itself does not have an ARexx port, it can be used by  ARexx
  591. as a normal AmigaDOS command.  The  global  environmental  variables  which
  592. DiskInfo creates can also be easily  read  and  manipulated  by  any  ARexx
  593. script. The following is an example of how an ARexx  script  can  both  run
  594. DiskInfo as well as manipulate the global environmental variables which  it
  595. can create.
  596.  
  597. This ARexx script will run DiskInfo to find information  about  a  disk  in
  598. DF0:, get the DiskName and FreeBytes variables, and then print their values
  599. to the Shell. (Requires ARexx and Workbench 2.04 or better.)
  600.  
  601.  
  602.  
  603. --- cut here (begin) ---
  604.  
  605. /* ARexx script */
  606. address command
  607. echo
  608. echo "Disk information"
  609. /* Get the name of the disk */
  610. result = open('MyFile', 'env:DiskInfo/DiskName', 'R')
  611. NameOfDisk = readln('MyFile')
  612. result = close('MyFile')
  613. /* Get the bytes free information */
  614. result = open('MyFile', 'env:DiskInfo/FreeBytes', 'R')
  615. FreeBytesOnDisk = readln('MyFile')
  616. result = close('MyFile')
  617. echo "The disk named" NameOfDisk "has" FreeBytesOnDisk "bytes free."
  618.  
  619. --- cut here (end) ---
  620.  
  621.  
  622.  
  623.  
  624.  
  625. APPENDIX 2: USING DISKINFO WITH AN AMIGADOS SCRIPT
  626.  
  627. While  AmigaDOS  scripts  are  not  quite  as  powerful  as   their   ARexx
  628. counterparts,  they  are  still  useful   in   manipulating   environmental
  629. variables. The following script will use DiskInfo to get the name of a disk
  630. and the number of bytes free on it. This information will then be put  into
  631. two environmental variables, which will then be printed to the Shell.
  632.  
  633.  
  634.  
  635. --- cut here (begin) ---
  636.  
  637. DiskInfo >nil: df0: SETENV DISKNAME FREEBYTES
  638. echo "The disk named ${ENV:DiskInfo/DiskName}"
  639. echo "has ${ENV:DiskInfo/DiskInfoName} bytes free."
  640.  
  641. --- cut here (end) ---
  642.  
  643.  
  644.  
  645. The following example is a bit more involved than  the  first,  but  it  is
  646. still based upon the same principles of the first: make DiskInfo create all
  647. of its global environmental variables, and then display them. This  script,
  648. however, does error checking. It a certain variable doesn't exist,  then  a
  649. message saying that the variable doesn't exist will be shown.
  650.  
  651.  
  652.  
  653. --- cut here (begin) ---
  654.  
  655. ; "ShowEnv" (script)
  656. ; by Gregg Giles, 01-OCT-1992
  657. ; For use with DiskInfo v1.20
  658. ;
  659. ;    This is an AmigaDOS script which shows the values of all of the
  660. ; environmental variables created by DiskInfo. Those which do not exist
  661. ; will have a message displayed saying so.
  662. ;    This script applies only to DiskInfo; it is not useful to show
  663. ; other environmental variables. Feel free to study this script in order
  664. ; to learn how to use environmental variables.
  665.  
  666.  
  667. failat 20
  668.  
  669. DiskInfo DF0: SETENV ALL QUIET
  670.  
  671. echo "BytesPerBlock  = " noline
  672. if exists env:DiskInfo/BytesPerBlock
  673.    echo ${env:DiskInfo/BytesPerBlock}
  674. else
  675.    echo "(doesn't exist)"
  676. endif
  677.  
  678. echo "DiskName       = " noline
  679. if exists env:DiskInfo/DiskName
  680.    echo ${env:DiskInfo/DiskName}
  681. else
  682.    echo "(doesn't exist)"
  683. endif
  684.  
  685. echo "DiskStatus     = " noline
  686. if exists env:DiskInfo/DiskStatus
  687.    echo ${env:DiskInfo/DiskStatus}
  688. else
  689.    echo "(doesn't exist)"
  690. endif
  691.  
  692. echo "DiskType       = " noline
  693. if exists env:DiskInfo/DiskType
  694.    echo ${env:DiskInfo/DiskType}
  695. else
  696.    echo "(doesn't exist)"
  697. endif
  698.  
  699. echo "Errors         = " noline
  700. if exists env:DiskInfo/Errors
  701.    echo ${env:DiskInfo/Errors}
  702. else
  703.    echo "(doesn't exist)"
  704. endif
  705.  
  706. echo "FreeBlocks     = " noline
  707. if exists env:DiskInfo/FreeBlocks
  708.    echo ${env:DiskInfo/FreeBlocks}
  709. else
  710.    echo "(doesn't exist)"
  711. endif
  712.  
  713. echo "FreeBytes      = " noline
  714. if exists env:DiskInfo/FreeBytes
  715.    echo ${env:DiskInfo/FreeBytes}
  716. else
  717.    echo "(doesn't exist)"
  718. endif
  719.  
  720. echo "InUnit         = " noline
  721. if exists env:DiskInfo/InUnit
  722.    echo ${env:DiskInfo/InUnit}
  723. else
  724.    echo "(doesn't exist)"
  725. endif
  726.  
  727. echo "InUse          = " noline
  728. if exists env:DiskInfo/InUse
  729.    echo ${env:DiskInfo/InUse}
  730. else
  731.    echo "(doesn't exist)"
  732. endif
  733.  
  734. echo "PercentFull    = " noline
  735. if exists env:DiskInfo/PercentFull
  736.    echo ${env:DiskInfo/PercentFull}
  737. else
  738.    echo "(doesn't exist)"
  739. endif
  740.  
  741. echo "SizeBlocks     = " noline
  742. if exists env:DiskInfo/SizeBlocks
  743.    echo ${env:DiskInfo/SizeBlocks}
  744. else
  745.    echo "(doesn't exist)"
  746. endif
  747.  
  748. echo "SizeBytes      = " noline
  749. if exists env:DiskInfo/SizeBytes
  750.    echo ${env:DiskInfo/SizeBytes}
  751. else
  752.    echo "(doesn't exist)"
  753. endif
  754.  
  755. echo "UsedBlocks     = " noline
  756. if exists env:DiskInfo/UsedBlocks
  757.    echo ${env:DiskInfo/UsedBlocks}
  758. else
  759.    echo "(doesn't exist)"
  760. endif
  761.  
  762. echo "UsedBytes      = " noline
  763. if exists env:DiskInfo/UsedBytes
  764.    echo ${env:DiskInfo/UsedBytes}
  765. else
  766.    echo "(doesn't exist)"
  767. endif
  768.  
  769. --- cut here (end) ---
  770.  
  771.  
  772.  
  773.  
  774.  
  775. APPENDIX 3: FINDING DISKINFO'S VERSION
  776.  
  777. DiskInfo's version number  can  easily  be  found  by  using  the  AmigaDOS
  778. "c:Version" command as well  as  by  using  a  question-mark  as  the  only
  779. argument in the command line.
  780.  
  781. Using the AmigaDOS Version command:
  782.  
  783.    1> VERSION DiskInfo
  784.  
  785. Using DiskInfo to find its own version:
  786.  
  787.    1> DiskInfo ?
  788.  
  789. When the argument template appears, simply press  RETURN,  and  information
  790. about the program will appear (including the version number).
  791.  
  792.  
  793.  
  794. *END OF DOCUMENT*
  795.