Fix: recv creds comm should handle partial receive
[lttng-tools.git] / src / bin / lttng / utils.c
index 94c4527d97ff293029f99dbdca79e3cbf6956caa..e40c3fd708e3d4c3d18bfcc7a0e8be1b7ee89ea3 100644 (file)
 #include <limits.h>
 
 #include <common/error.h>
+#include <common/utils.h>
 
 #include "conf.h"
 #include "utils.h"
+#include "command.h"
 
 /*
  *  get_session_name
@@ -36,7 +38,7 @@ char *get_session_name(void)
        char *path, *session_name = NULL;
 
        /* Get path to config file */
-       path = config_get_default_path();
+       path = utils_get_home_dir();
        if (path == NULL) {
                goto error;
        }
@@ -55,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
This page took 0.025211 seconds and 5 git commands to generate.