printf("all: list all keywords\n");
printf("cfg: configuration keywords\n");
printf("flt: filter names\n");
+ printf("svc: service names\n");
continue;
}
else if (strcmp(kwd_dump, "all") == 0) {
printf("# List of registered filter names:\n");
flt_dump_kws(NULL);
}
+
+ if (all || strcmp(kwd_dump, "svc") == 0) {
+ printf("# List of registered service names:\n");
+ list_services(NULL);
+ }
}
}
return action_lookup(&service_keywords, kw);
}
-/* Lists the known services on <out> */
+/* Lists the known services on <out>. If <out> is null, emit them on stdout one
+ * per line.
+ */
void list_services(FILE *out)
{
struct action_kw_list *kw_list;
int found = 0;
int i;
- fprintf(out, "Available services :");
+ if (out)
+ fprintf(out, "Available services :");
list_for_each_entry(kw_list, &service_keywords, list) {
for (i = 0; kw_list->kw[i].kw != NULL; i++) {
found = 1;
- fprintf(out, " %s", kw_list->kw[i].kw);
+ if (out)
+ fprintf(out, " %s", kw_list->kw[i].kw);
+ else
+ printf("%s\n", kw_list->kw[i].kw);
}
}
- if (!found)
+ if (!found && out)
fprintf(out, " none\n");
}