[Openvas-commits] r3327 - in trunk/openvas-manager: . src src/tests

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon May 11 15:51:28 CEST 2009


Author: mattm
Date: 2009-05-11 15:51:27 +0200 (Mon, 11 May 2009)
New Revision: 3327

Modified:
   trunk/openvas-manager/ChangeLog
   trunk/openvas-manager/README
   trunk/openvas-manager/src/openvasmd.c
   trunk/openvas-manager/src/ovas-mngr-comm.c
   trunk/openvas-manager/src/tests/common.c
   trunk/openvas-manager/src/tracef.h
Log:
	Add a verbose flag.

	* src/ovas-mngr-comm.c (verbose): New variable.

	* src/verbose.c (verbose): New variable.
	(TRACE): Enable.

	* src/openvasmd.c (main): Add verbose flag.

	* src/tracef.h (verbose): New header.
	(tracef): Honour verbose variable.

	* README: Update usage message.


Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog	2009-05-11 10:50:42 UTC (rev 3326)
+++ trunk/openvas-manager/ChangeLog	2009-05-11 13:51:27 UTC (rev 3327)
@@ -1,10 +1,26 @@
-2009-05-11  Matthew Mundell <matt at mundell.ukfsn.org>
+2009-05-11  Matthew Mundell <mmundell at intevation.de>
 
+	Add a verbose flag.
+
+	* src/ovas-mngr-comm.c (verbose): New variable.
+
+	* src/verbose.c (verbose): New variable.
+	(TRACE): Enable.
+
+	* src/openvasmd.c (main): Add verbose flag.
+
+	* src/tracef.h (verbose): New header.
+	(tracef): Honour verbose variable.
+
+	* README: Update usage message.
+
+2009-05-11  Matthew Mundell <mmundell at intevation.de>
+
 	* doc/Doxyfile (INPUT): Add src/tasks_sql.h and src/tasks_fs.h.
 
 	* src/openvasmd.c (\mainpage): Note src/tasks_sql.h and src/tasks_fs.h.
 
-2009-05-11  Matthew Mundell <matt at mundell.ukfsn.org>
+2009-05-11  Matthew Mundell <mmundell at intevation.de>
 
 	* README: Revert sentence about connecting as though to server.
 

Modified: trunk/openvas-manager/README
===================================================================
--- trunk/openvas-manager/README	2009-05-11 10:50:42 UTC (rev 3326)
+++ trunk/openvas-manager/README	2009-05-11 13:51:27 UTC (rev 3327)
@@ -29,4 +29,5 @@
 	  -p, --port=<number>         Use port number <number>.
 	  -l, --slisten=<address>     Server (openvasd) address.
 	  -s, --sport=<number>        Server (openvasd) port number.
-	  -v, --version               Print version.
+	  -v, --verbose               Print progress messages.
+	  --version                   Print version.

Modified: trunk/openvas-manager/src/openvasmd.c
===================================================================
--- trunk/openvas-manager/src/openvasmd.c	2009-05-11 10:50:42 UTC (rev 3326)
+++ trunk/openvas-manager/src/openvasmd.c	2009-05-11 13:51:27 UTC (rev 3327)
@@ -599,7 +599,6 @@
 main (int argc, char** argv)
 {
   int server_port, manager_port;
-  tracef ("   OpenVAS Manager\n");
 
   /* Process options. */
 
@@ -616,7 +615,8 @@
         { "port", 'p', 0, G_OPTION_ARG_STRING, &manager_port_string, "Use port number <number>.", "<number>" },
         { "slisten", 'l', 0, G_OPTION_ARG_STRING, &server_address_string, "Server (openvasd) address.", "<address>" },
         { "sport", 's', 0, G_OPTION_ARG_STRING, &server_port_string, "Server (openvasd) port number.", "<number>" },
-        { "version", 'v', 0, G_OPTION_ARG_NONE, &print_version, "Print version.", NULL },
+        { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "Print progress messages.", NULL },
+        { "version", 0, 0, G_OPTION_ARG_NONE, &print_version, "Print version.", NULL },
         { NULL }
       };
 
@@ -636,6 +636,8 @@
       exit (EXIT_SUCCESS);
     }
 
+  tracef ("   OpenVAS Manager\n");
+
   if (server_address_string == NULL)
     server_address_string = OPENVASD_ADDRESS;
 

Modified: trunk/openvas-manager/src/ovas-mngr-comm.c
===================================================================
--- trunk/openvas-manager/src/ovas-mngr-comm.c	2009-05-11 10:50:42 UTC (rev 3326)
+++ trunk/openvas-manager/src/ovas-mngr-comm.c	2009-05-11 13:51:27 UTC (rev 3327)
@@ -60,7 +60,15 @@
  */
 #define TO_SERVER_BUFFER_SIZE 8192
 
+// FIX This is the definition for the entire module.
 /**
+ * @brief Verbose output flag.
+ *
+ * Only consulted if compiled with TRACE non-zero.
+ */
+int verbose = 0;
+
+/**
  * @brief Buffer of output to the server.
  */
 static char to_server[TO_SERVER_BUFFER_SIZE];

Modified: trunk/openvas-manager/src/tests/common.c
===================================================================
--- trunk/openvas-manager/src/tests/common.c	2009-05-11 10:50:42 UTC (rev 3326)
+++ trunk/openvas-manager/src/tests/common.c	2009-05-11 13:51:27 UTC (rev 3327)
@@ -72,8 +72,15 @@
 /**
  * @brief Trace flag.
  */
-#define TRACE 0
+#define TRACE 1
 
+/**
+ * @brief Verbose output flag.
+ *
+ * Only consulted if compiled with TRACE non-zero.
+ */
+int verbose = 0;
+
 #include <assert.h>
 #include <arpa/inet.h>
 #include <fcntl.h>
@@ -777,41 +784,6 @@
   return 1;
 }
 
-/**
- * @brief Do something for each child of an entity.
- *
- * Calling "break" during body exits the loop.
- *
- * @param[in]  entity  The entity.
- * @param[in]  child   Name to use for child variable.
- * @param[in]  temp    Name to use for internal variable.
- * @param[in]  body    The code to run for each child.
- */
-#define DO_CHILDREN(entity, child, temp, body)      \
-  do                                                \
-    {                                               \
-      GSList* temp = entity->entities;              \
-      while (temp)                                  \
-        {                                           \
-          entity_t child = temp->data;              \
-          {                                         \
-            body;                                   \
-          }                                         \
-          temp = g_slist_next (temp);               \
-        }                                           \
-    }                                               \
-  while (0)
-
-#if 0
-/* Lisp version of DO_CHILDREN. */
-(defmacro do-children ((entity child) &body body)
-  "Do something for each child of an entity."
-  (let ((temp (gensym)))
-    `(while ((,temp (entity-entities ,entity) (rest ,temp)))
-            (,temp)
-       , at body)))
-#endif
-
 
 /* OMP. */
 

Modified: trunk/openvas-manager/src/tracef.h
===================================================================
--- trunk/openvas-manager/src/tracef.h	2009-05-11 10:50:42 UTC (rev 3326)
+++ trunk/openvas-manager/src/tracef.h	2009-05-11 13:51:27 UTC (rev 3327)
@@ -49,6 +49,11 @@
  */
 #define TRACE_TEXT 1
 
+/**
+ * @brief Verbose output flag.
+ */
+extern int verbose;
+
 #if TRACE
 #include <stdio.h>
 #include <stdlib.h>
@@ -60,11 +65,14 @@
  *
  * Print the printf style \a args to stderr, preceded by the process ID.
  */
-#define tracef(args...)                        \
-  do {                                         \
-    fprintf (stderr, "%7i  ", (int) getpid()); \
-    fprintf (stderr, args);                    \
-    if (fflush (stderr) == EOF) abort ();      \
+#define tracef(args...)                            \
+  do {                                             \
+    if (verbose)                                   \
+      {                                            \
+        fprintf (stderr, "%7i  ", (int) getpid()); \
+        fprintf (stderr, args);                    \
+        if (fflush (stderr) == EOF) abort ();      \
+      }                                            \
   } while (0)
 #else
 /**



More information about the Openvas-commits mailing list