; show_prim_seq

; first search for assigned sys
foreach p in sys
   set s = (head($sys[$p]))
   if ($s s! 'UNK' & $p s! 'LARGEST') then
      set ass[$s] = $p
   endif
endfor

; then scan primary and build box
open db/primary

set tmp = ('tmp' // int(1000000*$random))
open $tmp
fprint $tmp 'formbox primary DO_NOTHING \'

set l = <db/primary
set i = 1
while (!eof('db/primary'))
   fprint $tmp ("'" // $i; $l //"'" ; 'message \')
   if (exist('ass[' // $i //']')) then
      set ss = (head(tail($sys[$ass[$i]])))
      fprint $tmp ("noreturn '"; $ss; "#"; $ass[$i]; "' action 'show_sys"; $ass[$i]; "' \")
   endif
   set i = (%+1)
   set l = <db/primary
endwhile

fprint $tmp "*"
close $tmp

@($tmp)

sh ("/bin/rm"; $tmp)
