X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng%2Futils.c;h=e40c3fd708e3d4c3d18bfcc7a0e8be1b7ee89ea3;hp=6041655ddda0f6eb42de5b829cb29688c11f1a24;hb=3c9bd23cc5999729bb49a973d8c1e2bedef939bb;hpb=07bd66356a11f39a5e52d7150c30ce6ee7a9d993 diff --git a/src/bin/lttng/utils.c b/src/bin/lttng/utils.c index 6041655dd..e40c3fd70 100644 --- a/src/bin/lttng/utils.c +++ b/src/bin/lttng/utils.c @@ -25,6 +25,7 @@ #include "conf.h" #include "utils.h" +#include "command.h" /* * get_session_name @@ -56,6 +57,24 @@ error: return NULL; } +/* + * list_commands + * + * List commands line by line. This is mostly for bash auto completion and to + * avoid difficult parsing. + */ +void list_commands(struct cmd_struct *commands, FILE *ofp) +{ + int i = 0; + struct cmd_struct *cmd = NULL; + + cmd = &commands[i]; + while (cmd->name != NULL) { + fprintf(ofp, "%s\n", cmd->name); + i++; + cmd = &commands[i]; + } +} /* * list_cmd_options