home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / sector.zip / sec_test.cmd next >
OS/2 REXX Batch file  |  1994-04-13  |  2KB  |  84 lines

  1. /*********************************************************************\
  2. **  SEC_TEST.CMD :                                                   **
  3. **        (C) 1994 Thomas Christinck, Braunschweig   CIS 100031,41   **
  4. ***********************************************************************
  5. **  This REXX-script is just testing the SECTOR.DLL                  **
  6. ***********************************************************************
  7. **  Without parameters a statistic of all drives is listet           **
  8. **  With the parameter drive and sectornumber, one sector is listed  **
  9. **                                                                   **
  10. \*********************************************************************/
  11. ARG drive sect
  12. SIGNAL ON HALT NAME END
  13.  
  14. if drive = "?" then call help
  15. if drive = "help" then call help
  16.  
  17. call rxfuncadd sysloadfuncs,rexxutil,sysloadfuncs
  18. call sysloadfuncs
  19.  
  20. call RxFuncAdd 'QDrive',   'sector', 'QDrive'
  21. call RxFuncAdd 'ReadSect', 'sector', 'ReadSect'
  22. call RxFuncAdd 'WritSect', 'sector', 'WritSect'
  23.  
  24. if drive = '' then signal driveinfo
  25. if sect \= '' then signal readsector
  26.  
  27. call help
  28. return
  29.  
  30. /**********************************************************************/
  31.  
  32. driveinfo:
  33. disks= sysdrivemap(,'local')
  34. say "drive sectors cylinders heads sec/track byte/sec       MB"
  35. do i= 1 to words(disks)
  36.   lw=word(disks,i)
  37.   di=QDrive(lw)
  38.   say  lw right(word(di,1),10)  right(word(di,2),9) right(word(di,3),5) right(word(di,4),9) right(word(di,5),8) format(word(di,1)*word(di,5)/1024/1024,6,1)
  39.   end
  40. return
  41.  
  42. /**********************************************************************/
  43.  
  44. readsector:
  45. sect = readsect(drive, sect)
  46.  
  47. do i=0 to 511 by 16
  48.      call charout , d2x(i,4)"  "
  49.      do j=1 to 16
  50.         call charout , c2x(substr(sect,i+j,1))" "
  51.         end
  52.      do j=1 to 16
  53.         c = substr(sect,i+j,1)
  54.         if c<" " then call charout ," "
  55.                  else call charout ,c
  56.         end
  57.      say
  58.      end
  59.  
  60. return
  61.  
  62. /********************************************************************/
  63.  
  64. End:
  65. say "^C"
  66. say " Break ...."
  67. exit
  68.  
  69. Help:
  70. parse value SysTextScreenSize() with rows cols
  71. rows=rows-2
  72. do i=1 to 99
  73.   if (i//rows) = 0 then call More
  74.   if pos("**",sourceline(i))==0 then leave
  75.   say sourceline(i)
  76.   end
  77. exit
  78.  
  79. More:
  80. say "Press any key ..."
  81. call SysGetKey("NOECHO")
  82. return
  83.  
  84.