MPE/iX - CI Programming for Stability

July 18, 2008 HP World '01 97
Scan history stack (cont)
elseif '!entry' = 'listredo' then
# Fill variable "array" so redo stack can be searched from TOS down.
# Input comes from output of LISTREDO ;unn command.
# Skip TOS redo line since it invoked this script!
setvar _rdo_x 0
setvar _rdo_size finfo(hpstdin,'eof')-1
while setvar(_rdo_x,_rdo_x+1) <= _rdo_size do
setvar _rdo_!_rdo_x input()
endwhile
return
elseif '!entry' = 'match' then
# Find redo entry (now in variable "array") that matches user's string.
# Search from last array element down to the first. Return _rdo_line as
# "" for no match, or the matching cmd.
setvar _rdo_txt dwns("!cmdstr")
setvar _rdo_x _rdo_size+1
while setvar(_rdo_x,_rdo_x-1) > 0 and &
pos(_rdo_txt,dwns(_rdo_![_rdo_x-1])) = 0 do
endwhile
if _rdo_x > 0 then
# match
setvar _rdo_line _rdo_!_rdo_x
else
setvar _rdo_line "“
endif
return
endif