now the DUMP command
authorChristian Thaeter <ct@pipapo.org>
Sun, 7 Oct 2007 08:06:26 +0000 (10:06 +0200)
committerChristian Thaeter <ct@pipapo.org>
Sun, 7 Oct 2007 08:06:26 +0000 (10:06 +0200)
rxpd.c

diff --git a/rxpd.c b/rxpd.c
index ca65340..cf980d7 100644 (file)
--- a/rxpd.c
+++ b/rxpd.c
@@ -650,7 +650,19 @@ void
 rxpd_connection_cmd_DUMP (int fd, short event, void* ptr)
 {
   struct rxpd_connection* self = (struct rxpd_connection*) ptr;
-  rxpd_buffer_printf (&self->out, "#ERROR: unimplemented command %s\n", &__func__[20]);
+
+  if (llist_is_empty (&self->file->rules))
+    rxpd_buffer_printf (&self->out, "#OK:\n");
+  else
+    {
+      LLIST_FOREACH (&self->file->rules, n)
+        {
+          struct rxpd_rule* rule = (struct rxpd_rule*)n;
+          rxpd_buffer_printf (&self->out, "%s\n", rule->string);
+        }
+    }
+
+  close (fd);
 }