Merge branch 't/cpsi_improvement'
[paraslash.git] / audiod_command.c
index 4485d9e9df28ca0fb2d1689046c1e53cffc9f5a5..56d922e6681e66d0d9c4f65df86569806a38ca80 100644 (file)
@@ -29,6 +29,7 @@
 #include "string.h"
 #include "write.h"
 #include "fd.h"
+#include "version.h"
 #include "audiod_command_list.h"
 
 extern struct sched sched;
@@ -419,6 +420,22 @@ static int com_cycle(int fd, int argc, char **argv)
        return 1;
 }
 
+static int com_version(int fd, int argc, char **argv)
+{
+       int ret;
+       char *msg;
+
+       if (argc > 1 && strcmp(argv[1], "-v") == 0)
+               msg = make_message("%s", version_text("audiod"));
+       else
+               msg = make_message("%s\n", version_single_line("audiod"));
+       ret = client_write(fd, msg);
+       free(msg);
+       if (ret >= 0)
+               close(fd);
+       return ret;
+}
+
 static int check_perms(uid_t uid)
 {
        int i;