clean up options

make sure we can use -v for verbose mode
This commit is contained in:
Wim Taymans 2020-04-02 14:34:02 +02:00
parent 1fd5be7101
commit b87c0a9270
8 changed files with 102 additions and 104 deletions

View file

@ -44,7 +44,7 @@ static void show_help(const char *name)
{
fprintf(stdout, "%s [options]\n"
" -h, --help Show this help\n"
" -v, --version Show version\n"
" --version Show version\n"
" -n, --name Daemon name (Default %s)\n",
name,
daemon_name);
@ -58,21 +58,22 @@ int main(int argc, char *argv[])
struct pw_properties *properties;
char *err = NULL;
static const struct option long_options[] = {
{"help", 0, NULL, 'h'},
{"version", 0, NULL, 'v'},
{"name", 1, NULL, 'n'},
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
{ "name", required_argument, NULL, 'n' },
{ NULL, 0, NULL, 0}
};
int c, res;
pw_init(&argc, &argv);
while ((c = getopt_long(argc, argv, "hvn:", long_options, NULL)) != -1) {
while ((c = getopt_long(argc, argv, "hVn:", long_options, NULL)) != -1) {
switch (c) {
case 'h' :
show_help(argv[0]);
return 0;
case 'v' :
case 'V' :
fprintf(stdout, "%s\n"
"Compiled with libpipewire %s\n"
"Linked with libpipewire %s\n",

View file

@ -1726,7 +1726,7 @@ static void show_help(const char *name)
fprintf(stdout, "%s [options]\n"
" -h, --help Show this help\n"
" -v, --version Show version\n"
" --version Show version\n"
" -e, --enabled Enabled options (default '%s')\n"
" -d, --disabled Disabled options (default '%s')\n"
" -p, --properties Extra properties as 'key=value { key=value }'\n",
@ -1749,11 +1749,11 @@ int main(int argc, char *argv[])
const char *opt_disabled = DEFAULT_DISABLED;
const char *opt_properties = NULL;
static const struct option long_options[] = {
{"help", 0, NULL, 'h'},
{"version", 0, NULL, 'v'},
{"enabled", 1, NULL, 'e'},
{"disabled", 1, NULL, 'd'},
{"properties", 1, NULL, 'p'},
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
{ "enabled", required_argument, NULL, 'e' },
{ "disabled", required_argument, NULL, 'd' },
{ "properties", required_argument, NULL, 'p' },
{ NULL, 0, NULL, 0}
};
size_t i;
@ -1761,12 +1761,12 @@ int main(int argc, char *argv[])
pw_init(&argc, &argv);
while ((c = getopt_long(argc, argv, "hve:d:p:", long_options, NULL)) != -1) {
while ((c = getopt_long(argc, argv, "hVe:d:p:", long_options, NULL)) != -1) {
switch (c) {
case 'h':
show_help(argv[0]);
return 0;
case 'v':
case 'V':
fprintf(stdout, "%s\n"
"Compiled with libpipewire %s\n"
"Linked with libpipewire %s\n",

View file

@ -902,6 +902,7 @@ static void show_usage(const char *name, bool is_error)
fprintf(fp,
" -h, --help Show this help\n"
" --version Show version\n"
" -v, --verbose Enable verbose operations\n"
"\n");
fprintf(fp,
@ -945,10 +946,6 @@ static void show_usage(const char *name, bool is_error)
" -m, --midi Midi mode\n"
"\n");
}
fprintf(fp,
" -v, --verbose Enable verbose operations\n"
"\n");
}
static int midi_play(struct data *d, void *src, unsigned int n_frames)

View file

@ -2749,7 +2749,7 @@ static void show_help(struct data *data, const char *name)
{
fprintf(stdout, "%s [options] [command]\n"
" -h, --help Show this help\n"
" -v, --version Show version\n"
" --version Show version\n"
" -d, --daemon Start as daemon (Default false)\n"
" -r, --remote Remote daemon name\n\n",
name);
@ -2765,22 +2765,22 @@ int main(int argc, char *argv[])
char *error;
bool daemon = false;
static const struct option long_options[] = {
{"help", 0, NULL, 'h'},
{"version", 0, NULL, 'v'},
{"daemon", 0, NULL, 'd'},
{"remote", 1, NULL, 'r'},
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
{ "daemon", no_argument, NULL, 'd' },
{ "remote", required_argument, NULL, 'r' },
{ NULL, 0, NULL, 0}
};
int c, i;
pw_init(&argc, &argv);
while ((c = getopt_long(argc, argv, "hvdr:", long_options, NULL)) != -1) {
while ((c = getopt_long(argc, argv, "hVdr:", long_options, NULL)) != -1) {
switch (c) {
case 'h':
show_help(&data, argv[0]);
return 0;
case 'v':
case 'V':
fprintf(stdout, "%s\n"
"Compiled with libpipewire %s\n"
"Linked with libpipewire %s\n",

View file

@ -747,7 +747,7 @@ static void show_help(const char *name)
{
fprintf(stdout, "%s [options]\n"
" -h, --help Show this help\n"
" -v, --version Show version\n"
" --version Show version\n"
" -a, --all Show all object types\n"
" -s, --smart Show linked objects only\n"
" -d, --detail Show all object properties\n"
@ -764,25 +764,25 @@ int main(int argc, char *argv[])
const char *opt_remote = NULL;
const char *dot_path = DEFAULT_DOT_PATH;
static const struct option long_options[] = {
{"help", 0, NULL, 'h'},
{"version", 0, NULL, 'v'},
{"all", 0, NULL, 'a'},
{"smart", 0, NULL, 's'},
{"detail", 0, NULL, 'd'},
{"remote", 1, NULL, 'r'},
{"output", 1, NULL, 'o'},
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
{ "all", no_argument, NULL, 'a' },
{ "smart", no_argument, NULL, 's' },
{ "detail", no_argument, NULL, 'd' },
{ "remote", required_argument, NULL, 'r' },
{ "output", required_argument, NULL, 'o' },
{ NULL, 0, NULL, 0}
};
int c;
pw_init(&argc, &argv);
while ((c = getopt_long(argc, argv, "hvasdr:o:", long_options, NULL)) != -1) {
while ((c = getopt_long(argc, argv, "hVasdr:o:", long_options, NULL)) != -1) {
switch (c) {
case 'h' :
show_help(argv[0]);
return 0;
case 'v' :
case 'V' :
fprintf(stdout, "%s\n"
"Compiled with libpipewire %s\n"
"Linked with libpipewire %s\n",

View file

@ -683,7 +683,7 @@ static void show_help(const char *name)
{
fprintf(stdout, "%s [options]\n"
" -h, --help Show this help\n"
" -v, --version Show version\n"
" --version Show version\n"
" -r, --remote Remote daemon name\n",
name);
}
@ -694,21 +694,21 @@ int main(int argc, char *argv[])
struct pw_loop *l;
const char *opt_remote = NULL;
static const struct option long_options[] = {
{"help", 0, NULL, 'h'},
{"version", 0, NULL, 'v'},
{"remote", 1, NULL, 'r'},
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
{ "remote", required_argument, NULL, 'r' },
{ NULL, 0, NULL, 0}
};
int c;
pw_init(&argc, &argv);
while ((c = getopt_long(argc, argv, "hvr:", long_options, NULL)) != -1) {
while ((c = getopt_long(argc, argv, "hVr:", long_options, NULL)) != -1) {
switch (c) {
case 'h':
show_help(argv[0]);
return 0;
case 'v':
case 'V':
fprintf(stdout, "%s\n"
"Compiled with libpipewire %s\n"
"Linked with libpipewire %s\n",

View file

@ -542,7 +542,7 @@ static void show_help(const char *name)
{
fprintf(stdout, "%s [options]\n"
" -h, --help Show this help\n"
" -v, --version Show version\n"
" --version Show version\n"
" -r, --remote Remote daemon name\n"
" -o, --output Profiler output name (default \"%s\")\n",
name,
@ -556,22 +556,22 @@ int main(int argc, char *argv[])
const char *opt_remote = NULL;
const char *opt_output = DEFAULT_FILENAME;
static const struct option long_options[] = {
{"help", 0, NULL, 'h'},
{"version", 0, NULL, 'v'},
{"remote", 1, NULL, 'r'},
{"output", 1, NULL, 'o'},
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
{ "remote", required_argument, NULL, 'r' },
{ "output", required_argument, NULL, 'o' },
{ NULL, 0, NULL, 0}
};
int c;
pw_init(&argc, &argv);
while ((c = getopt_long(argc, argv, "hvr:o:", long_options, NULL)) != -1) {
while ((c = getopt_long(argc, argv, "hVr:o:", long_options, NULL)) != -1) {
switch (c) {
case 'h':
show_help(argv[0]);
return 0;
case 'v':
case 'V':
fprintf(stdout, "%s\n"
"Compiled with libpipewire %s\n"
"Linked with libpipewire %s\n",