#!/usr/bin/env slsh

import ("pvm");
                    
  
define show_tasks (what)
{
   variable s = pvm_tasks (what);
   variable h = pvm_config ();
   variable i;
   
   vmessage ("%21sHOST      TID FLAG COMMAND", " ");

   _for (0, length (s.ti_tid)-1, 1)
     {
	i = ();
	variable host = "??";
	variable j = where (s.ti_host[i] == h.hi_tid);
	if (length (j))
	  host = h.hi_name[j[0]];
	  
	vmessage ("%25s 0x%06X %4d %s",
		  host, s.ti_tid[i],
		  s.ti_flag[i], s.ti_a_out[i]);
     }
}
show_tasks (0);
pvm_exit ();

