]> code.delx.au - pulseaudio/blobdiff - src/daemon/cmdline.c
daemon: Drop --module-idle-time from docs
[pulseaudio] / src / daemon / cmdline.c
index 0bfc8a920a813e94b2c34f5df229f9bb59b3befd..2c4c4b513f911cabaf47086e80416c7eec382dab 100644 (file)
@@ -5,7 +5,7 @@
 
   PulseAudio is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as published
-  by the Free Software Foundation; either version 2 of the License,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
 #include <config.h>
 #endif
 
-#include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <getopt.h>
-#include <sys/stat.h>
 
 #include <pulse/xmalloc.h>
-#include <pulse/i18n.h>
+#include <pulse/util.h>
 
 #include <pulsecore/core-util.h>
+#include <pulsecore/i18n.h>
 #include <pulsecore/strbuf.h>
 #include <pulsecore/macro.h>
 
@@ -52,7 +51,6 @@ enum {
     ARG_DISALLOW_MODULE_LOADING,
     ARG_DISALLOW_EXIT,
     ARG_EXIT_IDLE_TIME,
-    ARG_MODULE_IDLE_TIME,
     ARG_SCACHE_IDLE_TIME,
     ARG_LOG_TARGET,
     ARG_LOG_META,
@@ -73,7 +71,7 @@ enum {
     ARG_START
 };
 
-/* Tabel for getopt_long() */
+/* Table for getopt_long() */
 static const struct option long_options[] = {
     {"help",                        0, 0, ARG_HELP},
     {"version",                     0, 0, ARG_VERSION},
@@ -87,9 +85,8 @@ static const struct option long_options[] = {
     {"realtime",                    2, 0, ARG_REALTIME},
     {"disallow-module-loading",     2, 0, ARG_DISALLOW_MODULE_LOADING},
     {"disallow-exit",               2, 0, ARG_DISALLOW_EXIT},
-    {"exit-idle-time",              2, 0, ARG_EXIT_IDLE_TIME},
-    {"module-idle-time",            2, 0, ARG_MODULE_IDLE_TIME},
-    {"scache-idle-time",            2, 0, ARG_SCACHE_IDLE_TIME},
+    {"exit-idle-time",              1, 0, ARG_EXIT_IDLE_TIME},
+    {"scache-idle-time",            1, 0, ARG_SCACHE_IDLE_TIME},
     {"log-target",                  1, 0, ARG_LOG_TARGET},
     {"log-meta",                    2, 0, ARG_LOG_META},
     {"log-time",                    2, 0, ARG_LOG_TIME},
@@ -111,15 +108,8 @@ static const struct option long_options[] = {
 };
 
 void pa_cmdline_help(const char *argv0) {
-    const char *e;
-
     pa_assert(argv0);
 
-    if ((e = strrchr(argv0, '/')))
-        e++;
-    else
-        e = argv0;
-
     printf(_("%s [options]\n\n"
            "COMMANDS:\n"
            "  -h, --help                            Show this help\n"
@@ -130,7 +120,7 @@ void pa_cmdline_help(const char *argv0) {
            "      --cleanup-shm                     Cleanup stale shared memory segments\n"
            "      --start                           Start the daemon if it is not running\n"
            "  -k  --kill                            Kill a running daemon\n"
-           "      --check                           Check for a running daemon\n\n"
+           "      --check                           Check for a running daemon (only returns exit code)\n\n"
 
            "OPTIONS:\n"
            "      --system[=BOOL]                   Run as system-wide instance\n"
@@ -147,13 +137,12 @@ void pa_cmdline_help(const char *argv0) {
            "      --disallow-exit[=BOOL]            Disallow user requested exit\n"
            "      --exit-idle-time=SECS             Terminate the daemon when idle and this\n"
            "                                        time passed\n"
-           "      --module-idle-time=SECS           Unload autoloaded modules when idle and\n"
-           "                                        this time passed\n"
            "      --scache-idle-time=SECS           Unload autoloaded samples when idle and\n"
            "                                        this time passed\n"
            "      --log-level[=LEVEL]               Increase or set verbosity level\n"
            "  -v                                    Increase the verbosity level\n"
-           "      --log-target={auto,syslog,stderr} Specify the log target\n"
+           "      --log-target={auto,syslog,stderr,file:PATH}\n"
+           "                                        Specify the log target\n"
            "      --log-meta[=BOOL]                 Include code location in log messages\n"
            "      --log-time[=BOOL]                 Include timestamps in log messages\n"
            "      --log-backtrace=FRAMES            Include a backtrace in log messages\n"
@@ -174,7 +163,8 @@ void pa_cmdline_help(const char *argv0) {
            "  -C                                    Open a command line on the running TTY\n"
            "                                        after startup\n\n"
 
-           "  -n                                    Don't load default script file\n"), e);
+           "  -n                                    Don't load default script file\n"),
+           pa_path_get_filename(argv0));
 }
 
 int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d) {
@@ -301,7 +291,7 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d
 
             case ARG_DISALLOW_EXIT:
                 if ((conf->disallow_exit = optarg ? pa_parse_boolean(optarg) : TRUE) < 0) {
-                    pa_log(_("--disallow-exit boolean argument"));
+                    pa_log(_("--disallow-exit expects boolean argument"));
                     goto fail;
                 }
                 break;
@@ -325,21 +315,21 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d
 
             case ARG_LOG_TARGET:
                 if (pa_daemon_conf_set_log_target(conf, optarg) < 0) {
-                    pa_log(_("Invalid log target: use either 'syslog', 'stderr' or 'auto'."));
+                    pa_log(_("Invalid log target: use either 'syslog', 'stderr' or 'auto' or a valid file name 'file:<path>'."));
                     goto fail;
                 }
                 break;
 
             case ARG_LOG_TIME:
                 if ((conf->log_time = optarg ? pa_parse_boolean(optarg) : TRUE) < 0) {
-                    pa_log(_("--log-time boolean argument"));
+                    pa_log(_("--log-time expects boolean argument"));
                     goto fail;
                 }
                 break;
 
             case ARG_LOG_META:
                 if ((conf->log_meta = optarg ? pa_parse_boolean(optarg) : TRUE) < 0) {
-                    pa_log(_("--log-meta boolean argument"));
+                    pa_log(_("--log-meta expects boolean argument"));
                     goto fail;
                 }
                 break;
@@ -352,10 +342,6 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d
                 conf->exit_idle_time = atoi(optarg);
                 break;
 
-            case ARG_MODULE_IDLE_TIME:
-                conf->module_idle_time = atoi(optarg);
-                break;
-
             case ARG_SCACHE_IDLE_TIME:
                 conf->scache_idle_time = atoi(optarg);
                 break;
@@ -396,11 +382,6 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d
     pa_xfree(conf->script_commands);
     conf->script_commands = pa_strbuf_tostring_free(buf);
 
-    if (!conf->script_commands) {
-        pa_xfree(conf->script_commands);
-        conf->script_commands = NULL;
-    }
-
     *d = optind;
 
     return 0;