rxpd_buffer_printf (&self->out, "#ERROR: unimplemented command %s\n", &__func__[20]);
}
+
+static psplay_delete_t
+walk_LIST (PSplay node, const enum psplay_order_e which, int level, void* data)
+{
+ (void) level;
+ struct rxpd_file* file = (struct rxpd_file*) node;
+ struct rxpd_connection* conn = (struct rxpd_connection*) data;
+
+ if (which == PSPLAY_INORDER)
+ rxpd_buffer_printf (&conn->out, "%s\n", file->node.key);
+
+ return PSPLAY_CONT;
+}
+
+
void
rxpd_connection_cmd_LIST (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 (psplay_isempty_root (&self->base->files))
+ rxpd_buffer_printf (&self->out, "#OK:\n");
+ else
+ psplay_walk (&self->base->files, NULL, walk_LIST, 0, ptr);
+
+ close (fd);
}
void
struct rxpd_connection* self = (struct rxpd_connection*) ptr;
rxpd_buffer_printf (&self->out, "#ERROR: unimplemented command %s\n", &__func__[20]);
}
-