mirror of
https://github.com/A2osX/A2osX.git
synced 2024-10-31 23:09:33 +00:00
195 lines
4.1 KiB
Plaintext
195 lines
4.1 KiB
Plaintext
NEW
|
||
PREFIX
|
||
AUTO 4,1
|
||
#!/bin/sh
|
||
echo -N "."
|
||
function menu {
|
||
switch $#
|
||
case 1;set menufile = $1;set menu = "A";break
|
||
case 2;set menufile = $1;set menu = $2;break
|
||
default;echo "\nError: Invalid use of this function";exit
|
||
end
|
||
if [ -f $menufile ];set menufile = $1
|
||
else;echo "\nError: [${menufile}] File Not Found";exit;fi
|
||
set sep = ":"
|
||
set select = 1
|
||
while [ $select -lt 10 ]
|
||
call loadmenu
|
||
call getselect
|
||
call processchoice
|
||
loop
|
||
echo "\f\n\nuser chose from menu [${menu}] choice [${choice}] select [${select}]"
|
||
}
|
||
echo -N "."
|
||
function processchoice {
|
||
switch $select
|
||
case 11
|
||
case 12
|
||
case 13
|
||
case 14
|
||
case 15
|
||
case 16
|
||
case 17
|
||
case 18
|
||
set select = $select - 10
|
||
set choice = `sh -C "grep ${menu}:${select}: $menufile | cut -s ${sep} -f 4"`
|
||
break
|
||
case 20
|
||
set choice = "Quit"
|
||
break
|
||
case 25
|
||
set choice = "Last Menu"
|
||
break
|
||
case 30
|
||
set choice = "Root/Master Menu"
|
||
break
|
||
default
|
||
echo "\fWow No idea how i got here\n\n"
|
||
set select = 99
|
||
end
|
||
if [ $select -lt 9 ]
|
||
if [ $choice = "MENU" ]
|
||
set lm = $menu
|
||
set menu = `sh -C "grep ${menu}:${select}: $menufile | cut -s ${sep} -f 5"`
|
||
set select = 1
|
||
fi
|
||
fi
|
||
}
|
||
echo -N "."
|
||
function loadmenu {
|
||
set mc = 0
|
||
set lc = 0
|
||
for i in `grep "${menu}:" $menufile`
|
||
echo $mc $lc $i
|
||
pause
|
||
if [ $lc -eq 0 ]
|
||
set mr = `sh -C "echo ${i} | cut -s ${sep} -f 3"`
|
||
echo $mc $lc $mr
|
||
pause
|
||
if [ $mr = "-" ]
|
||
set lc = $mc - 1
|
||
else
|
||
set m${mc} = $mr
|
||
fi
|
||
set mc = $mc + 1
|
||
fi
|
||
next
|
||
if [ $lc -eq 0 ]
|
||
set lc = 8
|
||
fi
|
||
set mc =;set mr =
|
||
}
|
||
echo -N "."
|
||
function getselect {
|
||
call dispmenu
|
||
while [ $select -lt 10 ]
|
||
call dselect
|
||
read -n 0 K
|
||
switch $K
|
||
case 3
|
||
if [ -n $lm ]
|
||
set select = 25
|
||
else
|
||
call uselect
|
||
set select = 1
|
||
fi
|
||
break
|
||
case 13
|
||
set select = $select + 10
|
||
break
|
||
case 8
|
||
case 10
|
||
call uselect
|
||
set select = $select - 1
|
||
if [ $select -eq 0 ];set select = $lc;fi
|
||
break
|
||
case 11
|
||
case 21
|
||
call uselect
|
||
set select = $select + 1
|
||
if [ $select -gt $lc ];set select = 1;fi
|
||
break
|
||
case 17
|
||
case 81
|
||
case 113
|
||
set select = 20
|
||
break
|
||
case 18
|
||
case 77
|
||
case 82
|
||
case 109
|
||
case 114
|
||
set select = 30
|
||
break
|
||
end
|
||
loop
|
||
}
|
||
echo -N "."
|
||
function dselect {
|
||
switch $select
|
||
case 1 ; call ixy 10 25 $m1 ; break
|
||
case 2 ; call ixy 11 25 $m2 ; break
|
||
case 3 ; call ixy 12 25 $m3 ; break
|
||
case 4 ; call ixy 13 25 $m4 ; break
|
||
case 5 ; call ixy 14 25 $m5 ; break
|
||
case 6 ; call ixy 15 25 $m6 ; break
|
||
case 7 ; call ixy 16 25 $m7 ; break
|
||
case 8 ; call ixy 17 25 $m8 ; break
|
||
end
|
||
}
|
||
echo -N "."
|
||
function uselect {
|
||
switch $select
|
||
case 1 ; call pxy 10 25 $m1 ; break
|
||
case 2 ; call pxy 11 25 $m2 ; break
|
||
case 3 ; call pxy 12 25 $m3 ; break
|
||
case 4 ; call pxy 13 25 $m4 ; break
|
||
case 5 ; call pxy 14 25 $m5 ; break
|
||
case 6 ; call pxy 15 25 $m6 ; break
|
||
case 7 ; call pxy 16 25 $m7 ; break
|
||
case 8 ; call pxy 17 25 $m8 ; break
|
||
end;}
|
||
echo -N "."
|
||
function dispmenu {
|
||
call cs ; call tbox $m0
|
||
switch $lc
|
||
case 8 ; call pxy 17 25 $m8
|
||
case 7 ; call pxy 16 25 $m7
|
||
case 6 ; call pxy 15 25 $m6
|
||
case 5 ; call pxy 14 25 $m5
|
||
case 4 ; call pxy 13 25 $m4
|
||
case 3 ; call pxy 12 25 $m3
|
||
case 2 ; call pxy 11 25 $m2
|
||
default ; call pxy 10 25 $m1
|
||
end;}
|
||
echo -N "."
|
||
function cs {;echo \f;}
|
||
function tbox {
|
||
set tS = $1
|
||
set tL = `sh -c "echo ${tS}|wc -m"`
|
||
set tL = 34 - ${tL} / 2
|
||
while [ $tL -ne 0 ]
|
||
set tS = " ${tS}";set tL = $tL - 1
|
||
loop
|
||
echo -n "\e[1;20H"
|
||
echo "\e[7m \e[0m"
|
||
set tL = 2
|
||
while [ $tL -ne 5 ]
|
||
echo -n "\e[${tL};20H"
|
||
echo "\e[7m \e[0m \e[7m \e[0m"
|
||
set tL = $tL + 1
|
||
loop
|
||
echo -n "\e[5;20H"
|
||
echo "\e[7m \e[0m"
|
||
echo -n "\e[3;22H ${tS}"
|
||
set tS =;set tL =
|
||
}
|
||
echo -N "."
|
||
function piv { ; echo -n "\e[7m$1\e[0m" ; }
|
||
function pxy { ; echo -n "\e[$1;$2H$3" ; }
|
||
function ixy { ; echo -n "\e[$1;$2H\e[7m$3\e[0m" ; }
|
||
echo -N ".\e[0m"
|
||
# End of FMENU
|
||
MAN
|
||
TEXT /MAKE/USR/SHARE/ADMIN/fmenu
|