Small utility allowing the printing of argpar options.
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ic39ce6f7eebfc3cb1d3fb12873862e9edd563dc6
+/*
+ * Same as list_cmd_options, but for options specified for argpar.
+ */
+void list_cmd_options_argpar(FILE *ofp, const struct argpar_opt_descr *options)
+{
+ int i;
+
+ for (i = 0; options[i].long_name != NULL; i++) {
+ const struct argpar_opt_descr *option = &options[i];
+
+ fprintf(ofp, "--%s\n", option->long_name);
+
+ if (isprint(option->short_name)) {
+ fprintf(ofp, "-%c\n", option->short_name);
+ }
+ }
+}
+
/*
* fls: returns the position of the most significant bit.
* Returns 0 if no bit is set, else returns the position of the most
/*
* fls: returns the position of the most significant bit.
* Returns 0 if no bit is set, else returns the position of the most
#define _LTTNG_UTILS_H
#include <popt.h>
#define _LTTNG_UTILS_H
#include <popt.h>
+#include "common/argpar/argpar.h"
char *get_session_name_quiet(void);
void list_commands(struct cmd_struct *commands, FILE *ofp);
void list_cmd_options(FILE *ofp, struct poptOption *options);
char *get_session_name_quiet(void);
void list_commands(struct cmd_struct *commands, FILE *ofp);
void list_cmd_options(FILE *ofp, struct poptOption *options);
+void list_cmd_options_argpar(FILE *ofp, const struct argpar_opt_descr *options);
/*
* Return the minimum order for which x <= (1UL << order).
/*
* Return the minimum order for which x <= (1UL << order).