home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / CMDS / mtools_3.6.src.lzh / MTOOLS_3.6 / SCRIPTS / mcheck < prev    next >
Text File  |  1997-11-12  |  951b  |  46 lines

  1. #!/bin/sh
  2. #
  3. # mcheck [ <DOS drive letter> ]
  4. #
  5. # Read every file on an MS-DOS formatted disk to make sure they're good.
  6. #
  7. # Requires: mdir and mread utilities from mtools in user's path.
  8. #
  9. # 1994/02/19    DCN    Created
  10. # 1994/??/??    ALK    Added case statement for results of mdir
  11. # 1994/09/24    DCN    Cleanup (5 minutes on top of the 30 seconds creating it)
  12. # 1994/12/01    DCN    Better comments, notices to stderr
  13. #
  14. # Copyright (C) 1994 David C. Niemi (niemidc@erols.com)
  15. # The author requires that any copies or derived works include this
  16. # copyright notice; no other restrictions are placed on its use.
  17. #
  18.  
  19. set -e
  20. set -u
  21.  
  22. DRIVE=${1:-'A:'}
  23. mdir ${DRIVE}'*'
  24. case $? in
  25. 2)
  26.     echo "No files on disk." >&2
  27.     exit 0
  28.     ;;
  29. 1)
  30.     exit 1
  31.     ;;
  32. 0)
  33.     ;;
  34. esac
  35.  
  36. echo >&2; echo "Verifying files on drive ${DRIVE}..." >&2
  37. if mtype ${DRIVE}\* > /dev/null; then
  38.     echo "Disk in drive ${DRIVE} is OK." >&2
  39.     exit 0
  40. else
  41.     echo "Disk in drive ${DRIVE} has errors." >&2
  42.     exit 1
  43. fi
  44.  
  45. ## NOTREACHED ##
  46.