CODE
#/bin/sh
### Standard Functions
htm_out(){
###############################################
### Output to galeon web browser
###############################################
# $description5 Reserved for error codes
###############################################
echo '<html><center><h3>'$tite'</h3></center>' > 6_out.htm
echo '<br><br>'$description1'' >> 6_out.htm
echo '<br><br>'$description2'' >> 6_out.htm
echo '<br><br>'$description3'' >> 6_out.htm
echo '<br><br>'$description4'' >> 6_out.htm
echo '<br><br>'$description5'' >> 6_out.htm
galeon -x 6_out.htm
}
get_key(){
###############################################
### Get single key input And pass to $key_input
###############################################
tput smso
tput rmso
oldstty=`stty -g`
stty -icanon -echo min 1 time 0
key_input=`dd bs=1 count=1 2>/dev/null`
stty "$oldstty"
# echo
}
key_input_1_4_0(){
###############################################
### Get Multiple Choice Input
###############################################
# Required header get_key() htm_out()
# Required variables $test1 $test2 $test3 $test4 $test5
# Passes to $key_input
#
# description1='Example of 1 through 4 or 0'
# htm_out
# test1='1'
# test1='2'
# test1='3'
# test1='4'
# test1='0'
# key_input_1_4_0
# description1=$key_input
# htm_out
#
# description1='Example of 1 through 5'
# htm_out
# test1='1'
# test1='2'
# test1='3'
# test1='4'
# test1='5'
# key_input_1_4_0
# description3=$key_input
# htm_out
#
# description1='Example of 1 through 3'
# htm_out
# test1='1'
# test1='2'
# test1='3'
# test1='3'
# test1='3'
# key_input_1_4_0
# description3=$key_input
# htm_out
###############################################
description5=''
key_input='xxx'
testx='n'
testy='y'
testz='xxx'
get_key
while [ $testx != $testy ]; do
if [ $key_input -eq $test1 ]; then
description5=''
testx='y'
fi
if [ $key_input -eq $test2 ]; then
description5=''
testx='y'
fi
if [ $key_input -eq $test3 ]; then
description5=''
testx='y'
fi
if [ $key_input -eq $test4 ]; then
description5=''
testx='y'
fi
if [ $key_input -eq $test5 ]; then
description5=''
testx='y'
fi
if [ $testx != $testy ]; then
description5='That is not a valid input. Try again.'
htm_out
get_key
fi
done
description5=''
}
key_input_y_n_0(){
###############################################
### Get Multiple Choice Input Y N or 0
###############################################
# Required header get_key() htm_out()
# Passes to $key_input
# Converts Y to 1
# Converts N to 4
# Condition 0 Remains 0
###############################################
description5=''
key_input='xxx'
test3='0'
testx='n'
testy='y'
testz='xxx'
get_key
while [ $testx != $testy ]; do
if [ $key_input = 'y' ]; then
key_input='1'
description5=''
testx='y'
fi
if [ $key_input = 'n' ]; then
key_input='4'
description5=''
testx='y'
fi
if [ $key_input -eq $test3 ]; then
description5=''
testx='y'
fi
if [ $testx != $testy ]; then
description5='That is not a valid input. Try again.'
htm_out
get_key
fi
done
description5=''
}
key_input_y_n(){
###############################################
### Get Input Y or N
###############################################
# Required header get_key() htm_out()
# Passes to $key_input
# Condition y Remains y
# Condition n Remains n
###############################################
description5=''
key_input='xxx'
testx='n'
testy='y'
testz='xxx'
get_key
while [ $testx != $testy ]; do
if [ $key_input = 'y' ]; then
description5=''
testx='y'
fi
if [ $key_input = 'n' ]; then
description5=''
testx='y'
fi
if [ $testx != $testy ]; then
description5='That is not a valid input. Try again.'
htm_out
get_key
fi
done
description5=''
}
### Standard Functions
htm_out(){
###############################################
### Output to galeon web browser
###############################################
# $description5 Reserved for error codes
###############################################
echo '<html><center><h3>'$tite'</h3></center>' > 6_out.htm
echo '<br><br>'$description1'' >> 6_out.htm
echo '<br><br>'$description2'' >> 6_out.htm
echo '<br><br>'$description3'' >> 6_out.htm
echo '<br><br>'$description4'' >> 6_out.htm
echo '<br><br>'$description5'' >> 6_out.htm
galeon -x 6_out.htm
}
get_key(){
###############################################
### Get single key input And pass to $key_input
###############################################
tput smso
tput rmso
oldstty=`stty -g`
stty -icanon -echo min 1 time 0
key_input=`dd bs=1 count=1 2>/dev/null`
stty "$oldstty"
# echo
}
key_input_1_4_0(){
###############################################
### Get Multiple Choice Input
###############################################
# Required header get_key() htm_out()
# Required variables $test1 $test2 $test3 $test4 $test5
# Passes to $key_input
#
# description1='Example of 1 through 4 or 0'
# htm_out
# test1='1'
# test1='2'
# test1='3'
# test1='4'
# test1='0'
# key_input_1_4_0
# description1=$key_input
# htm_out
#
# description1='Example of 1 through 5'
# htm_out
# test1='1'
# test1='2'
# test1='3'
# test1='4'
# test1='5'
# key_input_1_4_0
# description3=$key_input
# htm_out
#
# description1='Example of 1 through 3'
# htm_out
# test1='1'
# test1='2'
# test1='3'
# test1='3'
# test1='3'
# key_input_1_4_0
# description3=$key_input
# htm_out
###############################################
description5=''
key_input='xxx'
testx='n'
testy='y'
testz='xxx'
get_key
while [ $testx != $testy ]; do
if [ $key_input -eq $test1 ]; then
description5=''
testx='y'
fi
if [ $key_input -eq $test2 ]; then
description5=''
testx='y'
fi
if [ $key_input -eq $test3 ]; then
description5=''
testx='y'
fi
if [ $key_input -eq $test4 ]; then
description5=''
testx='y'
fi
if [ $key_input -eq $test5 ]; then
description5=''
testx='y'
fi
if [ $testx != $testy ]; then
description5='That is not a valid input. Try again.'
htm_out
get_key
fi
done
description5=''
}
key_input_y_n_0(){
###############################################
### Get Multiple Choice Input Y N or 0
###############################################
# Required header get_key() htm_out()
# Passes to $key_input
# Converts Y to 1
# Converts N to 4
# Condition 0 Remains 0
###############################################
description5=''
key_input='xxx'
test3='0'
testx='n'
testy='y'
testz='xxx'
get_key
while [ $testx != $testy ]; do
if [ $key_input = 'y' ]; then
key_input='1'
description5=''
testx='y'
fi
if [ $key_input = 'n' ]; then
key_input='4'
description5=''
testx='y'
fi
if [ $key_input -eq $test3 ]; then
description5=''
testx='y'
fi
if [ $testx != $testy ]; then
description5='That is not a valid input. Try again.'
htm_out
get_key
fi
done
description5=''
}
key_input_y_n(){
###############################################
### Get Input Y or N
###############################################
# Required header get_key() htm_out()
# Passes to $key_input
# Condition y Remains y
# Condition n Remains n
###############################################
description5=''
key_input='xxx'
testx='n'
testy='y'
testz='xxx'
get_key
while [ $testx != $testy ]; do
if [ $key_input = 'y' ]; then
description5=''
testx='y'
fi
if [ $key_input = 'n' ]; then
description5=''
testx='y'
fi
if [ $testx != $testy ]; then
description5='That is not a valid input. Try again.'
htm_out
get_key
fi
done
description5=''
}