-/*
- * config_get_default_path
- *
- * Returns the HOME directory path. Caller MUST NOT free(3) the return pointer.
- */
-static
-char *config_get_default_path(void)
-{
- return getenv("HOME");
-}
-
-static
-char *create_output_path_auto(char *path_name)
-{
- int ret;
- char *traces_path = NULL;
- char *alloc_path = NULL;
- char *default_path;
-
- default_path = config_get_default_path();
- if (default_path == NULL) {
- ERR("Home path not found.\n \
- Please specify an output path using -o, --output PATH");
- goto exit;
- }
- alloc_path = strdup(default_path);
- if (alloc_path == NULL) {
- PERROR("Path allocation");
- goto exit;
- }
- ret = asprintf(&traces_path, "%s/" DEFAULT_TRACE_DIR_NAME
- "/%s", alloc_path, path_name);
- if (ret < 0) {
- PERROR("asprintf trace dir name");
- goto exit;
- }
-exit:
- free(alloc_path);
- return traces_path;
-}
-
-static
-char *create_output_path_noauto(char *path_name)
-{
- int ret;
- char *traces_path = NULL;
- char *full_path;
-
- full_path = utils_expand_path(opt_output_path);
- ret = asprintf(&traces_path, "%s/%s", full_path, path_name);
- if (ret < 0) {
- PERROR("asprintf trace dir name");
- goto exit;
- }
-exit:
- free(full_path);
- return traces_path;
-}
-
-/*
- * create_output_path: create the output trace directory
- */
-static
-char *create_output_path(char *path_name)
-{
- if (opt_output_path == NULL) {
- return create_output_path_auto(path_name);
- } else {
- return create_output_path_noauto(path_name);
- }
-}
-