Article Listing 1 Listing 2 Listing 3 apr2005.tar

Listing 2 dd_to_floppy -- mount the drive and copy to a floppy

#!/bin/ksh
# dd_to_floppy

function eject_floppy
{
   for device in $(ls /dev/rdiskette*)
   do
      volrmmount -e $device
   done
   eject floppy 2>&- >&-
}

function insert_floppy
{
   for device in $(ls /dev/rdiskette*)
   do
      volrmmount -i $device
   done
}

if [[ -z $1 ]]
then
   echo "Missing file name!" >&2
else
   file=$1
   if [[ -f $file ]]
   then
      eject_floppy
      insert_floppy
      volcheck
      PS3="Select block file:"
      select block_file in $(ls /vol/dev/diskette0)
      do
         case $block_file in 
         *)
            echo block_file: $block_file
            dd if=$file of=/vol/dev/diskette0/$block_file
            eject_floppy
            exit
            ;;
         esac
      done
      print "Block file not found!"
      eject_floppy
   else
      print "File $file not found!"
   fi
fi