]>
code.delx.au - pulseaudio/blob - src/cmdline.c
4 This file is part of polypaudio.
6 polypaudio is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published
8 by the Free Software Foundation; either version 2 of the License,
9 or (at your option) any later version.
11 polypaudio is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with polypaudio; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
36 void pa_cmdline_help(const char *argv0
) {
39 if ((e
= strrchr(argv0
, '/')))
44 printf("%s [options]\n"
45 " -L MODULE Load the specified plugin module with the specified argument\n"
46 " -F FILE Run the specified script\n"
47 " -C Open a command line on the running TTY\n"
48 " -D Daemonize after loading the modules\n"
49 " -f Dont quit when the startup fails\n"
50 " -v Verbose startup\n"
51 " -h Show this help\n", e
);
54 struct pa_cmdline
* pa_cmdline_parse(int argc
, char * const argv
[]) {
56 struct pa_cmdline
*cmdline
= NULL
;
57 struct pa_strbuf
*buf
= NULL
;
60 cmdline
= malloc(sizeof(struct pa_cmdline
));
62 cmdline
->daemonize
= cmdline
->help
= cmdline
->verbose
= 0;
65 buf
= pa_strbuf_new();
68 while ((c
= getopt(argc
, argv
, "L:F:CDhfv")) != -1) {
71 pa_strbuf_printf(buf
, "load %s\n", optarg
);
74 pa_strbuf_printf(buf
, ".include %s\n", optarg
);
77 pa_strbuf_puts(buf
, "load module-cli\n");
80 cmdline
->daemonize
= 1;
96 cmdline
->cli_commands
= pa_strbuf_tostring_free(buf
);
101 pa_cmdline_free(cmdline
);
107 void pa_cmdline_free(struct pa_cmdline
*cmd
) {
109 free(cmd
->cli_commands
);