#!/bin/bash

# Conmen for Linux, Console menu scripts. (cmfloppy).
# Copyright (C) 1999  Maxim Heijndijk

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

# Email: cchq@wanadoo.nl"

# Set variables
MNAME=cmfloppy
RCFILE=$HOME/.conmen/${MNAME}rc

# Read common functions
. /usr/lib/conmen/cmfunk

# Read script-specific functions
for FILE in /usr/lib/conmen/$MNAME/*[!~] ; do
    . $FILE
done

# Read configuration files
. $GLOBALRC
. $USERRC

# Warn if the Xdialog wrapper is not installed.
if_no_wrapper

# Read and execute selected function in /usr/lib/conmen/$MNAME
function menuchoices1 {
    unset RESULT
    RESULT=`grep -l "${choice}1=$choice" /usr/lib/conmen/$MNAME/*[!~]`
    `basename $RESULT`
    floppy
}

# Main function
function floppy {
    MENU="FLOPPY MENU"
    MENUCHOICES=menuchoices1
    menubox $A1 "${A2[@]}" \
	    $B1 "${B2[@]}" \
	    $C1 "${C2[@]}" \
	    $D1 "${D2[@]}" \
	    $E1 "${E2[@]}" \
	    $F1 "${F2[@]}" \
	    $G1 "${G2[@]}" \
	    $H1 "${H2[@]}" \
	    $I1 "${I2[@]}" \
	    $J1 "${J2[@]}" \
	    $K1 "${K2[@]}" \
	    $L1 "${L2[@]}" \
	    $M1 "${M2[@]}" \
	    $N1 "${N2[@]}" \
	    $O1 "${O2[@]}" \
	    $P1 "${P2[@]}"
}

# This script only
if [ "$USER" != "root" ]; then
    unset M1
    unset M2
fi

# Execute main function
floppy

exit 0
