#!/usr/bin/env slsh

import ("pvm");
static variable TASK_STATUS_MSG		= 1005;

define show_status (tid)
{
   variable my_tid = pvm_mytid ();
   variable s = pvm_tasks (tid);
   if (s == NULL)
     {
	() = fprintf (stderr, "Task with tid=%d does not appear to exist\n",
		      tid);
	exit (1);
     }
   
   pvm_initsend (PvmDataDefault);
   pvm_send (tid, TASK_STATUS_MSG);
   () = pvm_recv (-1, TASK_STATUS_MSG);
   message (pvm_unpack (String_Type));
}

if (__argc == 1)
{
   () = fprintf (stderr, "Usage: %s MASTER-TID\n", __argv[0]);
   exit (1);
}

show_status (integer (__argv[1]));
pvm_exit ();

