if (config->verbose)
fprintf(stderr, "Waiting for daemon ...\n");
- break;
+ break;
}
}
static void help(FILE *f, const char *argv0) {
- fprintf(f,
- "%s [options] <service type>\n"
- "%s [options] -a\n"
- "%s [options] -D\n\n"
+ if (strstr(argv0, "domain"))
+ fprintf(f, "%s [options] \n\n", argv0);
+ else
+ fprintf(f,
+ "%s [options] <service type>\n"
+ "%s [options] -a\n"
+ "%s [options] -D\n\n",
+ argv0, argv0, argv0);
+
+ fprintf(f,
" -h --help Show this help\n"
" -V --version Show version\n"
" -D --browse-domains Browse for browsing domains instead of services\n"
" -c --cache Terminate after dumping all entries from the cache\n"
" -l --ignore-local Ignore local services\n"
" -r --resolve Resolve services found\n"
- " -f --no-fail Don't fail if the server is not available\n"
+ " -f --no-fail Don't fail if the daemon is not available\n"
#ifdef HAVE_GDBM
" -k --no-db-lookup Don't lookup service types\n"
#endif
- , argv0, argv0, argv0);
+ );
}
-static int parse_command_line(Config *c, int argc, char *argv[]) {
+static int parse_command_line(Config *c, const char *argv0, int argc, char *argv[]) {
int o;
static const struct option long_options[] = {
assert(c);
- c->command = COMMAND_BROWSE_SERVICES;
+ c->command = strstr(argv0, "domain") ? COMMAND_BROWSE_DOMAINS : COMMAND_BROWSE_SERVICES;
c->verbose =
c->terminate_on_cache_exhausted =
c->terminate_on_all_for_now =
c->command = COMMAND_BROWSE_DOMAINS;
break;
case 'd':
+ avahi_free(c->domain);
c->domain = avahi_strdup(optarg);
break;
case 'v':
if (n_columns < 40)
n_columns = 40;
- if (parse_command_line(&config, argc, argv) < 0)
+ if (parse_command_line(&config, argv0, argc, argv) < 0)
goto fail;
switch (config.command) {