Index: trunk/Ohana/src/opihi/pantasks/CheckController.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/CheckController.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/CheckController.c	(revision 7917)
@@ -19,10 +19,10 @@
   // TimerMark ();
   // status = ControllerCommand ("stop", CONTROLLER_PROMPT, &buffer); 
-  // if (VerboseMode()) fprintf (stderr, "stop controller %f\n", TimerElapsed(TRUE));
+  // if (VerboseMode()) gprint (GP_ERR, "stop controller %f\n", TimerElapsed(TRUE));
 
   TimerMark ();
   FlushIOBuffer (&buffer);
   status = ControllerCommand ("jobstack exit", CONTROLLER_PROMPT, &buffer);
-  if (VerboseMode()) fprintf (stderr, "check exit stack %f\n", TimerElapsed(TRUE));
+  if (VerboseMode()) gprint (GP_ERR, "check exit stack %f\n", TimerElapsed(TRUE));
   if (!status) goto escape;
 
@@ -34,5 +34,5 @@
   status = sscanf (buffer.buffer, "%*s %d", &Njobs);
   if (status != 1) goto escape;
-  if (VerboseMode()) fprintf (stderr, "parse %d jobs on stack %f\n", Njobs, TimerElapsed(TRUE));
+  if (VerboseMode()) gprint (GP_ERR, "parse %d jobs on stack %f\n", Njobs, TimerElapsed(TRUE));
 
   p = buffer.buffer;
@@ -40,5 +40,5 @@
     q = strchr (p, '\n');
     if (q == NULL) {
-      fprintf (stderr, "controller message error: incomplete job list\n");
+      gprint (GP_ERR, "controller message error: incomplete job list\n");
       break;
     }
@@ -48,5 +48,5 @@
     job = FindControllerJob (JobID);
     if (job == NULL) {
-      fprintf (stderr, "misplaced job? %d not in EXIT job list\n", JobID);
+      gprint (GP_ERR, "misplaced job? %d not in EXIT job list\n", JobID);
       continue;
     }
@@ -54,5 +54,5 @@
     CheckControllerJob (job);
   }
-  if (VerboseMode()) fprintf (stderr, "clear %d exit jobs %f\n", i, TimerElapsed(TRUE));
+  if (VerboseMode()) gprint (GP_ERR, "clear %d exit jobs %f\n", i, TimerElapsed(TRUE));
 
   if (TestElapsedCheck()) goto finish;
@@ -70,5 +70,5 @@
   status = sscanf (buffer.buffer, "%*s %d", &Njobs);
   if (status != 1) goto escape;
-  if (VerboseMode()) fprintf (stderr, "check crash stack %f\n", TimerElapsed(TRUE)); 
+  if (VerboseMode()) gprint (GP_ERR, "check crash stack %f\n", TimerElapsed(TRUE)); 
 
   p = buffer.buffer;
@@ -76,5 +76,5 @@
     q = strchr (p, '\n');
     if (q == NULL) {
-      fprintf (stderr, "controller message error: incomplete job list\n");
+      gprint (GP_ERR, "controller message error: incomplete job list\n");
       break;
     }
@@ -84,5 +84,5 @@
     job = FindControllerJob (JobID);
     if (job == NULL) {
-      fprintf (stderr, "misplaced job? %d not in CRASH job list\n", JobID);
+      gprint (GP_ERR, "misplaced job? %d not in CRASH job list\n", JobID);
       continue;
     }
@@ -90,5 +90,5 @@
     CheckControllerJob (job);
   }
-  if (VerboseMode()) fprintf (stderr, "clear %d crash jobs %f\n", i, TimerElapsed(TRUE)); 
+  if (VerboseMode()) gprint (GP_ERR, "clear %d crash jobs %f\n", i, TimerElapsed(TRUE)); 
 
  finish:
Index: trunk/Ohana/src/opihi/pantasks/CheckJobs.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/CheckJobs.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/CheckJobs.c	(revision 7917)
@@ -18,9 +18,9 @@
     switch (status) {
       case JOB_PENDING:
-	/* if (VerboseMode()) fprintf (stderr, "job %s (%d) pending\n", job[0].task[0].name, job[0].JobID); */
+	/* if (VerboseMode()) gprint (GP_LOG, "job %s (%d) pending\n", job[0].task[0].name, job[0].JobID); */
 	break;
 
       case JOB_BUSY:
-	/* if (VerboseMode()) fprintf (stderr, "job %s (%d) busy\n", job[0].task[0].name, job[0].JobID); */
+	/* if (VerboseMode()) gprint (GP_LOG, "job %s (%d) busy\n", job[0].task[0].name, job[0].JobID); */
 	break;
 
@@ -28,5 +28,5 @@
 	/* run task[0].crash macro, if it exists */
 	/* push output buffer data to the stdout and stderr queues */
-	if (VerboseMode()) fprintf (stderr, "job %s (%d) crash\n", job[0].task[0].name, job[0].JobID);
+	if (VerboseMode()) gprint (GP_LOG, "job %s (%d) crash\n", job[0].task[0].name, job[0].JobID);
 	PushNamedQueue ("stdout", job[0].stdout.buffer);
 	PushNamedQueue ("stderr", job[0].stderr.buffer);
@@ -48,5 +48,5 @@
 
       case JOB_EXIT:
-	if (VerboseMode()) fprintf (stderr, "job %s (%d) exit\n", job[0].task[0].name, job[0].JobID);
+	if (VerboseMode()) gprint (GP_LOG, "job %s (%d) exit\n", job[0].task[0].name, job[0].JobID);
 	PushNamedQueue ("stdout", job[0].stdout.buffer);
 	PushNamedQueue ("stderr", job[0].stderr.buffer);
@@ -79,5 +79,5 @@
 
       default:
-	if (VerboseMode()) fprintf (stderr, "unknown exit status: %d\n", status);
+	if (VerboseMode()) gprint (GP_LOG, "unknown exit status: %d\n", status);
 	/** do something more useful here ?? **/
 	break;
@@ -89,5 +89,5 @@
     if (job[0].mode == JOB_LOCAL) {
       if (GetTaskTimer(job[0].start) < job[0].task[0].timeout_period) continue;
-      if (VerboseMode()) fprintf (stderr, "timeout on %s\n", job[0].task[0].name);
+      if (VerboseMode()) gprint (GP_LOG, "timeout on %s\n", job[0].task[0].name);
 
       /* update the timeout counter */
@@ -96,5 +96,5 @@
       if (!KillLocalJob (job)) {
 	job[0].state = JOB_HUNG;
-	if (VerboseMode()) fprintf (stderr, "child process %d is hung, cannot kill\n", job[0].pid);
+	if (VerboseMode()) gprint (GP_LOG, "child process %d is hung, cannot kill\n", job[0].pid);
 	continue;
       }
Index: trunk/Ohana/src/opihi/pantasks/CheckPassword.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/CheckPassword.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/CheckPassword.c	(revision 7917)
@@ -15,9 +15,9 @@
   int status;
 
-  if (DEBUG) fprintf (stderr, "waiting for password %s\n", PASSWORD);
+  if (DEBUG) gprint (GP_ERR, "waiting for password %s\n", PASSWORD);
 
   status = ExpectCommand (BindSocket, strlen(PASSWORD), 0.1, &message);
   if (status != 0) {
-    if (DEBUG) fprintf (stderr, "failed connection\n");
+    if (DEBUG) gprint (GP_ERR, "failed connection\n");
     FreeIOBuffer (&message);
     close (BindSocket);
@@ -25,9 +25,9 @@
   }
   if (strncmp (message.buffer, PASSWORD, strlen(PASSWORD))) {
-    if (DEBUG) fprintf (stderr, "invalid password\n");
+    if (DEBUG) gprint (GP_ERR, "invalid password\n");
     close (BindSocket);
     return (FALSE);
   }
-  if (DEBUG) fprintf (stderr, "accepted password (%s)\n", message.buffer);
+  if (DEBUG) gprint (GP_ERR, "accepted password (%s)\n", message.buffer);
   
   return (TRUE);
Index: trunk/Ohana/src/opihi/pantasks/ControllerOps.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/ControllerOps.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/ControllerOps.c	(revision 7917)
@@ -25,5 +25,5 @@
   gettimeofday (&stop, (void *) NULL);
   dtime = DTIME (stop, start);
-  /* if (VerboseMode()) fprintf (stderr, "check job status %f\n", dtime); */
+  /* if (VerboseMode()) gprint (GP_ERR, "check job status %f\n", dtime); */
 
   if ((job[0].state == JOB_EXIT) || (job[0].state == JOB_CRASH)) {
@@ -32,5 +32,5 @@
     gettimeofday (&stop, (void *) NULL);
     dtime = DTIME (stop, start);
-    /* if (VerboseMode()) fprintf (stderr, "get stdout %f\n", dtime); */
+    /* if (VerboseMode()) gprint (GP_ERR, "get stdout %f\n", dtime); */
 
     gettimeofday (&start, (void *) NULL);
@@ -38,5 +38,5 @@
     gettimeofday (&stop, (void *) NULL);
     dtime = DTIME (stop, start);
-    /* if (VerboseMode()) fprintf (stderr, "get stderr %f\n", dtime); */
+    /* if (VerboseMode()) gprint (GP_ERR, "get stderr %f\n", dtime); */
 
     gettimeofday (&start, (void *) NULL);
@@ -44,5 +44,5 @@
     gettimeofday (&stop, (void *) NULL);
     dtime = DTIME (stop, start);
-    /* if (VerboseMode()) fprintf (stderr, "delete job %f\n", dtime); */
+    /* if (VerboseMode()) gprint (GP_ERR, "delete job %f\n", dtime); */
   }  
   return (TRUE);
@@ -81,5 +81,5 @@
   p = memstr (buffer.buffer, "job not found", buffer.Nbuffer);
   if (p != NULL) {
-    fprintf (stderr, "unknown job %d\n", job[0].pid);
+    gprint (GP_ERR, "unknown job %d\n", job[0].pid);
     FreeIOBuffer (&buffer);
     return (FALSE);
@@ -105,5 +105,5 @@
   if (!strcmp(status_string, "CRASH"))   outstate = JOB_CRASH;
   if (outstate == -1) {
-    fprintf (stderr, "programming error?\n");
+    gprint (GP_ERR, "programming error?\n");
     exit (1);
   }
@@ -147,5 +147,5 @@
   if (status == -1) return (CONTROLLER_HUNG);
 
-  /* if (VerboseMode()) fprintf (stderr, "message received (GetJobOutput : %s)\n", cmd);   */
+  /* if (VerboseMode()) gprint (GP_ERR, "message received (GetJobOutput : %s)\n", cmd);   */
   /* drop extra bytes from pcontrol (not pclient:job) */
   buffer[0].Nbuffer = Nstart + Nbytes;
@@ -205,5 +205,5 @@
   p = memstr (buffer.buffer, "JobID", buffer.Nbuffer);
   if (p == NULL) {
-    fprintf (stderr, "missing PID in pcontrol message : programming error\n");
+    gprint (GP_ERR, "missing PID in pcontrol message : programming error\n");
     exit (1);
   }
@@ -240,5 +240,5 @@
   pid = fork ();
   if (!pid) { /* must be child process */
-    fprintf (stderr, "starting controller connection\n");
+    gprint (GP_LOG, "starting controller connection\n");
 
     /* close the other ends of the pipes */
@@ -303,5 +303,5 @@
   ControllerPID = pid;
   ControllerStatus = TRUE;
-  fprintf (stderr, "Connected\n");
+  gprint (GP_LOG, "Connected\n");
   return (TRUE);
 
@@ -311,5 +311,5 @@
 
 io_error:
-  fprintf (stderr, "timeout while connecting\n");
+  gprint (GP_ERR, "timeout while connecting\n");
   goto close_pipes;
 
@@ -341,5 +341,5 @@
   if ((status == -1) && (errno == EPIPE)) {
     StopController ();
-    if (VerboseMode()) fprintf (stderr, "controller is down\n");
+    if (VerboseMode()) gprint (GP_ERR, "controller is down\n");
     return (FALSE);
   }
@@ -355,9 +355,9 @@
   if (status ==  0) {
     StopController ();
-    if (VerboseMode()) fprintf (stderr, "controller is down\n");
+    if (VerboseMode()) gprint (GP_ERR, "controller is down\n");
     return (FALSE);
   }
   if (status == -1) {
-    if (VerboseMode()) fprintf (stderr, "controller is not responding\n");
+    if (VerboseMode()) gprint (GP_ERR, "controller is not responding\n");
     return (FALSE);
   }
@@ -369,5 +369,5 @@
     bzero (buffer[0].buffer + buffer[0].Nbuffer, buffer[0].Nalloc - buffer[0].Nbuffer);
   }
-  /* if (VerboseMode()) fprintf (stderr, "message received, %d cycles\n", i); */
+  /* if (VerboseMode()) gprint (GP_ERR, "message received, %d cycles\n", i); */
   return (TRUE);
 }
@@ -383,5 +383,5 @@
   switch (Nread) {
     case -2:  /* error in read (programming error?  system level error?) */
-      fprintf (stderr, "serious IO error\n");
+      gprint (GP_ERR, "serious IO error\n");
       exit (2);
     case -1:  /* no data in pipe */
@@ -395,5 +395,5 @@
   switch (Nread) {
     case -2:  /* error in read (programming error?  system level error?) */
-      fprintf (stderr, "serious IO error\n");
+      gprint (GP_ERR, "serious IO error\n");
       exit (2);
     case -1:  /* no data in pipe */
@@ -407,9 +407,9 @@
 int PrintControllerOutput () {
 
-  fprintf (stderr, "--- stdout ---\n");
-  fwrite (stdout_buffer.buffer, 1, stdout_buffer.Nbuffer, stderr);
-  fprintf (stderr, "--- stdout ---\n");
-  fwrite (stderr_buffer.buffer, 1, stderr_buffer.Nbuffer, stderr);
-  fprintf (stderr, "---  done  ---\n");
+  gprint (GP_LOG, "--- stdout ---\n");
+  gwrite (stdout_buffer.buffer, 1, stdout_buffer.Nbuffer, GP_LOG);
+  gprint (GP_LOG, "--- stderr ---\n");
+  gwrite (stderr_buffer.buffer, 1, stderr_buffer.Nbuffer, GP_LOG);
+  gprint (GP_LOG, "---  done  ---\n");
   return (TRUE);
 }
Index: trunk/Ohana/src/opihi/pantasks/JobOps.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/JobOps.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/JobOps.c	(revision 7917)
@@ -65,13 +65,13 @@
   int i;
 
-  fprintf (stderr, "\n");
+  gprint (GP_LOG, "\n");
   if (Njobs == 0) {
-    fprintf (stderr, " no defined jobs\n");
+    gprint (GP_LOG, " no defined jobs\n");
     return;
   }
 
-  fprintf (stderr, " Jobs\n");
-  for (i = 0; i < Njobs; i++) {
-    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);
+  gprint (GP_LOG, " Jobs\n");
+  for (i = 0; i < Njobs; i++) {
+    gprint (GP_LOG, " %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;
@@ -155,5 +155,5 @@
   }
   if (Nm == -1) {
-    fprintf (stderr, "programming error: job not found\n");
+    gprint (GP_ERR, "programming error: job not found\n");
     return (FALSE);
   }
Index: trunk/Ohana/src/opihi/pantasks/ListenClients.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/ListenClients.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/ListenClients.c	(revision 7917)
@@ -25,5 +25,5 @@
   */
 
-  if (DEBUG) fprintf (stderr, "adding a new client (%d)\n", client);
+  if (DEBUG) gprint (GP_LOG, "adding a new client (%d)\n", client);
   clients[Nclients] = client;
   InitIOBuffer(&buffers[Nclients], 256);
@@ -42,4 +42,5 @@
   fd_set fdSet;
   struct timeval timeout;
+  IOBuffer *outbuffer;
 
   InitClients ();
@@ -50,7 +51,7 @@
     for (i = 0; i < Ncurrent; i++) {
       ExpectMessage (clients[i], 0.25, &buffers[i]);
-      if (DEBUG) fprintf (stderr, "read %d from client %d\n", buffers[i].Nbuffer, i);
+      if (DEBUG) gprint (GP_ERR, "read %d from client %d\n", buffers[i].Nbuffer, i);
       if (buffers[i].Nbuffer) {
-	if (DEBUG) fprintf (stderr, "%s\n", buffers[i].buffer);
+	if (DEBUG) gprint (GP_ERR, "%s\n", buffers[i].buffer);
       }
     }
@@ -73,7 +74,7 @@
       FD_SET (clients[i], &fdSet);
       if (FD_ISSET(clients[i], &fdSet)) {
-	if (DEBUG) fprintf (stderr, "fd %d is set\n", clients[i]);
+	if (DEBUG) gprint (GP_ERR, "fd %d is set\n", clients[i]);
       } else {
-	if (DEBUG) fprintf (stderr, "fd %d is not set\n", clients[i]);
+	if (DEBUG) gprint (GP_ERR, "fd %d is not set\n", clients[i]);
       }
     }    
@@ -81,8 +82,8 @@
 
     /* block until we have some data on the pipes (or timeout) */
-    if (DEBUG) fprintf (stderr, "listening to %d clients\n", Ncurrent);
+    if (DEBUG) gprint (GP_ERR, "listening to %d clients\n", Ncurrent);
     status = select (Nmax, &fdSet, NULL, NULL, &timeout);
 
-    if (DEBUG) fprintf (stderr, "messages from %d clients\n", status);
+    if (DEBUG) gprint (GP_ERR, "messages from %d clients\n", status);
 
     if (status == -1) {
@@ -99,9 +100,10 @@
 
       /* this client has data, handle it */
-      if (DEBUG) fprintf (stderr, "data from client %d\n", clients[i]);
-
-      if (DEBUG) fprintf (stderr, "start: ", buffers[i].buffer);
-      fwrite (buffers[i].buffer, 1, buffers[i].Nbuffer, stderr);
-      if (DEBUG) fprintf (stderr, "...\n");
+      if (DEBUG) { 
+	gprint (GP_ERR, "data from client %d\n", clients[i]);
+	gprint (GP_ERR, "start: ", buffers[i].buffer);
+	gwrite (buffers[i].buffer, 1, buffers[i].Nbuffer, GP_ERR);
+	gprint (GP_ERR, "...\n");
+      }
 	
       /* read until the pipe is empty: -1 is empty, -2 is error */
@@ -109,17 +111,17 @@
       while (Nread >= 0) {
 	Nread = ReadtoIOBuffer (&buffers[i], clients[i]);	
-	if (DEBUG) fprintf (stderr, "read %d bytes from socket\n", Nread);
+	if (DEBUG) gprint (GP_ERR, "read %d bytes from socket\n", Nread);
 
 	if (Nread == -2) {
 	  /* error: do something */
-	  if (1) fprintf (stderr, "error reading from socket\n");
+	  if (1) gprint (GP_ERR, "error reading from socket\n");
 	}
       }
-      if (DEBUG) fprintf (stderr, "read %d total bytes\n", buffers[i].Nbuffer);
+      if (DEBUG) gprint (GP_ERR, "read %d total bytes\n", buffers[i].Nbuffer);
 
       if (DEBUG) { 
-	fprintf (stderr, "end: ", buffers[i].buffer);
-	fwrite (buffers[i].buffer, 1, buffers[i].Nbuffer, stderr);
-	fprintf (stderr, "...\n");
+	gprint (GP_ERR, "end: ", buffers[i].buffer);
+	gwrite (buffers[i].buffer, 1, buffers[i].Nbuffer, GP_ERR);
+	gprint (GP_ERR, "...\n");
       }
 	
@@ -129,11 +131,22 @@
 
       /* we now have a possible command from the client: run it */
+      /* XXX : we need to handle ; in the client-parsing of commands */
       stripwhite (line);
       if (*line) {
-	if (1) fprintf (stderr, "got command: %s\n", line);
+	if (1) gprint (GP_ERR, "got command: %s\n", line);
+	SetOutBuffer ();
 	status = multicommand (line);
+	outbuffer = GetOutBuffer ();
+
+	gprint (GP_ERR, "send message: %d bytes\n", outbuffer[0].Nbuffer);
+	gwrite (outbuffer[0].buffer, 1, outbuffer[0].Nbuffer, GP_ERR);
+	gprint (GP_ERR, "end message\n");
+	
+	SendMessage (clients[i], outbuffer[0].buffer);
+	SetOutfile ("stdout");
       }
       free (line);
 
+      
       /* this function should return the output buffer 
 	 to the currently selected client */
Index: trunk/Ohana/src/opihi/pantasks/LocalJob.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/LocalJob.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/LocalJob.c	(revision 7917)
@@ -24,5 +24,5 @@
     switch (Nread) {
       case -2:  /* error in read (programming error?  system level error?) */
-	fprintf (stderr, "serious IO error\n");
+	gprint (GP_ERR, "serious IO error\n");
 	exit (2);
       case -1:  /* no data in pipe */
@@ -36,5 +36,5 @@
     switch (Nread) {
       case -2:  /* error in read (programming error?  system level error?) */
-	fprintf (stderr, "serious IO error\n");
+	gprint (GP_ERR, "serious IO error\n");
 	exit (2);
       case -1:  /* no data in pipe */
@@ -57,17 +57,17 @@
       switch (errno) {
 	case ECHILD:
-	  fprintf (stderr, "unknown PID, not a child proc\n");
-	  fprintf (stderr, "did process already exit?  programming error?\n");
+	  gprint (GP_ERR, "unknown PID, not a child proc\n");
+	  gprint (GP_ERR, "did process already exit?  programming error?\n");
 	  job[0].state = JOB_NONE;
 	  job[0].exit_status = 0;
 	  return (FALSE);
 	case EINVAL:
-	  fprintf (stderr, "error EINVAL (waitpid): programming error\n");
+	  gprint (GP_ERR, "error EINVAL (waitpid): programming error\n");
 	  exit (1);
 	case EINTR:
-	  fprintf (stderr, "error EINTR (waitpid): programming error\n");
+	  gprint (GP_ERR, "error EINTR (waitpid): programming error\n");
 	  exit (1);
 	default:
-	  fprintf (stderr, "unknown error for waitpid (%d): programming error\n", errno);
+	  gprint (GP_ERR, "unknown error for waitpid (%d): programming error\n", errno);
 	  exit (1);
       }
@@ -81,5 +81,5 @@
     default:
       if (result != job[0].pid) {
-	fprintf (stderr, "waitpid error: mis-matched PID (%d vs %d).  programming error\n", result, job[0].pid);
+	gprint (GP_ERR, "waitpid error: mis-matched PID (%d vs %d).  programming error\n", result, job[0].pid);
 	exit (1);
       }
@@ -93,5 +93,5 @@
       }
       if (WIFSTOPPED(waitstatus)) {
-	fprintf (stderr, "waitpid returns 'stopped': programming error\n");
+	gprint (GP_ERR, "waitpid returns 'stopped': programming error\n");
 	exit (1);
       }
@@ -114,5 +114,5 @@
   pid = fork ();
   if (!pid) { /* must be child process */
-    if (VerboseMode()) fprintf (stderr, "starting local job\n");
+    if (VerboseMode()) gprint (GP_ERR, "starting local job\n");
 
     /* close the other ends of the pipes */
Index: trunk/Ohana/src/opihi/pantasks/Makefile
===================================================================
--- trunk/Ohana/src/opihi/pantasks/Makefile	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/Makefile	(revision 7917)
@@ -19,5 +19,5 @@
 # link flags 
 LIBS    = 	-L$(LIB) -L$(LLIB) -L$(XLIB)
-LIBS1   =       -lsocket -lnsl -lreadline $(TLIB) -ldvo -lkapa -lFITS -lohana -lX11 -lm
+LIBS1   =       -lsocket -lnsl -lreadline $(TLIB) -ldvo -lkapa -lFITS -lohana -lX11 -lpthread -lm
 LIBS2   =       -lbasiccmd -ldatacmd -lastrocmd -lshell -ldata 
 LFLAGS  =       $(LIBS) $(LIBS2) $(LIBS1) 
@@ -94,5 +94,5 @@
 $(BIN)/pantasks_server.$(ARCH) : $(server) $(funcs) $(cmds) $(libs)
 	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
-	$(CC) -o $@ $^ $(LFLAGS) -lpthread
+	$(CC) -o $@ $^ $(LFLAGS)
 
 pantasks_client.install: $(DESTBIN)/pantasks_client
Index: trunk/Ohana/src/opihi/pantasks/SocketOps.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/SocketOps.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/SocketOps.c	(revision 7917)
@@ -33,5 +33,5 @@
   status = inet_aton (hostip, &Address[0].sin_addr);
   if (!status) {
-    fprintf (stderr, "invalid address\n");
+    gprint (GP_ERR, "invalid address\n");
     exit (2);
   }
@@ -46,5 +46,5 @@
   }
 
-  if (DEBUG) fprintf (stderr, "init sock: %d, len: %d\n", InitSocket, length);
+  if (DEBUG) gprint (GP_ERR, "init sock: %d, len: %d\n", InitSocket, length);
   status = bind (InitSocket, (struct sockaddr *) Address, length);
   if (status == -1) {
@@ -74,7 +74,7 @@
   fcntl (InitSocket, F_SETFL, !O_NONBLOCK); 
 
-  if (DEBUG) fprintf (stderr, "init sock: %d, len: %d\n", InitSocket, length);
+  if (DEBUG) gprint (GP_ERR, "init sock: %d, len: %d\n", InitSocket, length);
   BindSocket = accept (InitSocket, (struct sockaddr *) &Address_in, &length);
-  if (DEBUG) fprintf (stderr, "bind sock: %d\n", BindSocket);
+  if (DEBUG) gprint (GP_ERR, "bind sock: %d\n", BindSocket);
   if (BindSocket == -1) {
     perror ("accept: ");
@@ -84,10 +84,10 @@
   addr = Address_in.sin_addr.s_addr;
   if (DEBUG) {
-    fprintf (stderr, "incoming connection from: ");
-    fprintf (stderr, " %u", (0xff & (addr >>  0)));
-    fprintf (stderr, ".%u", (0xff & (addr >>  8)));
-    fprintf (stderr, ".%u", (0xff & (addr >> 16)));
-    fprintf (stderr, ".%u", (0xff & (addr >> 24)));
-    fprintf (stderr, "\n");
+    gprint (GP_ERR, "incoming connection from: ");
+    gprint (GP_ERR, " %u", (0xff & (addr >>  0)));
+    gprint (GP_ERR, ".%u", (0xff & (addr >>  8)));
+    gprint (GP_ERR, ".%u", (0xff & (addr >> 16)));
+    gprint (GP_ERR, ".%u", (0xff & (addr >> 24)));
+    gprint (GP_ERR, "\n");
   }
 
@@ -109,10 +109,10 @@
   }
 
-  if (DEBUG) fprintf (stderr, "connection rejected\n");
+  if (DEBUG) gprint (GP_ERR, "connection rejected\n");
   close (BindSocket);
   return (-1);
 
 accepted:
-  if (DEBUG) fprintf (stderr, "connection accepted\n");
+  if (DEBUG) gprint (GP_ERR, "connection accepted\n");
   fcntl (BindSocket, F_SETFL, O_NONBLOCK); 
   return (BindSocket);
@@ -135,5 +135,5 @@
 
   if (DEBUG) {
-    fprintf (stderr, "trying %s (%s:%d)...", host[0].h_name, hostip, MY_PORT);
+    gprint (GP_ERR, "trying %s (%s:%d)...", host[0].h_name, hostip, MY_PORT);
   }
 
@@ -142,5 +142,5 @@
   status = inet_aton (hostip, &Address.sin_addr);
   if (!status) {
-    fprintf (stderr, "invalid address\n");
+    gprint (GP_ERR, "invalid address\n");
     exit (2);
   }
@@ -160,5 +160,5 @@
   }
 
-  if (DEBUG) fprintf (stderr, "connected\n");
+  if (DEBUG) gprint (GP_ERR, "connected\n");
   fcntl (InitSocket, F_SETFL, O_NONBLOCK); 
   return (InitSocket);
@@ -183,5 +183,5 @@
   status = inet_aton (hostip, &Address[0].sin_addr);
   if (!status) {
-    fprintf (stderr, "invalid address\n");
+    gprint (GP_ERR, "invalid address\n");
     exit (2);
   }
@@ -195,5 +195,5 @@
   }
 
-  if (DEBUG) fprintf (stderr, "init sock: %d, len: %d\n", InitSocket, length);
+  if (DEBUG) gprint (GP_ERR, "init sock: %d, len: %d\n", InitSocket, length);
   status = bind (InitSocket, (struct sockaddr *) Address, length);
   if (status == -1) {
@@ -208,5 +208,5 @@
   }
 
-  if (DEBUG) fprintf (stderr, "socket listening on %s (%s:%d)\n", host[0].h_name, hostip, MY_PORT);
+  if (DEBUG) gprint (GP_ERR, "socket listening on %s (%s:%d)\n", host[0].h_name, hostip, MY_PORT);
   return (InitSocket);
 }
@@ -230,5 +230,5 @@
     test &= ((ip4 >=0) && (ip4 < 256)); 
     if (!test) {
-      fprintf (stderr, "invalid IP address %s\n", string);
+      gprint (GP_ERR, "invalid IP address %s\n", string);
       exit (2);
     }
Index: trunk/Ohana/src/opihi/pantasks/TaskOps.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/TaskOps.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/TaskOps.c	(revision 7917)
@@ -54,40 +54,40 @@
   int i, valid;
 
-  fprintf (stderr, "\n");
+  gprint (GP_LOG, "\n");
   if (Ntasks == 0) {
-    fprintf (stderr, " no defined tasks\n");
+    gprint (GP_LOG, " no defined tasks\n");
     return;
   }
 
-  fprintf (stderr, " Task Status\n");
-  fprintf (stderr, "  * Name            Njobs  Command\n");
+  gprint (GP_LOG, " Task Status\n");
+  gprint (GP_LOG, "  * Name            Njobs  Command\n");
   for (i = 0; i < Ntasks; i++) {
     valid = CheckTimeRanges (tasks[i][0].ranges, tasks[i][0].Nranges);
-    if (verbose) fprintf (stderr, "\n");
+    if (verbose) gprint (GP_LOG, "\n");
     if (valid) {
-      fprintf (stderr, "  + ");
+      gprint (GP_LOG, "  + ");
     } else {
-      fprintf (stderr, "  - ");
+      gprint (GP_LOG, "  - ");
     }
     if (tasks[i][0].argv == NULL) {
-      fprintf (stderr, "%-15s %5d  %-20s\n", tasks[i][0].name, tasks[i][0].Njobs, "(dynamic)");
+      gprint (GP_LOG, "%-15s %5d  %-20s\n", tasks[i][0].name, tasks[i][0].Njobs, "(dynamic)");
     } else {
-      fprintf (stderr, "%-15s %5d  %-20s\n", tasks[i][0].name, tasks[i][0].Njobs, tasks[i][0].argv[0]);
+      gprint (GP_LOG, "%-15s %5d  %-20s\n", tasks[i][0].name, tasks[i][0].Njobs, tasks[i][0].argv[0]);
     }
     if (verbose) {
-      fprintf (stderr, "    spawn period: %f, polling period: %f, timeout period: %f\n", 
+      gprint (GP_LOG, "    spawn period: %f, polling period: %f, timeout period: %f\n", 
 	       tasks[i][0].exec_period, tasks[i][0].poll_period, tasks[i][0].timeout_period);
       if (tasks[i][0].host == NULL) {
-	fprintf (stderr, "    task runs locally\n");
+	gprint (GP_LOG, "    task runs locally\n");
 	continue;
       }
       if (!strcasecmp(tasks[i][0].host, "ANYHOST")) {
-	fprintf (stderr, "    task host selected by controller\n");
+	gprint (GP_LOG, "    task host selected by controller\n");
 	continue;
       }
       if (tasks[i][0].host_required) {
-	fprintf (stderr, "    host %s (required)\n", tasks[i][0].host);
+	gprint (GP_LOG, "    host %s (required)\n", tasks[i][0].host);
       } else {
-	fprintf (stderr, "    host %s (desired)\n", tasks[i][0].host);
+	gprint (GP_LOG, "    host %s (desired)\n", tasks[i][0].host);
       }
     }
@@ -104,48 +104,48 @@
   task = FindTask (name);
   if (task == NULL) {
-    fprintf (stderr, "task %s not found\n", name);
+    gprint (GP_LOG, "task %s not found\n", name);
     return (FALSE);
   }
 
-  fprintf (stderr, "\n macro %s\n", task[0].name);
-
-  fprintf (stderr, "\n command: ");
+  gprint (GP_LOG, "\n macro %s\n", task[0].name);
+
+  gprint (GP_LOG, "\n command: ");
   for (i = 0; i < task[0].argc; i++) {
-    fprintf (stderr, "%s ", task[0].argv[i]);
-  }
-  fprintf (stderr, "\n\n");
+    gprint (GP_LOG, "%s ", task[0].argv[i]);
+  }
+  gprint (GP_LOG, "\n\n");
 
   if (task[0].host == NULL) {
-    fprintf (stderr, " task runs locally\n");
+    gprint (GP_LOG, " task runs locally\n");
     goto periods;
   }
   if (!strcasecmp(task[0].host, "ANYHOST")) {
-    fprintf (stderr, " task host selected by controller\n");
+    gprint (GP_LOG, " task host selected by controller\n");
     goto periods;
   }
   if (task[0].host_required) {
-    fprintf (stderr, " host %s (required)\n", task[0].host);
+    gprint (GP_LOG, " host %s (required)\n", task[0].host);
   } else {
-    fprintf (stderr, " host %s (desired)\n", task[0].host);
+    gprint (GP_LOG, " host %s (desired)\n", task[0].host);
   }
 
 periods:
-  fprintf (stderr, " time periods: exec: %f  poll: %f  timeout: %f\n", 
+  gprint (GP_LOG, " time periods: exec: %f  poll: %f  timeout: %f\n", 
 	   task[0].exec_period, task[0].poll_period, task[0].timeout_period);
 
-  fprintf (stderr, "\n pre-execute macro\n");
+  gprint (GP_LOG, "\n pre-execute macro\n");
   ListMacro (task[0].exec);
 
-  fprintf (stderr, "\n timeout macro\n");
+  gprint (GP_LOG, "\n timeout macro\n");
   ListMacro (task[0].timeout);
 
-  fprintf (stderr, "\n crash macro\n");
+  gprint (GP_LOG, "\n crash macro\n");
   ListMacro (task[0].crash);
 
-  fprintf (stderr, "\n default exit macro\n");
+  gprint (GP_LOG, "\n default exit macro\n");
   ListMacro (task[0].defexit);
 
   for (i = 0; i < task[0].Nexit; i++) {
-    fprintf (stderr, "\n exit macro (status == %d)\n", atoi(task[0].exit[i][0].name));
+    gprint (GP_LOG, "\n exit macro (status == %d)\n", atoi(task[0].exit[i][0].name));
     ListMacro (task[0].exit[i]);
   }
@@ -252,5 +252,5 @@
   }
   if (Nt == -1) {
-    fprintf (stderr, "programming error: task not found\n");
+    gprint (GP_ERR, "programming error: task not found\n");
     return (FALSE);
   }
@@ -269,5 +269,5 @@
   if (task[0].argc != 0) {
     if (task[0].argv == NULL) {
-      fprintf (stderr, "task command arguments not defined (programming error)\n");
+      gprint (GP_ERR, "task command arguments not defined (programming error)\n");
       return (FALSE);
     }
@@ -275,5 +275,5 @@
   }
   if (RequireStatic) {
-    fprintf (stderr, "task command not defined\n");
+    gprint (GP_ERR, "task command not defined\n");
     return (FALSE);
   }
@@ -286,5 +286,5 @@
     }
   }
-  fprintf (stderr, "task command not defined\n");
+  gprint (GP_ERR, "task command not defined\n");
   return (FALSE);
 }
Index: trunk/Ohana/src/opihi/pantasks/client_shell.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/client_shell.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/client_shell.c	(revision 7917)
@@ -19,5 +19,5 @@
   /* connect to the server */
   if (VarConfig ("PANTASKS_SERVER", "%s", hostname) == NULL) {
-    fprintf (stderr, "pantasks server host undefined\n");
+    gprint (GP_ERR, "pantasks server host undefined\n");
     exit (2);
   }
@@ -38,9 +38,9 @@
       ppid = getppid();
       if (ppid == 1) {
-	fprintf (stderr, "caught parent shutdown\n");
+	gprint (GP_ERR, "caught parent shutdown\n");
 	exit (2);
       }
       if (!isatty (STDIN_FILENO)) exit (2);
-      fprintf (stdout, "Use \"quit\" to exit\n");
+      gprint (GP_ERR, "Use \"quit\" to exit\n");
       Nbad ++;
       continue;
@@ -57,5 +57,5 @@
     status = command (line, &outline);
     if (outline == NULL) {
-      fprintf (stderr, "programming error: command_client returned NULL\n");
+      gprint (GP_ERR, "programming error: command_client returned NULL\n");
       exit (2);
     }
@@ -63,5 +63,5 @@
     /* command was not caught by client, send to server */
     if (*outline && !status ) {
-      fprintf (stderr, "sending message to %d: %s\n", server, outline);
+      gprint (GP_ERR, "sending message to %d: %s\n", server, outline);
       SendMessage (server, outline);
       add_history (outline);
@@ -69,5 +69,8 @@
 
       // XXX add this in and print to stdout
-      // status = ExpectMessage (server, 2.0, &message);
+      status = ExpectMessage (server, 2.0, &message);
+      gprint (GP_ERR, "got message: %d bytes\n", message.Nbuffer);
+      gwrite (message.buffer, 1, message.Nbuffer, GP_ERR);
+      gprint (GP_ERR, "end message\n");
     }
     free (outline);
Index: trunk/Ohana/src/opihi/pantasks/controller.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/controller.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/controller.c	(revision 7917)
@@ -23,5 +23,5 @@
 
   if (argc < 2) {
-    fprintf (stderr, "USAGE: controller (command) ... \n");
+    gprint (GP_ERR, "USAGE: controller (command) ... \n");
     return (FALSE);
   }
@@ -29,5 +29,5 @@
   func = FindControllerCommand (argv[1]);
   if (func == NULL) {
-    fprintf (stderr, "invalid controller command\n");
+    gprint (GP_ERR, "invalid controller command\n");
     return (FALSE);
   }
Index: trunk/Ohana/src/opihi/pantasks/controller_check.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/controller_check.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/controller_check.c	(revision 7917)
@@ -14,5 +14,5 @@
   status = CheckControllerStatus ();
   if (!status) {
-    fprintf (stderr, "controller is not running\n");
+    gprint (GP_LOG, "controller is not running\n");
     return (TRUE);
   }
@@ -22,7 +22,7 @@
   status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer);
   if (VerboseMode()) {
-    fprintf (stderr, "controller command sent\n");  
-    fwrite (buffer.buffer, 1, buffer.Nbuffer, stderr);
-    fprintf (stderr, "\n Nbytes received: %d\n", buffer.Nbuffer);  
+    gprint (GP_LOG, "controller command sent\n");  
+    gwrite (buffer.buffer, 1, buffer.Nbuffer, GP_LOG);
+    gprint (GP_LOG, "\n Nbytes received: %d\n", buffer.Nbuffer);  
   }
   FreeIOBuffer (&buffer);
@@ -30,6 +30,6 @@
 
 usage:
-  fprintf (stderr, "USAGE: controller check job (jobID)\n");
-  fprintf (stderr, "USAGE: controller check host (hostID)\n");
+  gprint (GP_ERR, "USAGE: controller check job (jobID)\n");
+  gprint (GP_ERR, "USAGE: controller check host (hostID)\n");
   return (FALSE);
 }
Index: trunk/Ohana/src/opihi/pantasks/controller_exit.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/controller_exit.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/controller_exit.c	(revision 7917)
@@ -4,5 +4,5 @@
 
   if (argc != 2) {
-    fprintf (stderr, "USAGE: controller exit TRUE\n");
+    gprint (GP_ERR, "USAGE: controller exit TRUE\n");
     return (FALSE);
   }
Index: trunk/Ohana/src/opihi/pantasks/controller_host.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/controller_host.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/controller_host.c	(revision 7917)
@@ -8,5 +8,5 @@
 
   if (argc != 3) {
-    fprintf (stderr, "USAGE: controller host (command) (hostname)\n");
+    gprint (GP_ERR, "USAGE: controller host (command) (hostname)\n");
     return (FALSE);
   }
@@ -18,5 +18,5 @@
   InitIOBuffer (&buffer, 0x100);
   status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer);
-  if (status) fwrite (buffer.buffer, 1, buffer.Nbuffer, stderr);
+  if (status) gwrite (buffer.buffer, 1, buffer.Nbuffer, GP_LOG);
   FreeIOBuffer (&buffer);
   return (TRUE);
Index: trunk/Ohana/src/opihi/pantasks/controller_output.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/controller_output.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/controller_output.c	(revision 7917)
@@ -4,5 +4,5 @@
 
   if (argc != 1) {
-    fprintf (stderr, "USAGE: controller status\n");
+    gprint (GP_ERR, "USAGE: controller status\n");
     return (FALSE);
   }
Index: trunk/Ohana/src/opihi/pantasks/controller_pulse.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/controller_pulse.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/controller_pulse.c	(revision 7917)
@@ -8,5 +8,5 @@
 
   if (argc != 2) {
-    fprintf (stderr, "USAGE: controller pulse (usec)\n");
+    gprint (GP_ERR, "USAGE: controller pulse (usec)\n");
     return (FALSE);
   }
@@ -18,5 +18,5 @@
   InitIOBuffer (&buffer, 0x100);
   status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer);
-  if (status) fwrite (buffer.buffer, 1, buffer.Nbuffer, stderr);
+  if (status) gwrite (buffer.buffer, 1, buffer.Nbuffer, GP_LOG);
   FreeIOBuffer (&buffer);
   return (TRUE);
Index: trunk/Ohana/src/opihi/pantasks/controller_status.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/controller_status.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/controller_status.c	(revision 7917)
@@ -8,5 +8,5 @@
 
   if (argc != 1) {
-    fprintf (stderr, "USAGE: controller status\n");
+    gprint (GP_ERR, "USAGE: controller status\n");
     return (FALSE);
   }
@@ -15,5 +15,5 @@
   status = CheckControllerStatus ();
   if (!status) {
-    fprintf (stderr, "controller is not running\n");
+    gprint (GP_LOG, "controller is not running\n");
     return (TRUE);
   }
@@ -23,7 +23,7 @@
   status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer);
   if (status) {
-    fwrite (buffer.buffer, 1, buffer.Nbuffer, stderr);
+    gwrite (buffer.buffer, 1, buffer.Nbuffer, GP_LOG);
   } else {
-    fprintf (stderr, "controller is down\n");
+    gprint (GP_LOG, "controller is down\n");
   }
   FreeIOBuffer (&buffer);
Index: trunk/Ohana/src/opihi/pantasks/delete.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/delete.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/delete.c	(revision 7917)
@@ -6,5 +6,5 @@
 
   if (argc < 2) {
-    fprintf (stderr, "USAGE: delete (JobID)\n");
+    gprint (GP_ERR, "USAGE: delete (JobID)\n");
     return (FALSE);
   }
@@ -12,5 +12,5 @@
   /* use a string interp to convert JobIDs to ints ? */
 
-  fprintf (stderr, "this function is not yet implemented\n");
+  gprint (GP_ERR, "this function is not yet implemented\n");
   return (TRUE);
 }
Index: trunk/Ohana/src/opihi/pantasks/invalid.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/invalid.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/invalid.c	(revision 7917)
@@ -3,5 +3,5 @@
 int invalid (int argc, char **argv) {
 
-  fprintf (stderr, "%s is not valid for the pantasks client\n", argv[0]);
+  gprint (GP_ERR, "%s is not valid for the pantasks client\n", argv[0]);
   return (TRUE);
 
Index: trunk/Ohana/src/opihi/pantasks/job.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/job.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/job.c	(revision 7917)
@@ -33,5 +33,5 @@
   if ((N = get_argument (argc, argv, "+host"))) {
     if (Mode == PCONTROL_JOB_WANTHOST) {
-      fprintf (stderr, "ERROR: -host and +host are incompatible\n");
+      gprint (GP_ERR, "ERROR: -host and +host are incompatible\n");
       FREE (Host);
       return (FALSE);
@@ -52,5 +52,5 @@
 
   if (argc < 2) {
-    fprintf (stderr, "USAGE: job [options] (arg0) (arg1) ... (argN)\n");
+    gprint (GP_ERR, "USAGE: job [options] (arg0) (arg1) ... (argN)\n");
     FREE (Host);
     return (FALSE);
@@ -64,5 +64,5 @@
 
   JobID = AddJob (Host, Mode, Timeout, targc, targv);
-  fprintf (stdout, "JobID: %d\n", JobID);
+  gprint (GP_LOG, "JobID: %d\n", JobID);
   return (TRUE);
 }
Index: trunk/Ohana/src/opihi/pantasks/kill.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/kill.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/kill.c	(revision 7917)
@@ -7,5 +7,5 @@
 
   if (argc < 2) {
-    fprintf (stderr, "USAGE: kill (JobID)\n");
+    gprint (GP_ERR, "USAGE: kill (JobID)\n");
     return (FALSE);
   }
@@ -17,5 +17,5 @@
     if (!KillLocalJob (job)) {
       job[0].state = JOB_HUNG;
-      if (VerboseMode()) fprintf (stderr, "child process %d is hung, cannot kill\n", job[0].pid);
+      if (VerboseMode()) gprint (GP_LOG, "child process %d is hung, cannot kill\n", job[0].pid);
       return (FALSE);
     }
@@ -23,10 +23,10 @@
     if (!KillControllerJob (job)) {
       job[0].state = JOB_HUNG;
-      if (VerboseMode()) fprintf (stderr, "child process %d is hung, cannot kill\n", job[0].pid);
+      if (VerboseMode()) gprint (GP_LOG, "child process %d is hung, cannot kill\n", job[0].pid);
       return (FALSE);
     }
   }    
     
-  fprintf (stderr, "this function is not yet implemented\n");
+  gprint (GP_ERR, "this function is not yet implemented\n");
   return (TRUE);
 }
Index: trunk/Ohana/src/opihi/pantasks/pantasks.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/pantasks.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/pantasks.c	(revision 7917)
@@ -38,6 +38,6 @@
 /* standard welcome message */
 void welcome () {
-  fprintf (stderr, "\n");
-  fprintf (stderr, "Welcome to %s - %s\n\n", opihi_name, opihi_description);
+  gprint (GP_LOG, "\n");
+  gprint (GP_LOG, "Welcome to %s - %s\n\n", opihi_name, opihi_description);
 }
 
@@ -51,5 +51,5 @@
 
 void gotsignal (int signum) {
-  fprintf (stderr, "got signal : %d\n", signum);
+  gprint (GP_ERR, "got signal : %d\n", signum);
   return;
 }
Index: trunk/Ohana/src/opihi/pantasks/pantasks_client.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/pantasks_client.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/pantasks_client.c	(revision 7917)
@@ -38,6 +38,6 @@
 /* standard welcome message */
 void welcome () {
-  fprintf (stderr, "\n");
-  fprintf (stderr, "Welcome to %s - %s\n\n", opihi_name, opihi_description);
+  gprint (GP_LOG, "\n");
+  gprint (GP_LOG, "Welcome to %s - %s\n\n", opihi_name, opihi_description);
 }
 
@@ -54,5 +54,5 @@
 /* default signal handling */
 void gotsignal (int signum) {
-  fprintf (stderr, "got signal : %d\n", signum);
+  gprint (GP_ERR, "got signal : %d\n", signum);
   return;
 }
Index: trunk/Ohana/src/opihi/pantasks/pantasks_server.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/pantasks_server.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/pantasks_server.c	(revision 7917)
@@ -30,4 +30,6 @@
   InitData ();
   InitPantasks ();
+  
+  InitPrint ();
 
   // signal (SIGPIPE, gotsignal);
@@ -77,5 +79,5 @@
 
 void gotsignal (int signum) {
-  fprintf (stderr, "got signal : %d\n", signum);
+  gprint (GP_ERR, "got signal : %d\n", signum);
   return;
 }
Index: trunk/Ohana/src/opihi/pantasks/pulse.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/pulse.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/pulse.c	(revision 7917)
@@ -6,5 +6,5 @@
 
   if (argc != 2) {
-    fprintf (stderr, "USAGE: pulse (microseconds)\n");
+    gprint (GP_ERR, "USAGE: pulse (microseconds)\n");
     return (FALSE);
   }
Index: trunk/Ohana/src/opihi/pantasks/run.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/run.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/run.c	(revision 7917)
@@ -4,5 +4,5 @@
 
   if (argc != 1) {
-    fprintf (stderr, "USAGE: run\n");
+    gprint (GP_ERR, "USAGE: run\n");
     return (FALSE);
   }
Index: trunk/Ohana/src/opihi/pantasks/scheduler.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/scheduler.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/scheduler.c	(revision 7917)
@@ -52,5 +52,5 @@
     f = fopen (opihi_history, "a");
     if (f == NULL) /* no current history file here */
-      fprintf (stderr, "can't save history.\n");
+      gprint (GP_ERR, "can't save history.\n");
     else
       fclose (f);
@@ -65,6 +65,6 @@
 /* standard welcome message */
 void welcome () {
-  fprintf (stderr, "\n");
-  fprintf (stderr, "Welcome to %s - %s\n\n", opihi_name, opihi_description);
+  gprint (GP_LOG, "\n");
+  gprint (GP_LOG, "Welcome to %s - %s\n\n", opihi_name, opihi_description);
 }
 
Index: trunk/Ohana/src/opihi/pantasks/status.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/status.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/status.c	(revision 7917)
@@ -3,14 +3,14 @@
 int status_sys (int argc, char **argv) {
 
-  fprintf (stderr, "\n");
+  gprint (GP_LOG, "\n");
   if (rl_event_hook == NULL) {
-    fprintf (stderr, " Scheduler is stopped\n");
+    gprint (GP_LOG, " Scheduler is stopped\n");
   } else {
-    fprintf (stderr, " Scheduler is running\n");
+    gprint (GP_LOG, " Scheduler is running\n");
   }
   if (CheckControllerStatus ()) {
-    fprintf (stderr, " Controller is running\n");
+    gprint (GP_LOG, " Controller is running\n");
   } else {
-    fprintf (stderr, " Controller is stopped\n");
+    gprint (GP_LOG, " Controller is stopped\n");
   }
   ListTasks (FALSE);
Index: trunk/Ohana/src/opihi/pantasks/stop.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/stop.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/stop.c	(revision 7917)
@@ -4,5 +4,5 @@
 
   if (argc != 1) {
-    fprintf (stderr, "USAGE: stop\n");
+    gprint (GP_ERR, "USAGE: stop\n");
     return (FALSE);
   }
Index: trunk/Ohana/src/opihi/pantasks/task.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/task.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/task.c	(revision 7917)
@@ -28,6 +28,6 @@
 
   if (argc != 2) {
-    fprintf (stderr, "USAGE: task <name>\n");
-    fprintf (stderr, "  (enter commands & task functions; end with the word 'END')\n");
+    gprint (GP_ERR, "USAGE: task <name>\n");
+    gprint (GP_ERR, "  (enter commands & task functions; end with the word 'END')\n");
     return (FALSE);
   }
@@ -58,9 +58,9 @@
 
     if ((ThisList == 0) && (input == (char *) NULL)) {
-      fprintf (stderr, "end task with 'END'\n");
+      gprint (GP_ERR, "end task with 'END'\n");
       continue;
     }
     if ((ThisList > 0) && (input == (char *) NULL)) {
-      fprintf (stderr, "missing 'END' in task definition\n");
+      gprint (GP_ERR, "missing 'END' in task definition\n");
       input = strcreate ("end");
     }
@@ -103,5 +103,5 @@
 
       case TASK_NONE:
-	fprintf (stderr, "unknown task command %s\n", input);
+	gprint (GP_ERR, "unknown task command %s\n", input);
 	break;
     }
Index: trunk/Ohana/src/opihi/pantasks/task_command.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/task_command.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/task_command.c	(revision 7917)
@@ -7,6 +7,6 @@
 
   if (argc < 2) {
-    fprintf (stderr, "USAGE: command <command> <arg>. ..\n");
-    fprintf (stderr, "  (define command for this task)\n");
+    gprint (GP_ERR, "USAGE: command <command> <arg>. ..\n");
+    gprint (GP_ERR, "  (define command for this task)\n");
     return (FALSE);
   }
@@ -16,5 +16,5 @@
     task = GetActiveTask ();
     if (task == NULL) {
-      fprintf (stderr, "ERROR: not defining or running a task\n");
+      gprint (GP_ERR, "ERROR: not defining or running a task\n");
       return (FALSE);
     }
Index: trunk/Ohana/src/opihi/pantasks/task_host.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/task_host.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/task_host.c	(revision 7917)
@@ -13,9 +13,9 @@
 
   if (argc != 2) {
-    fprintf (stderr, "USAGE: host <name> [-required]\n");
-    fprintf (stderr, "  define host machine for this task\n");
-    fprintf (stderr, "  -required flags indicates controller must use this host\n");
-    fprintf (stderr, "  value of 'local' for host indicates process not using controller\n");
-    fprintf (stderr, "  value of 'anyhost' for host indicates controller may assign at will\n");
+    gprint (GP_ERR, "USAGE: host <name> [-required]\n");
+    gprint (GP_ERR, "  define host machine for this task\n");
+    gprint (GP_ERR, "  -required flags indicates controller must use this host\n");
+    gprint (GP_ERR, "  value of 'local' for host indicates process not using controller\n");
+    gprint (GP_ERR, "  value of 'anyhost' for host indicates controller may assign at will\n");
     return (FALSE);
   }
@@ -25,5 +25,5 @@
     task = GetActiveTask ();
     if (task == NULL) {
-      fprintf (stderr, "ERROR: not defining or running a task\n");
+      gprint (GP_ERR, "ERROR: not defining or running a task\n");
       return (FALSE);
     }
Index: trunk/Ohana/src/opihi/pantasks/task_macros.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/task_macros.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/task_macros.c	(revision 7917)
@@ -11,12 +11,12 @@
 
   if (!strcmp (argv[0], "task.exec") && (argc != 1)) {
-    fprintf (stderr, "USAGE: task.exec\n");
-    fprintf (stderr, "  (define pre-exec macro for this task)\n");
+    gprint (GP_ERR, "USAGE: task.exec\n");
+    gprint (GP_ERR, "  (define pre-exec macro for this task)\n");
     return (FALSE);
   }
 
   if (!strcmp (argv[0], "task.exit") && (argc != 2)) {
-    fprintf (stderr, "USAGE: task.exit (state)\n");
-    fprintf (stderr, "  (define exit state macro for this task)\n");
+    gprint (GP_ERR, "USAGE: task.exit (state)\n");
+    gprint (GP_ERR, "  (define exit state macro for this task)\n");
     return (FALSE);
   }
@@ -24,5 +24,5 @@
   task = GetNewTask ();
   if (task == NULL) {
-    fprintf (stderr, "ERROR: not defining or running a task\n");
+    gprint (GP_ERR, "ERROR: not defining or running a task\n");
     return (FALSE);
   }
@@ -115,9 +115,9 @@
 
     if ((ThisList == 0) && (input == (char *) NULL)) {
-      fprintf (stderr, "end macro with 'END'\n");
+      gprint (GP_ERR, "end macro with 'END'\n");
       continue;
     }
     if ((ThisList > 0) && (input == (char *) NULL)) {
-      fprintf (stderr, "missing 'END' in macro definition\n");
+      gprint (GP_ERR, "missing 'END' in macro definition\n");
       input = strcreate ("end");
     }
Index: trunk/Ohana/src/opihi/pantasks/task_nmax.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/task_nmax.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/task_nmax.c	(revision 7917)
@@ -9,5 +9,5 @@
   task = GetNewTask ();
   if (task == NULL) {
-    fprintf (stderr, "ERROR: not defining or running a task\n");
+    gprint (GP_ERR, "ERROR: not defining or running a task\n");
     return (FALSE);
   }
@@ -17,5 +17,5 @@
 
 usage:
-  fprintf (stderr, "USAGE: nmax N\n");
+  gprint (GP_ERR, "USAGE: nmax N\n");
   return (FALSE);
 }
Index: trunk/Ohana/src/opihi/pantasks/task_periods.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/task_periods.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/task_periods.c	(revision 7917)
@@ -35,6 +35,6 @@
 
   if (argc != 1) {
-    fprintf (stderr, "USAGE: periods [-poll value] [-exec value] [-timeout value]\n");
-    fprintf (stderr, "  define time periods for this task\n");
+    gprint (GP_ERR, "USAGE: periods [-poll value] [-exec value] [-timeout value]\n");
+    gprint (GP_ERR, "  define time periods for this task\n");
     return (FALSE);
   }
@@ -44,5 +44,5 @@
     task = GetActiveTask ();
     if (task == NULL) {
-      fprintf (stderr, "ERROR: not defining or running a task\n");
+      gprint (GP_ERR, "ERROR: not defining or running a task\n");
       return (FALSE);
     }
Index: trunk/Ohana/src/opihi/pantasks/task_trange.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/task_trange.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/task_trange.c	(revision 7917)
@@ -25,5 +25,5 @@
   task = GetNewTask ();
   if (task == NULL) {
-    fprintf (stderr, "ERROR: not defining or running a task\n");
+    gprint (GP_ERR, "ERROR: not defining or running a task\n");
     return (FALSE);
   }
@@ -61,5 +61,5 @@
 
 usage:
-  fprintf (stderr, "USAGE: trange start end\n");
+  gprint (GP_ERR, "USAGE: trange start end\n");
   return (FALSE);
 }
Index: trunk/Ohana/src/opihi/pantasks/verbose.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/verbose.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/verbose.c	(revision 7917)
@@ -7,7 +7,7 @@
   if (argc == 1) {
     if (VERBOSE) {
-      fprintf (stderr, "verbose mode ON\n");
+      gprint (GP_LOG, "verbose mode ON\n");
     } else {
-      fprintf (stderr, "verbose mode OFF\n");
+      gprint (GP_LOG, "verbose mode OFF\n");
     }
     return (TRUE);
@@ -29,5 +29,5 @@
   }
 
-  fprintf (stderr, "USAGE: verbose (on/off/toggle)\n");
+  gprint (GP_ERR, "USAGE: verbose (on/off/toggle)\n");
   return (FALSE);
 }
Index: trunk/Ohana/src/opihi/pantasks/version.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/version.c	(revision 7892)
+++ trunk/Ohana/src/opihi/pantasks/version.c	(revision 7917)
@@ -4,11 +4,11 @@
 int version (int argc, char **argv) {
 
-  fprintf (stderr, "%s\n", name);
+  gprint (GP_LOG, "%s\n", name);
 
-  fprintf (stderr, "%s\n", opihi_version());
-  fprintf (stderr, "%s\n", ohana_version());
-  fprintf (stderr, "%s\n", gfits_version());
+  gprint (GP_LOG, "%s\n", opihi_version());
+  gprint (GP_LOG, "%s\n", ohana_version());
+  gprint (GP_LOG, "%s\n", gfits_version());
 
-  fprintf (stderr, "compiled on %s %s\n", __DATE__, __TIME__);
+  gprint (GP_LOG, "compiled on %s %s\n", __DATE__, __TIME__);
   return (TRUE);
 }
