Index: /trunk/Ohana/src/opihi/include/pantasks.h
===================================================================
--- /trunk/Ohana/src/opihi/include/pantasks.h	(revision 8128)
+++ /trunk/Ohana/src/opihi/include/pantasks.h	(revision 8129)
@@ -41,4 +41,5 @@
       TASK_HOST, 
       TASK_COMMAND, 
+      TASK_OPTIONS, 
       TASK_PERIODS, 
       TASK_EXIT, 
@@ -66,4 +67,8 @@
   int     argc;
   char  **argv;
+
+  int     optc;
+  char  **optv;
+
   char   *host;
   int     host_required;
@@ -112,4 +117,8 @@
   int     argc;
   char  **argv;
+
+  int     optc;
+  char  **optv;
+
   Task   *task;
 
Index: /trunk/Ohana/src/opihi/pantasks/CheckJobs.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/CheckJobs.c	(revision 8128)
+++ /trunk/Ohana/src/opihi/pantasks/CheckJobs.c	(revision 8129)
@@ -26,9 +26,10 @@
 
       case JOB_CRASH:
-	/* run task[0].crash macro, if it exists */
+      case JOB_EXIT:
 	/* push output buffer data to the stdout and stderr queues */
-	if (VerboseMode()) gprint (GP_LOG, "job %s (%d) crash\n", job[0].task[0].name, job[0].JobID);
+	/* XXX this will break on 0 values in output streams */
 	PushNamedQueue ("stdout", job[0].stdout.buffer);
 	PushNamedQueue ("stderr", job[0].stderr.buffer);
+
 	/* set taskarg variables */
 	for (i = 0; i < job[0].argc; i++) {
@@ -38,40 +39,43 @@
 	set_int_variable ("taskarg:n", job[0].argc);
 
-	/* XXX this will break on 0 values in output streams */
-	/* perhaps define PushNamedQueueBuffer */
-	if (job[0].task[0].crash != NULL) {
-	  exec_loop (job[0].task[0].crash);
+	/* set options variables */
+	for (i = 0; i < job[0].optc; i++) {
+	    sprintf (varname, "options:%d", i);
+	    set_str_variable (varname, job[0].optv[i]);
 	}
-	DeleteJob (job);
-	continue;
-	break;
+	set_int_variable ("options:n", job[0].optc);
 
-      case JOB_EXIT:
-	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);
-	/* set taskarg variables */
-	for (i = 0; i < job[0].argc; i++) {
-	    sprintf (varname, "taskarg:%d", i);
-	    set_str_variable (varname, job[0].argv[i]);
+	if (status == JOB_CRASH) {
+	  /* XXX add an Ncrash element? */
+	  job[0].task[0].Nfailure ++;
+
+	  /* run task[0].crash macro, if it exists */
+	  /* perhaps define PushNamedQueueBuffer */
+
+	  if (VerboseMode()) gprint (GP_LOG, "job %s (%d) crash\n", job[0].task[0].name, job[0].JobID);
+	  if (job[0].task[0].crash != NULL) {
+	    exec_loop (job[0].task[0].crash);
+	  }
 	}
-	set_int_variable ("taskarg:n", job[0].argc);
+	if (status == JOB_EXIT) {
+	  /* update the exit status counters */
+	  if (job[0].exit_status) {
+	    job[0].task[0].Nfailure ++;
+	  } else {
+	    job[0].task[0].Nsuccess ++;
+	  }
 
-	/* update the exit status counters */
-	if (job[0].exit_status) {
-	    job[0].task[0].Nfailure ++;
-	} else {
-	    job[0].task[0].Nsuccess ++;
+	  /* run corresponding task[0].exit macro, if it exists */
+	  if (VerboseMode()) gprint (GP_LOG, "job %s (%d) exit\n", job[0].task[0].name, job[0].JobID);
+	  macro = job[0].task[0].defexit;
+	  for (i = 0; i < job[0].task[0].Nexit; i++) {
+	    if (job[0].exit_status == atoi(job[0].task[0].exit[i][0].name)) {
+	      macro = job[0].task[0].exit[i];
+	      break;
+	    }
+	  }
+	  if (macro != NULL) exec_loop (macro);
 	}
 
-	/* run corresponding task[0].exit macro, if it exists */
-	macro = job[0].task[0].defexit;
-	for (i = 0; i < job[0].task[0].Nexit; i++) {
-	  if (job[0].exit_status == atoi(job[0].task[0].exit[i][0].name)) {
-	    macro = job[0].task[0].exit[i];
-	    break;
-	  }
-	}
-	if (macro != NULL) exec_loop (macro);
 	DeleteJob (job);
 	continue;
@@ -107,4 +111,10 @@
       set_int_variable ("taskarg:n", job[0].argc);
 
+      /* set options variables */
+      for (i = 0; i < job[0].optc; i++) {
+	sprintf (varname, "options:%d", i);
+	set_str_variable (varname, job[0].optv[i]);
+      }
+      set_int_variable ("options:n", job[0].optc);
 
       /* run task[0].timeout macro, if it exists */
Index: /trunk/Ohana/src/opihi/pantasks/JobOps.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/JobOps.c	(revision 8128)
+++ /trunk/Ohana/src/opihi/pantasks/JobOps.c	(revision 8129)
@@ -103,4 +103,11 @@
   job[0].argv[i] = 0;
 
+  /* we need our own copy of task[0].optv: optc is the number of valid opts.  */
+  job[0].optc = task[0].optc;
+  ALLOCATE (job[0].optv, char *, MAX (task[0].optc, 1));
+  for (i = 0; i < job[0].optc; i++) {
+    job[0].optv[i] = strcreate (task[0].optv[i]);
+  }
+
   /* Other data from the task is needed by the job. We carry a pointer back to the task.  Changes to an
      executing task are applied to the existing jobs (exit macros, poll_period, timeout) */
@@ -136,4 +143,9 @@
   free (job[0].argv);
 
+  for (i = 0; i < job[0].optc; i++) {
+    free (job[0].optv[i]);
+  }
+  free (job[0].optv);
+
   FreeIOBuffer (&job[0].stdout);
   FreeIOBuffer (&job[0].stderr);
Index: /trunk/Ohana/src/opihi/pantasks/Makefile
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/Makefile	(revision 8128)
+++ /trunk/Ohana/src/opihi/pantasks/Makefile	(revision 8129)
@@ -63,4 +63,5 @@
 $(SDIR)/task_periods.$(ARCH).o \
 $(SDIR)/task_command.$(ARCH).o \
+$(SDIR)/task_options.$(ARCH).o \
 $(SDIR)/version.$(ARCH).o
 
Index: /trunk/Ohana/src/opihi/pantasks/TaskOps.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/TaskOps.c	(revision 8128)
+++ /trunk/Ohana/src/opihi/pantasks/TaskOps.c	(revision 8129)
@@ -116,4 +116,10 @@
   gprint (GP_LOG, "\n\n");
 
+  gprint (GP_LOG, "\n options: ");
+  for (i = 0; i < task[0].optc; i++) {
+    gprint (GP_LOG, "%s ", task[0].optv[i]);
+  }
+  gprint (GP_LOG, "\n\n");
+
   if (task[0].host == NULL) {
     gprint (GP_LOG, " task runs locally\n");
@@ -169,4 +175,10 @@
     free (task[0].argv);
   }
+  if (task[0].optv != NULL) {
+    for (i = 0; i < task[0].optc; i++) {
+      free (task[0].optv[i]);
+    }
+    free (task[0].optv);
+  }
   if (task[0].exec != NULL) {
     FreeMacro (task[0].exec);
@@ -209,4 +221,7 @@
   NewTask[0].argc = 0;
   NewTask[0].argv = NULL;
+
+  NewTask[0].optc = 0;
+  NewTask[0].optv = NULL;
 
   NewTask[0].exec = NULL;
@@ -346,4 +361,5 @@
   if (!strcasecmp (command, "TRANGE"))    hash = TASK_TRANGE;
   if (!strcasecmp (command, "COMMAND"))   hash = TASK_COMMAND;
+  if (!strcasecmp (command, "OPTIONS"))   hash = TASK_OPTIONS;
   if (!strcasecmp (command, "PERIODS"))   hash = TASK_PERIODS;
   if (!strcasecmp (command, "TASK.EXIT")) hash = TASK_EXIT;
Index: /trunk/Ohana/src/opihi/pantasks/init.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/init.c	(revision 8128)
+++ /trunk/Ohana/src/opihi/pantasks/init.c	(revision 8129)
@@ -8,4 +8,5 @@
 int task_macros	    PROTO((int, char **));
 int task_command    PROTO((int, char **));
+int task_options    PROTO((int, char **));
 int task_periods    PROTO((int, char **));
 int run             PROTO((int, char **));
@@ -27,4 +28,5 @@
   {"task.exec",  task_macros,  "define pre-exec macro for a task"},
   {"command",    task_command, "define executed command for a task"},
+  {"options",    task_options, "define optional variables associated with the job task"},
   {"periods",    task_periods, "define time scales for a task"},
   {"run",        run,          "run the scheduler"},
Index: /trunk/Ohana/src/opihi/pantasks/task.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/task.c	(revision 8128)
+++ /trunk/Ohana/src/opihi/pantasks/task.c	(revision 8129)
@@ -95,4 +95,5 @@
       case TASK_EXEC:
       case TASK_COMMAND:
+      case TASK_OPTIONS:
       case TASK_PERIODS:
 	status = command (input, &outline, TRUE);
Index: /trunk/Ohana/src/opihi/pantasks/task_options.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/task_options.c	(revision 8129)
+++ /trunk/Ohana/src/opihi/pantasks/task_options.c	(revision 8129)
@@ -0,0 +1,38 @@
+# include "pantasks.h"
+
+int task_options (int argc, char **argv) {
+
+  int i;
+  Task *task;
+
+  if (argc < 2) {
+    gprint (GP_ERR, "USAGE: options <opt>. ..\n");
+    gprint (GP_ERR, "  (define options for this task)\n");
+    return (FALSE);
+  }
+
+  task = GetNewTask ();
+  if (task == NULL) {
+    task = GetActiveTask ();
+    if (task == NULL) {
+      gprint (GP_ERR, "ERROR: not defining or running a task\n");
+      return (FALSE);
+    }
+  }
+
+  /* free existing memory used by optv */
+  if (task[0].optc != 0) {
+    for (i = 0; i < task[0].optc; i++) {
+      if (task[0].optv[i] != NULL) free (task[0].optv[i]);
+    }
+    free (task[0].optv);
+  }
+
+  /* create new memory for optv */
+  task[0].optc = argc - 1;
+  ALLOCATE (task[0].optv, char *, MAX (task[0].optc, 1));
+  for (i = 0; i < task[0].optc; i++) {
+    task[0].optv[i] = strcreate (argv[i+1]);
+  }
+  return (TRUE);
+}
