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

@ -541,12 +541,12 @@ static void do_quit(void *data, int signal_number)
static void show_help(const char *name)
{
fprintf(stdout, "%s [options]\n"
" -h, --help Show this help\n"
" -v, --version Show version\n"
" -r, --remote Remote daemon name\n"
" -o, --output Profiler output name (default \"%s\")\n",
name,
DEFAULT_FILENAME);
" -h, --help Show this help\n"
" --version Show version\n"
" -r, --remote Remote daemon name\n"
" -o, --output Profiler output name (default \"%s\")\n",
name,
DEFAULT_FILENAME);
}
int main(int argc, char *argv[])
@ -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'},
{NULL, 0, NULL, 0}
{ "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",