#!/bin/bash

# alarm: edits alarm.cfg

if [ -e alarm.cfg ]
then
    FILE="alarm.cfg"
elif [ -e $HOME/bin/alarm.cfg ]
then
    FILE="$HOME/bin/alarm.cfg"
elif [ -e /usr/local/bin/alarm.cfg ]
then
    FILE="/usr/local/bin/alarm.cfg"
else
    echo "alarm: there is no alarm.cfg database."
    exit
fi

for EDITOR in mcedit nano pico elvis vim vi
do
    if [ -x `which $EDITOR` ]
    then
	break
    fi
done

$EDITOR $FILE
