Index: trunk/Ohana/src/opihi/pantasks/delete.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/delete.c	(revision 7917)
+++ trunk/Ohana/src/opihi/pantasks/delete.c	(revision 13542)
@@ -3,15 +3,45 @@
 int delete_job (int argc, char **argv) {
 
+  Job *job;
   int JobID;
 
-  if (argc < 2) {
-    gprint (GP_ERR, "USAGE: delete (JobID)\n");
+  if (argc != 3) goto usage;
+
+  if (!strcasecmp (argv[1], "job")) {
+    JobID = atoi (argv[2]);
+
+    job = FindJob (JobID);
+    if (job == NULL) {
+      gprint (GP_LOG, "job not found\n");
+      return (TRUE);
+    }
+
+    if (job[0].mode == JOB_LOCAL) {
+      if (!KillLocalJob (job)) {
+	job[0].state = JOB_HUNG;
+	if (VerboseMode()) gprint (GP_LOG, "child process %d is hung, cannot kill\n", job[0].pid);
+	return (FALSE);
+      }
+    } else {
+      if (!KillControllerJob (job)) {
+	job[0].state = JOB_HUNG;
+	if (VerboseMode()) gprint (GP_LOG, "child process %d is hung, cannot kill\n", job[0].pid);
+	return (FALSE);
+      }
+    }    
+    DeleteJob (job);
+    gprint (GP_LOG, "job removed\n");
+    return (TRUE);
+  }
+
+  if (!strcasecmp (argv[1], "task")) {
+    gprint (GP_ERR, "delete task not implemented yet\n");
     return (FALSE);
   }
-  JobID = atoi (argv[1]);
-  /* use a string interp to convert JobIDs to ints ? */
 
-  gprint (GP_ERR, "this function is not yet implemented\n");
-  return (TRUE);
+usage:
+    gprint (GP_ERR, "USAGE: delete job (JobID)\n");
+    gprint (GP_ERR, "USAGE: delete task (TaskName)\n");
+    return (FALSE);
 }
 
