bool test_lCopyWhat(void)
{
   bool ret = true;
   lEnumeration *what1 = lWhat("%T(ALL)", TEST_Type);
   lEnumeration *what2 = lWhat("%T(NONE)", TEST_Type);
   lEnumeration *what3 = lWhat("%T(%I %I "
                "%I -> %T(%I %I -> %T(%I %I)) "
                "%I -> %T(NONE) "
                "%I -> %T(ALL))",
                TEST_Type, TEST_int, TEST_host,
                TEST_list, TEST1_Type, TEST1_int, TEST1_object,
                   TEST1_Type, TEST1_int, TEST1_host,
                TEST_object, TEST1_Type,
                TEST_ref, TEST1_Type);
   lEnumeration *dst_what1 = lCopyWhat(what1);
   lEnumeration *dst_what2 = lCopyWhat(what2);
   lEnumeration *dst_what3 = lCopyWhat(what3);

   ret &= (enumeration_compare(what1, dst_what1) == 0);
   ret &= (enumeration_compare(what2, dst_what2) == 0);
   ret &= (enumeration_compare(what3, dst_what3) == 0);

#if 0 /* debug */
   lWriteWhatTo(what1, stderr);
   fprintf(stderr, "\n");
   lWriteWhatTo(what2, stderr);
   fprintf(stderr, "\n");
   lWriteWhatTo(what3, stderr);
   fprintf(stderr, "\n");
   lWriteWhatTo(dst_what1, stderr);
   fprintf(stderr, "\n");
   lWriteWhatTo(dst_what2, stderr);
   fprintf(stderr, "\n");
   lWriteWhatTo(dst_what3, stderr);
   fprintf(stderr, "\n");
#endif
   
   lFreeWhat(&what1);
   lFreeWhat(&what2);
   lFreeWhat(&what3);

   lFreeWhat(&dst_what1);
   lFreeWhat(&dst_what2);
   lFreeWhat(&dst_what3);

   return ret;
}
static sge_gdi_task_class_t *
sge_gdi_task_create(sge_gdi_packet_class_t * packet, lList **answer_list,
                    u_long32 target, u_long32 command, lList **lp,
                    lList **a_list, lCondition **condition,
                    lEnumeration **enumeration, bool do_copy, bool do_verify)
{
   sge_gdi_task_class_t *task = NULL;

   DENTER(TOP_LAYER, "sge_gdi_task_create");

   task = (sge_gdi_task_class_t *) sge_malloc(sizeof(sge_gdi_task_class_t));
   if (task != NULL) {
      task->id =
         ((packet->last_task != NULL) ? (packet->last_task->id + 1) : 1);
      task->command = command;
      task->target = target;
      task->next = NULL;
      task->do_select_pack_simultaneous = false;
      if (do_copy) {
         if (enumeration != NULL && *enumeration != NULL) {
            task->data_list = (((lp != NULL) && (*lp != NULL)) ?
                               lSelect("", *lp, NULL, *enumeration) : NULL);
         } else {
            task->data_list = (((lp != NULL) && (*lp != NULL)) ?
                               lCopyList("", *lp) : NULL);
         }
         task->answer_list = (((a_list != NULL) && (*a_list != NULL)) ?
                              lCopyList("", *a_list) : NULL);
         task->condition = (((condition != NULL) && (*condition != NULL)) ?
                            lCopyWhere(*condition) : NULL);
         task->enumeration = (((enumeration != NULL) && (*enumeration != NULL)) ?
                              lCopyWhat(*enumeration) : NULL);
      } else {
         if ((lp != NULL) && (*lp != NULL)) {
            task->data_list = *lp;
            *lp = NULL;
         } else {
            task->data_list = NULL;
         }
         if ((a_list != NULL) && (*a_list != NULL)) {
            task->answer_list = *a_list;
            *a_list = NULL;
         } else {
            task->answer_list = NULL;
         }
         if ((condition != NULL) && (*condition != NULL)) {
            task->condition = *condition;
            *condition = NULL;
         } else {
            task->condition = NULL;
         }
         if ((enumeration != NULL) && (*enumeration != NULL)) {
            task->enumeration = *enumeration;
            *enumeration = NULL;
         } else {
            task->enumeration = NULL;
         }
      }
      if (do_verify && !sge_gdi_task_verify(task, answer_list)) {
         if (do_copy == true) {
            lFreeList(&(task->data_list));
            lFreeList(&(task->answer_list));
            lFreeWhere(&(task->condition));
            lFreeWhat(&(task->enumeration));
         } else {
            task->data_list = NULL;
            task->answer_list = NULL;
            task->condition = NULL;
            task->enumeration = NULL;
         }
         sge_gdi_task_free(&task);
      }
   } else {
      answer_list_add_sprintf(answer_list, STATUS_EMALLOC,
                              ANSWER_QUALITY_ERROR, MSG_MEMORY_MALLOCFAILED);
   }
   DRETURN(task);
}