#! ../wafe --f
#! /bin/sh
# Flip the first two lines above to search for wafe on the searchpath \
 exec wafe --f $0 ${1+"$@"} 
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# script to mount floppy drive under Linux
#
# put the following line into youer /etc/fstab
# /dev/fd0H1440    /a      msdos       noauto,user   0   0
# 
set mountA /a

mergeResources topLevel \
  *background gainsboro \
  *Command.sensitive false \
  *font "-b&h-lucida-bold-r-*-*-12-*-*-*-p-*-iso8859-*"

Form f topLevel
  Command mount f \
     label "Mount $mountA" \
     callback {execute "/bin/mount $mountA" mount unmount} 
  Command unmount f \
     label "UnMount $mountA" \
     callback {execute "/bin/umount $mountA" unmount mount} \
     fromVert mount

realize

if [string match "*on $mountA *" [exec /bin/mount]] {
  sV unmount sensitive true} else {
  sV mount sensitive true}

proc execute {cmd this other} {
  if [catch "exec $cmd"] { bell topLevel 1 } else {
    sV $this sensitive false; sV $other sensitive true } 
}

action f override "<Key>q: exec(quit)"
