~diwic/ubuntu/lucid/pulseaudio/bugfixes

« back to all changes in this revision

Viewing changes to src/daemon/cmdline.c

  • Committer: Bazaar Package Importer
  • Author(s): Luke Yelavich
  • Date: 2008-11-04 15:46:00 UTC
  • mfrom: (1.2.1 upstream) (1.1.6 lenny)
  • Revision ID: james.westby@ubuntu.com-20081104154600-hlzknpcazaam0nxm
Tags: 0.9.13-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Don't build against, and create jack package. Jack is not in main.
  - Remove --disable-per-user-esound-socket from configure flags, as we still
    want per user esound sockets.
  - Remove stop links from rc0 and rc6.
  - Change default resample algorithm and bubffer size.
  - Add alsa configuration files to route alsa applications via pulseaudio.
  - Move libasound2-plugins from Recommends to Depends.
* debian/pulseaudio.preinst: When upgrading from intrepid, remove
  /etc/X11/Xsession.d/70pulseaudio, as this was used to minimize a race
  condition when starting GNOME in intrepid. This race should not exist in
  jaunty once libcanberra is built to use pulseaudio as a backend.
* Do not spawn a pulseaudio server if clients fail to find a running server.
* Remove explicit version dependency for libspeex-dev to allow the package
  to be built for now.
* Regenerate autotools files to work with Ubuntu's newer libtool/libltdl.
* debian/control: libpulsecore5 -> libpulsecore8 to match the library
  soname.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: cmdline.c 2158 2008-03-27 23:27:34Z lennart $ */
2
 
 
3
1
/***
4
2
  This file is part of PulseAudio.
5
3
 
32
30
#include <sys/stat.h>
33
31
 
34
32
#include <pulse/xmalloc.h>
 
33
#include <pulse/i18n.h>
35
34
 
36
35
#include <pulsecore/core-util.h>
37
36
#include <pulsecore/strbuf.h>
51
50
    ARG_HIGH_PRIORITY,
52
51
    ARG_REALTIME,
53
52
    ARG_DISALLOW_MODULE_LOADING,
 
53
    ARG_DISALLOW_EXIT,
54
54
    ARG_EXIT_IDLE_TIME,
55
55
    ARG_MODULE_IDLE_TIME,
56
56
    ARG_SCACHE_IDLE_TIME,
66
66
    ARG_DISABLE_SHM,
67
67
    ARG_DUMP_RESAMPLE_METHODS,
68
68
    ARG_SYSTEM,
69
 
    ARG_CLEANUP_SHM
 
69
    ARG_CLEANUP_SHM,
 
70
    ARG_START
70
71
};
71
72
 
72
73
/* Tabel for getopt_long() */
82
83
    {"high-priority",               2, 0, ARG_HIGH_PRIORITY},
83
84
    {"realtime",                    2, 0, ARG_REALTIME},
84
85
    {"disallow-module-loading",     2, 0, ARG_DISALLOW_MODULE_LOADING},
 
86
    {"disallow-exit",               2, 0, ARG_DISALLOW_EXIT},
85
87
    {"exit-idle-time",              2, 0, ARG_EXIT_IDLE_TIME},
86
88
    {"module-idle-time",            2, 0, ARG_MODULE_IDLE_TIME},
87
89
    {"scache-idle-time",            2, 0, ARG_SCACHE_IDLE_TIME},
91
93
    {"dl-search-path",              1, 0, ARG_DL_SEARCH_PATH},
92
94
    {"resample-method",             1, 0, ARG_RESAMPLE_METHOD},
93
95
    {"kill",                        0, 0, ARG_KILL},
 
96
    {"start",                       0, 0, ARG_START},
94
97
    {"use-pid-file",                2, 0, ARG_USE_PID_FILE},
95
98
    {"check",                       0, 0, ARG_CHECK},
96
99
    {"system",                      2, 0, ARG_SYSTEM},
111
114
    else
112
115
        e = argv0;
113
116
 
114
 
    printf("%s [options]\n\n"
 
117
    printf(_("%s [options]\n\n"
115
118
           "COMMANDS:\n"
116
119
           "  -h, --help                            Show this help\n"
117
120
           "      --version                         Show version\n"
119
122
           "      --dump-modules                    Dump list of available modules\n"
120
123
           "      --dump-resample-methods           Dump available resample methods\n"
121
124
           "      --cleanup-shm                     Cleanup stale shared memory segments\n"
 
125
           "      --start                           Start the daemon if it is not running\n"
122
126
           "  -k  --kill                            Kill a running daemon\n"
123
127
           "      --check                           Check for a running daemon\n\n"
124
128
 
132
136
           "      --realtime[=BOOL]                 Try to enable realtime scheduling\n"
133
137
           "                                        (only available as root, when SUID or\n"
134
138
           "                                        with elevated RLIMIT_RTPRIO)\n"
135
 
           "      --disallow-module-loading[=BOOL]  Disallow module loading after startup\n"
 
139
           "      --disallow-module-loading[=BOOL]  Disallow module user requested module\n"
 
140
           "                                        loading/unloading after startup\n"
 
141
           "      --disallow-exit[=BOOL]            Disallow user requested exit\n"
136
142
           "      --exit-idle-time=SECS             Terminate the daemon when idle and this\n"
137
143
           "                                        time passed\n"
138
144
           "      --module-idle-time=SECS           Unload autoloaded modules when idle and\n"
159
165
           "  -C                                    Open a command line on the running TTY\n"
160
166
           "                                        after startup\n\n"
161
167
 
162
 
           "  -n                                    Don't load default script file\n", e);
 
168
           "  -n                                    Don't load default script file\n"), e);
163
169
}
164
170
 
165
171
int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d) {
207
213
                conf->cmd = PA_CMD_KILL;
208
214
                break;
209
215
 
 
216
            case ARG_START:
 
217
                conf->cmd = PA_CMD_START;
 
218
                conf->daemonize = TRUE;
 
219
                break;
 
220
 
210
221
            case ARG_CHECK:
211
222
                conf->cmd = PA_CMD_CHECK;
212
223
                break;
231
242
            case ARG_DAEMONIZE:
232
243
            case 'D':
233
244
                if ((conf->daemonize = optarg ? pa_parse_boolean(optarg) : TRUE) < 0) {
234
 
                    pa_log("--daemonize expects boolean argument");
 
245
                    pa_log(_("--daemonize expects boolean argument"));
235
246
                    goto fail;
236
247
                }
237
248
                break;
238
249
 
239
250
            case ARG_FAIL:
240
251
                if ((conf->fail = optarg ? pa_parse_boolean(optarg) : TRUE) < 0) {
241
 
                    pa_log("--fail expects boolean argument");
 
252
                    pa_log(_("--fail expects boolean argument"));
242
253
                    goto fail;
243
254
                }
244
255
                break;
248
259
 
249
260
                if (optarg) {
250
261
                    if (pa_daemon_conf_set_log_level(conf, optarg) < 0) {
251
 
                        pa_log("--log-level expects log level argument (either numeric in range 0..4 or one of debug, info, notice, warn, error).");
 
262
                        pa_log(_("--log-level expects log level argument (either numeric in range 0..4 or one of debug, info, notice, warn, error)."));
252
263
                        goto fail;
253
264
                    }
254
265
                } else {
260
271
 
261
272
            case ARG_HIGH_PRIORITY:
262
273
                if ((conf->high_priority = optarg ? pa_parse_boolean(optarg) : TRUE) < 0) {
263
 
                    pa_log("--high-priority expects boolean argument");
 
274
                    pa_log(_("--high-priority expects boolean argument"));
264
275
                    goto fail;
265
276
                }
266
277
                break;
267
278
 
268
279
            case ARG_REALTIME:
269
280
                if ((conf->realtime_scheduling = optarg ? pa_parse_boolean(optarg) : TRUE) < 0) {
270
 
                    pa_log("--realtime expects boolean argument");
 
281
                    pa_log(_("--realtime expects boolean argument"));
271
282
                    goto fail;
272
283
                }
273
284
                break;
274
285
 
275
286
            case ARG_DISALLOW_MODULE_LOADING:
276
287
                if ((conf->disallow_module_loading = optarg ? pa_parse_boolean(optarg) : TRUE) < 0) {
277
 
                    pa_log("--disallow-module-loading expects boolean argument");
 
288
                    pa_log(_("--disallow-module-loading expects boolean argument"));
 
289
                    goto fail;
 
290
                }
 
291
                break;
 
292
 
 
293
            case ARG_DISALLOW_EXIT:
 
294
                if ((conf->disallow_exit = optarg ? pa_parse_boolean(optarg) : TRUE) < 0) {
 
295
                    pa_log(_("--disallow-exit boolean argument"));
278
296
                    goto fail;
279
297
                }
280
298
                break;
281
299
 
282
300
            case ARG_USE_PID_FILE:
283
301
                if ((conf->use_pid_file = optarg ? pa_parse_boolean(optarg) : TRUE) < 0) {
284
 
                    pa_log("--use-pid-file expects boolean argument");
 
302
                    pa_log(_("--use-pid-file expects boolean argument"));
285
303
                    goto fail;
286
304
                }
287
305
                break;
293
311
                break;
294
312
 
295
313
            case 'n':
296
 
                pa_xfree(conf->default_script_file);
297
 
                conf->default_script_file = NULL;
 
314
                conf->load_default_script_file = FALSE;
298
315
                break;
299
316
 
300
317
            case ARG_LOG_TARGET:
301
318
                if (pa_daemon_conf_set_log_target(conf, optarg) < 0) {
302
 
                    pa_log("Invalid log target: use either 'syslog', 'stderr' or 'auto'.");
 
319
                    pa_log(_("Invalid log target: use either 'syslog', 'stderr' or 'auto'."));
303
320
                    goto fail;
304
321
                }
305
322
                break;
318
335
 
319
336
            case ARG_RESAMPLE_METHOD:
320
337
                if (pa_daemon_conf_set_resample_method(conf, optarg) < 0) {
321
 
                    pa_log("Invalid resample method '%s'.", optarg);
 
338
                    pa_log(_("Invalid resample method '%s'."), optarg);
322
339
                    goto fail;
323
340
                }
324
341
                break;
325
342
 
326
343
            case ARG_SYSTEM:
327
344
                if ((conf->system_instance = optarg ? pa_parse_boolean(optarg) : TRUE) < 0) {
328
 
                    pa_log("--system expects boolean argument");
 
345
                    pa_log(_("--system expects boolean argument"));
329
346
                    goto fail;
330
347
                }
331
348
                break;
332
349
 
333
350
            case ARG_NO_CPU_LIMIT:
334
351
                if ((conf->no_cpu_limit = optarg ? pa_parse_boolean(optarg) : TRUE) < 0) {
335
 
                    pa_log("--no-cpu-limit expects boolean argument");
 
352
                    pa_log(_("--no-cpu-limit expects boolean argument"));
336
353
                    goto fail;
337
354
                }
338
355
                break;
339
356
 
340
357
            case ARG_DISABLE_SHM:
341
358
                if ((conf->disable_shm = optarg ? pa_parse_boolean(optarg) : TRUE) < 0) {
342
 
                    pa_log("--disable-shm expects boolean argument");
 
359
                    pa_log(_("--disable-shm expects boolean argument"));
343
360
                    goto fail;
344
361
                }
345
362
                break;