Index: trunk/Ohana/src/opihi/cmd.data/queueload.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.data/queueload.c	(revision 12332)
+++ trunk/Ohana/src/opihi/cmd.data/queueload.c	(revision 42082)
@@ -3,9 +3,16 @@
 int queueload (int argc, char **argv) {
   
-  char *A, *B, *val;
-  int i, status;
-  int Nread, Nbytes, NBYTES;
-  FILE *f;
-  Queue *queue;
+  int N;
+
+  // variable name to save the value
+  int TrapFailure = FALSE;
+  if ((N = get_argument (argc, argv, "-trap-failure"))) {
+    remove_argument (N, &argc, argv);
+    TrapFailure = TRUE;
+  }
+  if ((N = get_argument (argc, argv, "-trap"))) {
+    remove_argument (N, &argc, argv);
+    TrapFailure = TRUE;
+  }
 
   if (argc != 4) goto usage;
@@ -13,14 +20,15 @@
   
   /* will create a queue if none exists */
-  queue = CreateQueue (argv[1]);
+  Queue *queue = CreateQueue (argv[1]);
 
   /* val will hold the result of the command */
-  NBYTES = 1024;
-  ALLOCATE (val, char, NBYTES);
+  int NBYTES = 1024;
+  ALLOCATE_PTR (val, char, NBYTES);
     
   /* loop until command produces no more output,  REALLOCATE as needed. */
-  f = popen (argv[3], "r");
-  Nbytes = 0;
-  Nread = 1;
+  FILE *f = popen (argv[3], "r");
+
+  int Nbytes = 0;
+  int Nread = 1;
   while (Nread > 0) {
     Nread = fread (&val[Nbytes], 1, 1023, f);
@@ -35,12 +43,14 @@
   }
   val[Nbytes] = 0;
-  status = pclose (f);
+  int status = pclose (f);
     
+  // XXX 
   if (status) {
     gprint (GP_ERR, "warning: exit status of command %d\n", status);
+    if (TrapFailure) { free (val); return FALSE; }
   }
       
-  A = B = val;
-  for (i = 0; B != (char *) NULL;) {
+  char *A = val, *B = val;
+  for (int i = 0; B != (char *) NULL;) {
     while (isspace (*A) && (*A != 0)) A++;
     B = strchr (A, '\n');
