[Openvas-commits] r5583 - in trunk/openvas-client: . src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Oct 16 17:28:19 CEST 2009


Author: mattm
Date: 2009-10-16 17:28:18 +0200 (Fri, 16 Oct 2009)
New Revision: 5583

Modified:
   trunk/openvas-client/ChangeLog
   trunk/openvas-client/src/omp-cli.c
Log:
	* src/omp-cli.c (prints_tasks): Remove last report printing.
	(main): Print report ID after start-task.

Modified: trunk/openvas-client/ChangeLog
===================================================================
--- trunk/openvas-client/ChangeLog	2009-10-16 15:27:32 UTC (rev 5582)
+++ trunk/openvas-client/ChangeLog	2009-10-16 15:28:18 UTC (rev 5583)
@@ -1,5 +1,10 @@
 2009-10-16  Matthew Mundell <matthew.mundell at intevation.de>
 
+	* src/omp-cli.c (prints_tasks): Remove last report printing.
+	(main): Print report ID after start-task.
+
+2009-10-16  Matthew Mundell <matthew.mundell at intevation.de>
+
 	* src/omp-cli.c (main): Compare cmd_xml to NULL in single command check,
 	as it is a string.
 

Modified: trunk/openvas-client/src/omp-cli.c
===================================================================
--- trunk/openvas-client/src/omp-cli.c	2009-10-16 15:27:32 UTC (rev 5582)
+++ trunk/openvas-client/src/omp-cli.c	2009-10-16 15:28:18 UTC (rev 5583)
@@ -145,8 +145,7 @@
       if (strcmp (entity_name (task), "task") == 0)
         {
           entity_t entity;
-          entity_t last_report_entity;
-          const char *id, *name, *status, *progress, *last_report_id;
+          const char *id, *name, *status, *progress;
 
           id = entity_attribute (task, "id");
           if (id == NULL)
@@ -179,45 +178,11 @@
             }
           progress = entity_text (entity);
 
-          /* OMP responses differ when all reports where queried vs when just a
-           * single report was queried. Try to find out by looking at the
-           * response. */
-          last_report_entity = entity_child (task, "last_report");
-          if (last_report_entity != NULL)
-            {
-              entity = last_report_entity;
-            }
-          else if (entity_child (task, "report") != NULL)
-            {
-              entity = task;
-            }
-          if (entity == NULL)
-            last_report_id = "";
-          else
-            {
-              entity_t report = entity_child (entity, "report");
-              if (report == NULL)
-                {
-                  fprintf (stderr, "Failed to parse last_report.\n");
-                  return -1;
-                }
-              last_report_id = entity_attribute (report, "id");
-              if (last_report_id == NULL)
-                {
-                  fprintf (stderr, "Failed to parse last_report ID.\n");
-                  return -1;
-                }
-            }
-
           printf ("%s  %-7s", id, status);
           if (strcmp (status, "Running") == 0)
-            printf (" %2s%%  %s", progress, name);
+            printf (" %2s%%  %s\n", progress, name);
           else
-            printf ("      %s", name);
-          if (last_report_id && strlen (last_report_id))
-            printf ("  %s\n", last_report_id);
-          else
-            putchar ('\n');
+            printf ("      %s\n", name);
         }
       tasks = next_entities (tasks);
     }
@@ -744,12 +709,16 @@
 
       while (*point)
         {
-          if (omp_start_task (&(connection->session), *point))
+          char *report_id;
+          if (omp_start_task_report (&(connection->session),
+                                     *point,
+                                     &report_id))
             {
               fprintf (stderr, "Failed to start task.\n");
               manager_close (connection);
               exit (EXIT_FAILURE);
             }
+          printf ("%s\n", report_id);
           point++;
         }
       exit_status = 0;



More information about the Openvas-commits mailing list