command LOAD
authorChristian Thaeter <ct@pipapo.org>
Mon, 8 Oct 2007 16:15:51 +0000 (18:15 +0200)
committerChristian Thaeter <ct@pipapo.org>
Mon, 8 Oct 2007 16:15:51 +0000 (18:15 +0200)
rxpd.c

diff --git a/rxpd.c b/rxpd.c
index 455e253..8ca6a57 100644 (file)
--- a/rxpd.c
+++ b/rxpd.c
@@ -706,7 +706,24 @@ void
 rxpd_connection_cmd_LOAD (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 (!event)
+    {
+      if (self->file)
+        {
+          if (rxpd_file_load (self->file))
+            {
+              rxpd_buffer_printf (&self->out, "#OK:\n");
+            }
+          else
+            {
+              rxpd_buffer_printf (&self->out, "#ERROR: loading file '%s'\n", (const char*)self->file->node.key);
+            }
+        }
+      else
+        rxpd_buffer_printf (&self->out, "#ERROR: no such file\n");
+      close (fd);
+    }
 }
 
 void