Index: trunk/Ohana/src/opihi/pcontrol/JobID.c
===================================================================
--- trunk/Ohana/src/opihi/pcontrol/JobID.c	(revision 23553)
+++ 	(revision )
@@ -1,64 +1,0 @@
-# include "pcontrol.h"
-
-static IDtype CurrentJobID  = 0;
-static IDtype CurrentHostID = 0;
-
-/* for now, no persistence : we could use the date/time to seed the upper byte(s) if needed */
-void InitIDs () {
-  CurrentJobID = 0;
-  CurrentHostID = 0;
-}
-
-IDtype NextJobID () {
-
-  IDtype ID;
-
-  ID = CurrentJobID;
-  CurrentJobID ++;
-  return (ID);
-}
-
-IDtype NextHostID () {
-
-  IDtype ID;
-
-  ID = CurrentHostID;
-  CurrentHostID ++;
-  return (ID);
-}
-
-void PrintID (gpDest dest, IDtype ID) {
-
-  unsigned short int word0, word1, word2, word3;
-
-  word0 = 0xffff & ID;
-  word1 = 0xffff & (ID >> 16);
-  word2 = 0xffff & (ID >> 32);
-  word3 = 0xffff & (ID >> 48);
-
-  gprint (dest, "%x.%x.%x.%x", word3, word2, word1, word0);
-}
-
-IDtype GetID (char *IDword) {
-
-  int Nargs;
-  IDtype ID;
-  unsigned short int word0, word1, word2, word3;
-
-  Nargs = sscanf (IDword, "%x.%x.%x.%x", &word0, &word1, &word2, &word3);
-  if (Nargs == 4) {
-    ID = 0;
-    ID |= (word0 << 0);
-    ID |= (word1 << 16);
-    ID |= (word2 << 32);
-    ID |= (word3 << 48);
-    return ID;
-  } 
-    
-  ID = strtoll (IDword, &endptr, 10);
-  if (*endptr == 0) {
-    return ID;
-  }
-
-  return 0;
-}
Index: trunk/Ohana/src/opihi/pcontrol/JobOps.c
===================================================================
--- trunk/Ohana/src/opihi/pcontrol/JobOps.c	(revision 23553)
+++ trunk/Ohana/src/opihi/pcontrol/JobOps.c	(revision 23554)
@@ -202,4 +202,10 @@
   ALLOCATE (job, Job, 1);
 
+  job[0].JobID    = NextJobID();
+  if (job[0].JobID < 0) {
+    free (job);
+    return -1;
+  }
+
   job[0].argc     = argc;
   job[0].argv     = argv;
@@ -220,6 +226,4 @@
   job[0].dtime = 0.0;
   job[0].pid = 0;
-
-  job[0].JobID    = NextJobID();
   job[0].host     = NULL;
 
Index: trunk/Ohana/src/opihi/pcontrol/QueueOps.c
===================================================================
--- trunk/Ohana/src/opihi/pcontrol/QueueOps.c	(revision 23553)
+++ 	(revision )
@@ -1,67 +1,0 @@
-# include "pcontrol.h"
-
-/* get object from point in stack (negative == distance from end) */
-void *GetStack (Stack *stack, int where) {
-
-  int i;
-  void *object;
-  
-  ASSERT (stack != NULL, "stack missing");
-
-  /* STACK_TOP == 0, STACK_BOTTOM == -1 */
-  /* this code correctly handles the negative 'where' and Nobject == 0 */
-  if (where < 0) where += stack[0].Nobject;
-  if (where < 0) return (NULL);
-  if (where >= stack[0].Nobject) return (NULL);
-
-  object = stack[0].object[where];
-  stack[0].Nobject --;
-  for (i = where; i < stack[0].Nobject; i++) {
-    stack[0].object[i] = stack[0].object[i+1];
-  }
-  return (object);
-}
-
-/* push object on top of stack */
-int PutStack (Stack *stack, int where, void *object) {
-
-  int i;
-
-  ASSERT (stack != NULL, "stack missing");
-
-  /* STACK_TOP == 0, STACK_BOTTOM == -1 */
-  /* this code correctly handles the negative 'where' and Nobject == 0 */
-  if (where < 0) where += stack[0].Nobject + 1;
-  if (where < 0) return (FALSE);
-  if (where > stack[0].Nobject) return (FALSE);
-
-  /* extend stack as needed */
-  if (stack[0].Nobject >= stack[0].NOBJECT) {
-    stack[0].NOBJECT += 100;
-    REALLOCATE (stack[0].object, void *, stack[0].NOBJECT);
-  }
-
-  for (i = stack[0].Nobject; i > where; i--) {
-    stack[0].object[i] = stack[0].object[i-1];
-  }
-  stack[0].object[where] = object;
-  stack[0].Nobject ++;
-  return (TRUE);
-}
-
-/* allocate stack, setup with default values, allocate data */
-Stack *InitStack () {
-
-  Stack *stack;
-
-  ALLOCATE (stack, Stack, 1);
-
-  stack[0].Nobject = 0;
-  stack[0].NOBJECT = 50;
-  ALLOCATE (stack[0].object, void *, stack[0].NOBJECT);
-  return (stack);
-}
-
-/* these stacks are not super efficient, and should probably be replaced with linked lists, 
-   but I find these easier to get my brain around
-*/
Index: trunk/Ohana/src/opihi/pcontrol/ResetJob.c
===================================================================
--- trunk/Ohana/src/opihi/pcontrol/ResetJob.c	(revision 23553)
+++ 	(revision )
@@ -1,61 +1,0 @@
-# include "pcontrol.h"
-
-// XXX deprecated
-
-int ResetJob (Job *job) {
-  
-  int       status;
-  Host     *host;
-
-  /** must have a valid host : if not, move to pending? **/
-  ASSERT (job != NULL, "job missing");
-
-  host = (Host *) job[0].host;
-  ASSERT (job != NULL, "host missing");
-
-  /* we have tried to reset the job; may not get status */
-  job[0].Reset = TRUE;
-
-  status = PclientCommand (host, "reset");
-
-  /* check on success of pclient command */
-  switch (status) {
-    case PCLIENT_DOWN:
-      if (VerboseMode()) gprint (GP_ERR, "host %s is down\n", host[0].hostname);
-      HarvestHost (host[0].pid);
-      PutHost (host, PCONTROL_HOST_DOWN, STACK_BOTTOM);
-      return (FALSE);
-
-    case PCLIENT_GOOD:
-      host[0].response_state = PCONTROL_RESP_RESET_JOB;
-      host[0].response = PCLIENT_PROMPT;
-      FlushIOBuffer (&host[0].comms_buffer, 0x100);
-      PutHost (host, PCONTROL_HOST_RESP, STACK_BOTTOM);
-      return (TRUE);
-
-    default:
-      ABORT ("unknown status for pclient command");  
-  }
-  ABORT ("should not reach here (ResetJob)"); 
-}
-
-int ResetJobResponse (Host *host) {
-  
-  int       status;
-  IOBuffer *buffer;
-
-  /* job must have assigned host */
-  ASSERT (host, "missing host");
-  ASSERT (host[0].job, "missing job");
-  buffer = host[0].comms_buffer;
-
-  gprint (GP_ERR, "message received (ResetJob)\n");  
-  return (TRUE);
-}
-
-/* if machine is down, return FALSE
-   this will place job back in BUSY state,
-   next check of job will catch state and
-   put machine down correctly
-
-*/
Index: trunk/Ohana/src/opihi/pcontrol/job.c
===================================================================
--- trunk/Ohana/src/opihi/pcontrol/job.c	(revision 23553)
+++ trunk/Ohana/src/opihi/pcontrol/job.c	(revision 23554)
@@ -48,4 +48,5 @@
   }
 
+  // a JobID < 0 mean the job was not accepted
   JobID = AddJob (Host, Mode, Timeout, targc, targv);
   gprint (GP_LOG, "JobID: %d\n", (int) JobID);
Index: trunk/Ohana/src/opihi/pcontrol/stop.c
===================================================================
--- trunk/Ohana/src/opihi/pcontrol/stop.c	(revision 23553)
+++ 	(revision )
@@ -1,17 +1,0 @@
-# include "pcontrol.h"
-
-int stop (int argc, char **argv) {
-
-  if (argc != 1) {
-    gprint (GP_ERR, "USAGE: stop\n");
-    return (FALSE);
-  }
-
-# ifdef THREADED
-  SetRunSystem (FALSE);
-# else
-  rl_event_hook = NULL;
-# endif
-
-  return (TRUE);
-}
