Index: trunk/Ohana/src/opihi/pantasks/CheckJobs.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/CheckJobs.c	(revision 4691)
+++ trunk/Ohana/src/opihi/pantasks/CheckJobs.c	(revision 4693)
@@ -1,3 +1,3 @@
-# include "scheduler.h"
+# include "psched.h"
 
 int CheckJobs () {
Index: trunk/Ohana/src/opihi/pantasks/CheckSystem.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/CheckSystem.c	(revision 4691)
+++ trunk/Ohana/src/opihi/pantasks/CheckSystem.c	(revision 4693)
@@ -1,3 +1,3 @@
-# include "scheduler.h"
+# include "psched.h"
 
 int CheckSystem () {
Index: trunk/Ohana/src/opihi/pantasks/CheckTasks.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/CheckTasks.c	(revision 4691)
+++ trunk/Ohana/src/opihi/pantasks/CheckTasks.c	(revision 4693)
@@ -1,3 +1,3 @@
-# include "scheduler.h"
+# include "psched.h"
 
 int CheckTasks () {
Index: trunk/Ohana/src/opihi/pantasks/CheckTimeRanges.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/CheckTimeRanges.c	(revision 4691)
+++ trunk/Ohana/src/opihi/pantasks/CheckTimeRanges.c	(revision 4693)
@@ -1,3 +1,3 @@
-# include "scheduler.h"
+# include "psched.h"
 
 int CheckTimeRanges (TimeRange *ranges, int Nranges) {
Index: trunk/Ohana/src/opihi/pantasks/ControllerOps.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/ControllerOps.c	(revision 4691)
+++ trunk/Ohana/src/opihi/pantasks/ControllerOps.c	(revision 4693)
@@ -1,3 +1,3 @@
-# include "scheduler.h"
+# include "psched.h"
 # define CONTROLLER_TIMEOUT 20
 # define CONNECT_TIMEOUT 300
@@ -350,8 +350,5 @@
       exit (2);
     case -1:  /* no data in pipe */
-      break;
-    case 0:   /* pipe is closed */
-      /** change child state? **/
-      break;
+    case 0:   /* pipe is closed, change child state? **/
     default:  /* data in pipe */
       break;
@@ -365,8 +362,5 @@
       exit (2);
     case -1:  /* no data in pipe */
-      break;
-    case 0:   /* pipe is closed */
-      /** change child state? **/
-      break;
+    case 0:   /* pipe is closed, change child state? **/
     default:  /* data in pipe */
       break;
Index: trunk/Ohana/src/opihi/pantasks/JobIDOps.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/JobIDOps.c	(revision 4691)
+++ trunk/Ohana/src/opihi/pantasks/JobIDOps.c	(revision 4693)
@@ -1,3 +1,3 @@
-# include "scheduler.h"
+# include "psched.h"
 
 # define MAX_N_JOBS 1000
Index: trunk/Ohana/src/opihi/pantasks/JobOps.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/JobOps.c	(revision 4691)
+++ trunk/Ohana/src/opihi/pantasks/JobOps.c	(revision 4693)
@@ -1,3 +1,3 @@
-# include "scheduler.h"
+# include "psched.h"
 
 static Job **jobs;
Index: trunk/Ohana/src/opihi/pantasks/LocalJob.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/LocalJob.c	(revision 4691)
+++ trunk/Ohana/src/opihi/pantasks/LocalJob.c	(revision 4693)
@@ -1,3 +1,3 @@
-# include "scheduler.h"
+# include "psched.h"
 
 /* this could be written a just a one-way pipe */
@@ -66,32 +66,31 @@
   CheckLocalJobStatus (job);
 
-  /* read stdout buffer */
-  Nread = ReadtoIOBuffer (&job[0].stdout, job[0].stdout_fd);
-  switch (Nread) {
-    case -2:  /* error in read (programming error?  system level error?) */
-      fprintf (stderr, "serious IO error\n");
-      exit (2);
-    case -1:  /* no data in pipe */
-      break;
-    case 0:   /* pipe is closed */
-      /** change child state? **/
-      break;
-    default:  /* data in pipe */
-      break;
-  }
+  if ((job[0].state == JOB_EXIT) || (job[0].state == JOB_CRASH)) {
+    EmptyIOBuffer (&job[0].stdout, job[0].stdout_fd);
+    EmptyIOBuffer (&job[0].stderr, job[0].stderr_fd);
+  } else {
+    /* read stdout buffer */
+    Nread = ReadtoIOBuffer (&job[0].stdout, job[0].stdout_fd);
+    switch (Nread) {
+      case -2:  /* error in read (programming error?  system level error?) */
+	fprintf (stderr, "serious IO error\n");
+	exit (2);
+      case -1:  /* no data in pipe */
+      case 0:   /* pipe is closed, change child state? **/
+      default:  /* data in pipe */
+	break;
+    }
   
-  /* read stderr buffer */
-  Nread = ReadtoIOBuffer (&job[0].stderr, job[0].stderr_fd);
-  switch (Nread) {
-    case -2:  /* error in read (programming error?  system level error?) */
-      fprintf (stderr, "serious IO error\n");
-      exit (2);
-    case -1:  /* no data in pipe */
-      break;
-    case 0:   /* pipe is closed */
-      /** change child state? **/
-      break;
-    default:  /* data in pipe */
-      break;
+    /* read stderr buffer */
+    Nread = ReadtoIOBuffer (&job[0].stderr, job[0].stderr_fd);
+    switch (Nread) {
+      case -2:  /* error in read (programming error?  system level error?) */
+	fprintf (stderr, "serious IO error\n");
+	exit (2);
+      case -1:  /* no data in pipe */
+      case 0:   /* pipe is closed, change child state? **/
+      default:  /* data in pipe */
+	break;
+    }
   }
   return (TRUE);
@@ -101,4 +100,7 @@
 
   int result, waitstatus;
+
+  /*** if child has exited, does the pipe hang around until it is flushed? ***/
+  /*** who closes the child stdout/stderr fd? */
 
   /* check local job status */
Index: trunk/Ohana/src/opihi/pantasks/Makefile
===================================================================
--- trunk/Ohana/src/opihi/pantasks/Makefile	(revision 4691)
+++ trunk/Ohana/src/opihi/pantasks/Makefile	(revision 4693)
@@ -7,5 +7,5 @@
 LIB     =       $(HOME)/lib
 INC     =       $(HOME)/include
-SDIR    =       $(HOME)/sched
+SDIR    =       $(HOME)/psched
 #
 DESTBIN =       $(LBIN)
@@ -13,5 +13,5 @@
 DESTINC =       $(LINC)
 DESTMAN =       $(LMAN)
-DESTHLP =       $(LHLP)/sched
+DESTHLP =       $(LHLP)/psched
 #  
 INCS    =       -I$(INC) -I$(LINC) -I$(XINC)
@@ -27,5 +27,5 @@
 funcs = \
 $(SDIR)/init.$(ARCH).o \
-$(SDIR)/scheduler.$(ARCH).o \
+$(SDIR)/psched.$(ARCH).o \
 $(SDIR)/CheckJobs.$(ARCH).o \
 $(SDIR)/CheckSystem.$(ARCH).o \
@@ -36,6 +36,5 @@
 $(SDIR)/JobOps.$(ARCH).o \
 $(SDIR)/JobIDOps.$(ARCH).o \
-$(SDIR)/TaskOps.$(ARCH).o \
-$(SDIR)/IOBufferOps.$(ARCH).o
+$(SDIR)/TaskOps.$(ARCH).o
 
 cmds = \
@@ -67,14 +66,14 @@
 $(DESTLIB)/libdatacmd.a
 
-all: scheduler
+all: psched
 
-scheduler: $(BIN)/scheduler.$(ARCH)
+psched: $(BIN)/psched.$(ARCH)
 	@echo done
 
-$(BIN)/scheduler.$(ARCH) : $(funcs) $(cmds) $(libs)
+$(BIN)/psched.$(ARCH) : $(funcs) $(cmds) $(libs)
 
-install: $(DESTBIN)/scheduler help
+install: $(DESTBIN)/psched help
 
-help: cmd.basic.help cmd.data.help cmd.astro.help sched.help
+help: cmd.basic.help cmd.data.help cmd.astro.help psched.help
 
 # utilities #################################################
Index: trunk/Ohana/src/opihi/pantasks/TaskOps.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/TaskOps.c	(revision 4691)
+++ trunk/Ohana/src/opihi/pantasks/TaskOps.c	(revision 4693)
@@ -1,3 +1,3 @@
-# include "scheduler.h"
+# include "psched.h"
 
 static Task **tasks;
Index: trunk/Ohana/src/opihi/pantasks/controller.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/controller.c	(revision 4691)
+++ trunk/Ohana/src/opihi/pantasks/controller.c	(revision 4693)
@@ -1,3 +1,3 @@
-# include "scheduler.h"
+# include "psched.h"
 
 int controller_host    PROTO((int, char **));
Index: trunk/Ohana/src/opihi/pantasks/controller_check.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/controller_check.c	(revision 4691)
+++ trunk/Ohana/src/opihi/pantasks/controller_check.c	(revision 4693)
@@ -1,3 +1,3 @@
-# include "scheduler.h"
+# include "psched.h"
 
 int controller_check (int argc, char **argv) {
Index: trunk/Ohana/src/opihi/pantasks/controller_exit.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/controller_exit.c	(revision 4691)
+++ trunk/Ohana/src/opihi/pantasks/controller_exit.c	(revision 4693)
@@ -1,3 +1,3 @@
-# include "scheduler.h"
+# include "psched.h"
 
 int controller_exit (int argc, char **argv) {
Index: trunk/Ohana/src/opihi/pantasks/controller_host.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/controller_host.c	(revision 4691)
+++ trunk/Ohana/src/opihi/pantasks/controller_host.c	(revision 4693)
@@ -1,3 +1,3 @@
-# include "scheduler.h"
+# include "psched.h"
 
 int controller_host (int argc, char **argv) {
Index: trunk/Ohana/src/opihi/pantasks/controller_output.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/controller_output.c	(revision 4691)
+++ trunk/Ohana/src/opihi/pantasks/controller_output.c	(revision 4693)
@@ -1,3 +1,3 @@
-# include "scheduler.h"
+# include "psched.h"
 
 int controller_output (int argc, char **argv) {
Index: trunk/Ohana/src/opihi/pantasks/controller_status.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/controller_status.c	(revision 4691)
+++ trunk/Ohana/src/opihi/pantasks/controller_status.c	(revision 4693)
@@ -1,3 +1,3 @@
-# include "scheduler.h"
+# include "psched.h"
 
 int controller_status (int argc, char **argv) {
Index: trunk/Ohana/src/opihi/pantasks/delete.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/delete.c	(revision 4691)
+++ trunk/Ohana/src/opihi/pantasks/delete.c	(revision 4693)
@@ -1,3 +1,3 @@
-# include "scheduler.h"
+# include "psched.h"
 
 int delete_job (int argc, char **argv) {
Index: trunk/Ohana/src/opihi/pantasks/init.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/init.c	(revision 4691)
+++ trunk/Ohana/src/opihi/pantasks/init.c	(revision 4693)
@@ -1,3 +1,3 @@
-# include "scheduler.h"
+# include "psched.h"
 
 int controller      PROTO((int, char **));
@@ -47,5 +47,5 @@
 */
 
-void InitSched () {
+void InitPsched () {
   
   int i;
Index: trunk/Ohana/src/opihi/pantasks/job.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/job.c	(revision 4691)
+++ trunk/Ohana/src/opihi/pantasks/job.c	(revision 4693)
@@ -1,3 +1,3 @@
-# include "scheduler.h"
+# include "psched.h"
 
 /* this will require a bit of care: to define a job, we need
Index: trunk/Ohana/src/opihi/pantasks/kill.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/kill.c	(revision 4691)
+++ trunk/Ohana/src/opihi/pantasks/kill.c	(revision 4693)
@@ -1,3 +1,3 @@
-# include "scheduler.h"
+# include "psched.h"
 
 int kill_job (int argc, char **argv) {
Index: trunk/Ohana/src/opihi/pantasks/psched.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/psched.c	(revision 4693)
+++ trunk/Ohana/src/opihi/pantasks/psched.c	(revision 4693)
@@ -0,0 +1,77 @@
+# include "psched.h"
+
+# define opihi_name "psched"
+# define opihi_prompt "psched: "
+# define opihi_description "parallel task scheduler\n"
+# define opihi_history ".psched"
+# define opihi_rcfile ".pschedrc"
+
+/* program-dependent initialization */
+void initialize (int argc, char **argv) {
+  
+  auto_break = TRUE;
+
+  Nlists = 0;
+  ALLOCATE (lists, List, 1); 
+
+  /* init functions required by libraries */
+  /* -libopihi */
+  InitCommands ();
+  InitMacros ();
+  InitBuffers ();
+  InitVectors ();
+  InitVariables ();
+
+  /* -libdisplay */
+  InitGraph ();
+  InitImage ();
+
+  /* load the commands used by this implementation */
+  InitBasic ();
+  InitData ();
+  InitOutfile ();
+  InitPsched ();
+  InitTasks ();
+  InitJobs ();
+  InitJobIDs ();
+
+  rl_readline_name = opihi_name;
+  rl_attempted_completion_function = command_completer;
+  rl_event_hook = NULL;
+  rl_set_keyboard_input_timeout (1000000); 
+
+  set_str_variable ("HISTORY", opihi_history);
+  set_str_variable ("PROMPT", opihi_prompt);
+  set_str_variable ("RCFILE", opihi_rcfile);
+# ifdef HELPDIR_DEFAULT
+  set_str_variable ("HELPDIR", MACRO_NAME(HELPDIR_DEFAULT));
+# endif
+
+  { /* check history file permission */
+    FILE *f;
+    f = fopen (opihi_history, "a");
+    if (f == NULL) /* no current history file here */
+      fprintf (stderr, "can't save history.\n");
+    else
+      fclose (f);
+    stifle_history (200);
+    read_history (opihi_history);
+  }
+
+  signal (SIGINT, SIG_IGN);
+  return;
+}
+
+/* standard welcome message */
+void welcome () {
+  fprintf (stderr, "\n");
+  fprintf (stderr, "Welcome to %s - %s\n\n", opihi_name, opihi_description);
+}
+
+/* add program-dependent exit functions here */
+void cleanup () {
+  QuitImage ();
+  QuitGraph ();
+  QuitController ();
+  return;
+}
Index: trunk/Ohana/src/opihi/pantasks/run.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/run.c	(revision 4691)
+++ trunk/Ohana/src/opihi/pantasks/run.c	(revision 4693)
@@ -1,3 +1,3 @@
-# include "scheduler.h"
+# include "psched.h"
 
 int run (int argc, char **argv) {
Index: trunk/Ohana/src/opihi/pantasks/status.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/status.c	(revision 4691)
+++ trunk/Ohana/src/opihi/pantasks/status.c	(revision 4693)
@@ -1,3 +1,3 @@
-# include "scheduler.h"
+# include "psched.h"
 
 int status_sys (int argc, char **argv) {
Index: trunk/Ohana/src/opihi/pantasks/stop.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/stop.c	(revision 4691)
+++ trunk/Ohana/src/opihi/pantasks/stop.c	(revision 4693)
@@ -1,3 +1,3 @@
-# include "scheduler.h"
+# include "psched.h"
 
 int stop (int argc, char **argv) {
Index: trunk/Ohana/src/opihi/pantasks/task.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/task.c	(revision 4691)
+++ trunk/Ohana/src/opihi/pantasks/task.c	(revision 4693)
@@ -1,3 +1,3 @@
-# include "scheduler.h"
+# include "psched.h"
 # define prompt "> "
 
Index: trunk/Ohana/src/opihi/pantasks/task_command.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/task_command.c	(revision 4691)
+++ trunk/Ohana/src/opihi/pantasks/task_command.c	(revision 4693)
@@ -1,3 +1,3 @@
-# include "scheduler.h"
+# include "psched.h"
 
 int task_command (int argc, char **argv) {
Index: trunk/Ohana/src/opihi/pantasks/task_host.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/task_host.c	(revision 4691)
+++ trunk/Ohana/src/opihi/pantasks/task_host.c	(revision 4693)
@@ -1,3 +1,3 @@
-# include "scheduler.h"
+# include "psched.h"
 
 int task_host (int argc, char **argv) {
Index: trunk/Ohana/src/opihi/pantasks/task_macros.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/task_macros.c	(revision 4691)
+++ trunk/Ohana/src/opihi/pantasks/task_macros.c	(revision 4693)
@@ -1,3 +1,3 @@
-# include "scheduler.h"
+# include "psched.h"
 # define D_NLINES 100
 # define prompt "> "
Index: trunk/Ohana/src/opihi/pantasks/task_nmax.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/task_nmax.c	(revision 4691)
+++ trunk/Ohana/src/opihi/pantasks/task_nmax.c	(revision 4693)
@@ -1,3 +1,3 @@
-# include "scheduler.h"
+# include "psched.h"
 
 int task_nmax (int argc, char **argv) {
Index: trunk/Ohana/src/opihi/pantasks/task_periods.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/task_periods.c	(revision 4691)
+++ trunk/Ohana/src/opihi/pantasks/task_periods.c	(revision 4693)
@@ -1,3 +1,3 @@
-# include "scheduler.h"
+# include "psched.h"
 
 int task_periods (int argc, char **argv) {
Index: trunk/Ohana/src/opihi/pantasks/task_trange.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/task_trange.c	(revision 4691)
+++ trunk/Ohana/src/opihi/pantasks/task_trange.c	(revision 4693)
@@ -1,3 +1,3 @@
-# include "scheduler.h"
+# include "psched.h"
 
 int task_trange (int argc, char **argv) {
Index: trunk/Ohana/src/opihi/pantasks/verbose.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/verbose.c	(revision 4691)
+++ trunk/Ohana/src/opihi/pantasks/verbose.c	(revision 4693)
@@ -1,3 +1,3 @@
-# include "scheduler.h"
+# include "psched.h"
 
 static int VERBOSE = FALSE;
