]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - audiod.c
stat_client_write(): add help text for new 'itemnum' parameter
[paraslash.git] / audiod.c
index 741bd68b0344c510ecdd750e897aedfa25b9ee48..56d022fac1c3293ef303f819515941261c8f1777 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -153,11 +153,13 @@ static struct audiod_command cmds[] = {
 .description = "grab the audio stream",
 .synopsis = "-- grab [grab_options]",
 .help =
+
 "grab ('splice') the audio stream at any position in the filter      \n"
-"chain and send that data back to the client. \n"
-"Available options:\n\n"
-GRAB_HELP_TXT
+"chain and send that data back to the client. Try\n"
+"\t para_audioc -- grab -h\n"
+"for the list of available options.\n"
 },
+
 {
 .name = "help",
 .handler = com_help,
@@ -1345,7 +1347,8 @@ static int com_grab(int fd, int argc, char **argv)
 {
        struct grab_client *gc;
        struct filter_node *fn;
-       int err;
+       int i, err;
+       char *msg;
 
        PARA_INFO_LOG("argc: %d, argv[0]: %s, optind: %d\n", argc, argv[0], optind);
        gc = grab_client_new(fd, argc, argv, &err);
@@ -1357,13 +1360,22 @@ static int com_grab(int fd, int argc, char **argv)
                activate_grab_client(gc, fn);
        return 1;
 err_out:
-       if (err != -E_GC_HELP_GIVEN)
-               return err;
-       err = client_write(fd, "Usage: para_audioc [audioc_options] -- "
-               "grab [grab_options]\nAvailable options:\n");
-       if (err < 0)
+       if (err != -E_GC_HELP_GIVEN && err != -E_GC_VERSION_GIVEN)
                return err;
-       err = client_write(fd, GRAB_HELP_TXT);
+       if (err == -E_GC_HELP_GIVEN) {
+               msg = make_message("%s\n\n", grab_client_args_info_usage);
+               for (i = 0; grab_client_args_info_help[i]; i++) {
+                       char *tmp = make_message("%s%s\n", msg,
+                               grab_client_args_info_help[i]);
+                       free(msg);
+                       msg = tmp;
+               }
+       } else
+               msg = make_message("%s %s\n",
+                       GRAB_CLIENT_CMDLINE_PARSER_PACKAGE,
+                       GRAB_CLIENT_CMDLINE_PARSER_VERSION);
+       err = client_write(fd, msg);
+       free(msg);
        if (err < 0)
                return err;
        close(fd);