Index: trunk/Ohana/src/opihi/pantasks/CheckJobs.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/CheckJobs.c	(revision 4688)
+++ trunk/Ohana/src/opihi/pantasks/CheckJobs.c	(revision 4689)
@@ -4,8 +4,6 @@
 
   Job *job;
-  Task *task;
   Macro *macro;
-  int i, found, status;
-  int Ntest;
+  int i, status;
 
   /** test all jobs: ready to test?  finished? **/
Index: trunk/Ohana/src/opihi/pantasks/CheckSystem.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/CheckSystem.c	(revision 4688)
+++ trunk/Ohana/src/opihi/pantasks/CheckSystem.c	(revision 4689)
@@ -6,4 +6,4 @@
   CheckJobs ();
   CheckControllerOutput ();
-
+  return (TRUE);
 }
Index: trunk/Ohana/src/opihi/pantasks/CheckTasks.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/CheckTasks.c	(revision 4688)
+++ trunk/Ohana/src/opihi/pantasks/CheckTasks.c	(revision 4689)
@@ -5,7 +5,5 @@
   Job *job;
   Task *task;
-  Macro *macro;
-  int i, found, status;
-  int Ntest;
+  int status;
 
   /** test all tasks: ready to test? ready to run? **/
Index: trunk/Ohana/src/opihi/pantasks/ControllerOps.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/ControllerOps.c	(revision 4688)
+++ trunk/Ohana/src/opihi/pantasks/ControllerOps.c	(revision 4689)
@@ -20,4 +20,5 @@
     GetJobOutput ("stderr", job[0].pid, &job[0].stderr, job[0].stderr_size);
   }  
+  return (TRUE);
 }
 
@@ -157,5 +158,5 @@
   /* construct the controller command portion */
   if (!strcmp (job[0].task[0].host, "NONE")) {
-    sprintf (cmd, "job", cmd);
+    sprintf (cmd, "job");
   } else {
     if (job[0].task[0].host_required) {
@@ -391,4 +392,6 @@
   IOBuffer buffer;
 
+  if (!CheckControllerStatus()) return (TRUE);
+
   sprintf (cmd, "kill %d", job[0].pid);
   InitIOBuffer (&buffer, 0x100);
@@ -400,3 +403,17 @@
 }
 
+int QuitController () {
+
+  int status;
+  char cmd[128];
+  IOBuffer buffer;
+
+  if (!CheckControllerStatus()) return (TRUE);
+
+  sprintf (cmd, "quit");
+  InitIOBuffer (&buffer, 0x100);
+  status = ControllerCommand (cmd, CONTROLLER_PROMPT, &buffer);
+  return (TRUE);
+}
+
 /* memstr returns a view, not an allocated string : don't free */
Index: trunk/Ohana/src/opihi/pantasks/IOBufferOps.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/IOBufferOps.c	(revision 4688)
+++ trunk/Ohana/src/opihi/pantasks/IOBufferOps.c	(revision 4689)
@@ -59,4 +59,5 @@
     }
   }
+  return (Nread);
 }
 
Index: trunk/Ohana/src/opihi/pantasks/JobIDOps.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/JobIDOps.c	(revision 4688)
+++ trunk/Ohana/src/opihi/pantasks/JobIDOps.c	(revision 4689)
@@ -38,3 +38,4 @@
 
   JobIDList[JobID] = FALSE;
+  return (TRUE);
 }
Index: trunk/Ohana/src/opihi/pantasks/JobOps.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/JobOps.c	(revision 4688)
+++ trunk/Ohana/src/opihi/pantasks/JobOps.c	(revision 4689)
@@ -56,5 +56,5 @@
 
   for (i = 0; i < Njobs; i++) {
-    fprintf (stderr, "%d: %-15s %5d %20s (%x)\n", Njobs, jobs[i][0].task[0].name, jobs[i][0].JobID, jobs[i][0].argv[0], jobs[i][0].argv);
+    fprintf (stderr, "%d: %-15s %5d %20s (%lx)\n", Njobs, jobs[i][0].task[0].name, jobs[i][0].JobID, jobs[i][0].argv[0], (long) jobs[i][0].argv);
   }
   return;
Index: trunk/Ohana/src/opihi/pantasks/LocalJob.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/LocalJob.c	(revision 4688)
+++ trunk/Ohana/src/opihi/pantasks/LocalJob.c	(revision 4689)
@@ -152,5 +152,5 @@
       }
   }
-  return;
+  return (FALSE);
 }
 
Index: trunk/Ohana/src/opihi/pantasks/Makefile
===================================================================
--- trunk/Ohana/src/opihi/pantasks/Makefile	(revision 4688)
+++ trunk/Ohana/src/opihi/pantasks/Makefile	(revision 4689)
@@ -7,5 +7,4 @@
 LIB     =       $(HOME)/lib
 INC     =       $(HOME)/include
-HELP    =       $(HOME)/help
 SDIR    =       $(HOME)/sched
 #
@@ -38,6 +37,5 @@
 $(SDIR)/JobIDOps.$(ARCH).o \
 $(SDIR)/TaskOps.$(ARCH).o \
-$(SDIR)/IOBufferOps.$(ARCH).o \
-$(SDIR)/memstr.$(ARCH).o
+$(SDIR)/IOBufferOps.$(ARCH).o
 
 cmds = \
@@ -50,4 +48,5 @@
 $(SDIR)/controller.$(ARCH).o \
 $(SDIR)/controller_host.$(ARCH).o \
+$(SDIR)/controller_exit.$(ARCH).o \
 $(SDIR)/controller_check.$(ARCH).o \
 $(SDIR)/controller_status.$(ARCH).o \
@@ -107,10 +106,4 @@
 	cp $^ $@
 
-%.help:
-	@if [ ! -d $(DESTHLP) ]; then mkdir -p $(DESTHLP); fi
-	rm -f $(HOME)/$*/help/*~
-	rm -f $(HOME)/$*/help/#*
-	cp $(HOME)/$*/help/* $(DESTHLP)/
-
 clean:
 	rm -f $(BIN)/*.$(ARCH)
@@ -136,28 +129,7 @@
 	$(CC) $(CFLAGS) -c $*.c -o $@
 
-
-
-## -*- makefile -*- 
-# deprecated functions: verify & delete
-#$(SDIR)/abszero.$(ARCH).o \
-#$(SDIR)/cals.$(ARCH).o \
-#$(SDIR)/dumpmags.$(ARCH).o \
-#$(SDIR)/extract.$(ARCH).o \
-#$(SDIR)/gtypes.$(ARCH).o \
-#$(SDIR)/photresid.$(ARCH).o \
-#$(SDIR)/resid.$(ARCH).o \
-#$(SDIR)/zeropts.$(ARCH).o
-#$(SDIR)/objload.$(ARCH).o \ - make sure we have vect to tv
-#$(SDIR)/ccdextract.$(ARCH).o \
-#$(SDIR)/cmdextract.$(ARCH).o \
-#$(SDIR)/dmagextract.$(ARCH).o \
-#$(SDIR)/ddmagextract.$(ARCH).o \
-
-# future functions, not fully implemented
-#$(SDIR)/detrend.$(ARCH).o \
-#$(SDIR)/getxtra.$(ARCH).o \
-#$(SDIR)/addxtra.$(ARCH).o \
-
-# functions that need to be updated
-#$(SDIR)/gregions.$(ARCH).o \
-
+%.help:
+	@if [ ! -d $(DESTHLP) ]; then mkdir -p $(DESTHLP); fi
+	rm -f $(HOME)/$*/help/*~
+	rm -f $(HOME)/$*/help/#*
+	cp $(HOME)/$*/help/* $(DESTHLP)/
Index: trunk/Ohana/src/opihi/pantasks/controller.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/controller.c	(revision 4688)
+++ trunk/Ohana/src/opihi/pantasks/controller.c	(revision 4689)
@@ -2,4 +2,5 @@
 
 int controller_host    PROTO((int, char **));
+int controller_exit    PROTO((int, char **));
 int controller_status  PROTO((int, char **));
 int controller_check   PROTO((int, char **));
@@ -7,4 +8,5 @@
 
 static Command controller_cmds[] = {
+  {"exit",   controller_exit,   "shutdown controller"},
   {"host",   controller_host,   "define host for controller"},
   {"check",  controller_check,  "check controller host/job"},
@@ -16,5 +18,5 @@
 
   int status;
-  Function *func;
+  CommandF *func;
 
   if (argc < 2) {
@@ -33,5 +35,5 @@
 }
 
-Function *FindControllerCommand (char *cmd) {
+CommandF *FindControllerCommand (char *cmd) {
 
   int i, N;
Index: trunk/Ohana/src/opihi/pantasks/controller_exit.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/controller_exit.c	(revision 4689)
+++ trunk/Ohana/src/opihi/pantasks/controller_exit.c	(revision 4689)
@@ -0,0 +1,14 @@
+# include "scheduler.h"
+
+int controller_exit (int argc, char **argv) {
+
+  if (argc != 2) {
+    fprintf (stderr, "USAGE: controller exit TRUE\n");
+    return (FALSE);
+  }
+
+  if (strcasecmp (argv[1], "TRUE")) return (FALSE);
+
+  QuitController ();
+  return (TRUE);
+}
Index: trunk/Ohana/src/opihi/pantasks/controller_output.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/controller_output.c	(revision 4688)
+++ trunk/Ohana/src/opihi/pantasks/controller_output.c	(revision 4689)
@@ -2,8 +2,4 @@
 
 int controller_output (int argc, char **argv) {
-
-  int status;
-  char command[1024];
-  IOBuffer buffer;
 
   if (argc != 1) {
Index: trunk/Ohana/src/opihi/pantasks/delete.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/delete.c	(revision 4688)
+++ trunk/Ohana/src/opihi/pantasks/delete.c	(revision 4689)
@@ -3,6 +3,5 @@
 int delete_job (int argc, char **argv) {
 
-  Job *job;
-  int JobID, N;
+  int JobID;
 
   if (argc < 2) {
Index: trunk/Ohana/src/opihi/pantasks/kill.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/kill.c	(revision 4688)
+++ trunk/Ohana/src/opihi/pantasks/kill.c	(revision 4689)
@@ -4,5 +4,5 @@
 
   Job *job;
-  int JobID, N;
+  int JobID;
 
   if (argc < 2) {
Index: trunk/Ohana/src/opihi/pantasks/memstr.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/memstr.c	(revision 4688)
+++ 	(revision )
@@ -1,13 +1,0 @@
-# include "pcontrol.h"
-
-/* returns pointer to start of m2 in m1, or NULL if failure */ 
-char *memstr (char *m1, char *m2, int n) {
-
-  int i, N;
-
-  N = strlen (m2);
-  for (i = 0; (i < n - N + 1) && memcmp (m1, m2, N); i++, m1++);
-  if (memcmp (m1, m2, N)) return (NULL);
-  return (m1);
-
-}
Index: trunk/Ohana/src/opihi/pantasks/scheduler.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/scheduler.c	(revision 4688)
+++ trunk/Ohana/src/opihi/pantasks/scheduler.c	(revision 4689)
@@ -7,18 +7,7 @@
 # define opihi_rcfile ".schedrc"
 
-void InitBasic ();
-void InitData ();
-void InitSched ();
-
-void welcome () {
-  fprintf (stderr, "\n");
-  fprintf (stderr, "Welcome to %s - %s\n\n", opihi_name, opihi_description);
-}
-
 /* program-dependent initialization */
 void initialize (int argc, char **argv) {
   
-  FILE *f;
-
   auto_break = TRUE;
 
@@ -55,24 +44,18 @@
   set_str_variable ("PROMPT", opihi_prompt);
   set_str_variable ("RCFILE", opihi_rcfile);
-# define xstr(s) str(s)
-# define str(s) #s
 # ifdef HELPDIR_DEFAULT
-  set_str_variable ("HELPDIR", xstr(HELPDIR_DEFAULT));
+  set_str_variable ("HELPDIR", MACRO_NAME(HELPDIR_DEFAULT));
 # endif
 
-  /* here we open the history file for append.  it this fails, we
-     won't be able to write to it, warn the user.  otherwise, this
-     creates the file readline will write to, if it did not exist */  
-
-  /* check history file */
-  /* rewrite with fstat or stat */
-  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);
+  { /* 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);
@@ -80,9 +63,15 @@
 }
 
+/* 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 () {
-  /* -libdisplay
   QuitImage ();
-  QuitGraph (); */
+  QuitGraph ();
+  QuitController ();
   return;
 }
Index: trunk/Ohana/src/opihi/pantasks/status.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/status.c	(revision 4688)
+++ trunk/Ohana/src/opihi/pantasks/status.c	(revision 4689)
@@ -10,5 +10,5 @@
   ListTasks (FALSE);
   ListJobs ();
-
+  return (TRUE);
 }
 
Index: trunk/Ohana/src/opihi/pantasks/task.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/task.c	(revision 4688)
+++ trunk/Ohana/src/opihi/pantasks/task.c	(revision 4689)
@@ -9,8 +9,7 @@
   int ThisList, status;
   char *input, *outline;
-  Macro *macro;
   Task *task;
 
-  if (N = get_argument (argc, argv, "-list")) {
+  if ((N = get_argument (argc, argv, "-list"))) {
     remove_argument (N, &argc, argv);
     ListTasks (FALSE);
@@ -18,5 +17,5 @@
   }
 
-  if (N = get_argument (argc, argv, "-longlist")) {
+  if ((N = get_argument (argc, argv, "-longlist"))) {
     remove_argument (N, &argc, argv);
     ListTasks (TRUE);
@@ -24,5 +23,5 @@
   }
 
-  if (N = get_argument (argc, argv, "-show")) {
+  if ((N = get_argument (argc, argv, "-show"))) {
     remove_argument (N, &argc, argv);
     ShowTask (argv[N]);
Index: trunk/Ohana/src/opihi/pantasks/task_host.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/task_host.c	(revision 4688)
+++ trunk/Ohana/src/opihi/pantasks/task_host.c	(revision 4689)
@@ -5,8 +5,7 @@
   int N, RequiredHost;
   Task *task;
-  char *taskname;
 
   RequiredHost = FALSE;
-  if (N = get_argument (argc, argv, "-required")) {
+  if ((N = get_argument (argc, argv, "-required"))) {
     remove_argument (N, &argc, argv);
     RequiredHost = TRUE;
Index: trunk/Ohana/src/opihi/pantasks/task_macros.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/task_macros.c	(revision 4688)
+++ trunk/Ohana/src/opihi/pantasks/task_macros.c	(revision 4689)
@@ -27,4 +27,6 @@
     return (FALSE);
   }
+
+  macro = NULL;
 
   /*** identify which Macro in Task this particular macro goes with ***/ 
Index: trunk/Ohana/src/opihi/pantasks/task_periods.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/task_periods.c	(revision 4688)
+++ trunk/Ohana/src/opihi/pantasks/task_periods.c	(revision 4689)
@@ -7,6 +7,7 @@
   Task *task;
 
+  PollValue = 0;
   Poll = FALSE;
-  if (N = get_argument (argc, argv, "-poll")) {
+  if ((N = get_argument (argc, argv, "-poll"))) {
     Poll = TRUE;
     remove_argument (N, &argc, argv);
@@ -15,6 +16,7 @@
   }
 
+  ExecValue = 0;
   Exec = FALSE;
-  if (N = get_argument (argc, argv, "-exec")) {
+  if ((N = get_argument (argc, argv, "-exec"))) {
     Exec = TRUE;
     remove_argument (N, &argc, argv);
@@ -23,6 +25,7 @@
   }
 
+  TimeoutValue = 0;
   Timeout = FALSE;
-  if (N = get_argument (argc, argv, "-timeout")) {
+  if ((N = get_argument (argc, argv, "-timeout"))) {
     Timeout = TRUE;
     remove_argument (N, &argc, argv);
@@ -49,10 +52,2 @@
   return (TRUE);
 }
-
-
-/** 
-    careful with this: the command is supposed to be realized 
-    for the Job, not the Task (at execution)
-    the code is right, but who calls it when needs to be clarified.
- **/
-
Index: trunk/Ohana/src/opihi/pantasks/task_trange.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/task_trange.c	(revision 4688)
+++ trunk/Ohana/src/opihi/pantasks/task_trange.c	(revision 4689)
@@ -3,5 +3,5 @@
 int task_trange (int argc, char **argv) {
 
-  int N, RequiredHost;
+  int N;
   Task *task;
   TimeRange range;
@@ -16,5 +16,5 @@
      keep = false means the time range defines an invalid range */
   range.keep = TRUE;
-  if (N = get_argument (argc, argv, "-exclude")) {
+  if ((N = get_argument (argc, argv, "-exclude"))) {
     remove_argument (N, &argc, argv);
     range.keep = FALSE;
