]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Merge branch 't/audiod_com_version'
authorAndre Noll <maan@systemlinux.org>
Thu, 19 Jun 2014 13:39:33 +0000 (15:39 +0200)
committerAndre Noll <maan@systemlinux.org>
Thu, 19 Jun 2014 13:41:33 +0000 (15:41 +0200)
Cooking since 2014-04-03.

* t/audiod_com_version:
  audiod: Implement version command.
  audiod: Trival spelling fix for com_tasks().

NEWS
audioc.c
audiod.cmd
audiod_command.c

diff --git a/NEWS b/NEWS
index 642c1fc422225141a1fa1a555113746a69b8a93e..1cc2f40ebdd980289de24e1e829c5662980d9f69 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@ NEWS
          for the generated man pages.
        - ao_writer fixes. This writer was in a quite bad shape. Many
          serious bugs have been fixed.
+       - new audiod command: version.
 
 ----------------------------------------
 0.5.2 (2014-04-11) "orthogonal interior"
index 5f6b5ae1195645e3a8b4c2b458559625a036701c..fe7165edd966d1afeaf46c15c252fa70c229e2c6 100644 (file)
--- a/audioc.c
+++ b/audioc.c
@@ -97,6 +97,15 @@ static void help_completer(struct i9e_completion_info *ci,
        result->matches = i9e_complete_commands(ci->word, audiod_completers);
 }
 
+static void version_completer(struct i9e_completion_info *ci,
+               struct i9e_completion_result *cr)
+{
+       char *opts[] = {"-v", NULL};
+
+       if (ci->word_num <= 2 && ci->word && ci->word[0] == '-')
+               i9e_complete_option(opts, ci, cr);
+}
+
 static void stat_completer(struct i9e_completion_info *ci,
                struct i9e_completion_result *cr)
 {
index ad8f67d08d86aac29c311e6eb1cf62f55f9bf687..18c802de8857788449cb6dfbfa53823c7ef0da0e 100644 (file)
@@ -66,9 +66,14 @@ H: parser-friendly mode.
 N: tasks
 D: list current tasks
 U: tasks
-H: print the list of task ids together with the status of each task
+H: Print the list of task ids together with the status of each task.
 ---
 N: term
 D: terminate audiod
 U: term
 H: Stop all decoders, shut down connection to para_server and exit.
+---
+N: version
+D: print the version of para_audiod
+U: version [-v]
+H: If the -v option is given, a more detailed version text is printed.
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;