babeltrace-cfg: add begin/end NS options
[babeltrace.git] / converter / babeltrace.c
index fed201e7d5fbe4cd228a598f8cc39f541d141320..62cff404b0c6b7c8af9fe83c868fa59e04f4a96a 100644 (file)
@@ -61,15 +61,13 @@ void print_component_classes_found(struct bt_component_factory *factory)
 {
        int count, i;
 
-       babeltrace_verbose = 1;
-
        if (!babeltrace_verbose) {
                return;
        }
 
        count = bt_component_factory_get_component_class_count(factory);
        if (count <= 0) {
-               fprintf(stderr, "No component classes found. Please make sure your plug-in search path is set correctly.");
+               fprintf(stderr, "No component classes found. Please make sure your plug-in search path is set correctly.\n");
                return;
        }
 
@@ -96,9 +94,9 @@ void print_component_classes_found(struct bt_component_factory *factory)
 
                printf_verbose("[%s - %s (%s)]\n", plugin_name, component_name,
                               component_type_str(type));
-               printf_verbose("\tpath: %s\n", path);
-               printf_verbose("\tauthor: %s\n", author);
-               printf_verbose("\tlicense: %s\n", license);
+               printf_verbose("\tpath: %s\n", path ? path : "None");
+               printf_verbose("\tauthor: %s\n", author ? author : "Unknown");
+               printf_verbose("\tlicense: %s\n", license ? license : "Unknown");
                printf_verbose("\tplugin description: %s\n",
                                plugin_description ? plugin_description : "None");
                printf_verbose("\tcomponent description: %s\n",
@@ -207,7 +205,7 @@ void print_value(struct bt_value *value, size_t indent, bool do_indent)
 static
 void print_bt_config_component(struct bt_config_component *bt_config_component)
 {
-       printf("  %s/%s\n", bt_config_component->plugin_name->str,
+       printf("  %s.%s\n", bt_config_component->plugin_name->str,
                bt_config_component->component_name->str);
        printf("    params:\n");
        print_value(bt_config_component->params, 6, true);
@@ -263,9 +261,12 @@ int main(int argc, char **argv)
                goto end;
        }
 
+       babeltrace_verbose = cfg->verbose;
+       babeltrace_debug = cfg->debug;
+
        /* TODO handle more than 1 source and 1 sink. */
        if (cfg->sources->len != 1 || cfg->sinks->len != 1) {
-               fprintf(stderr, "Unexpected configuration, aborting.../n");
+               fprintf(stderr, "Unexpected configuration, aborting...\n");
                ret = -1;
                goto end;
        }
@@ -278,12 +279,6 @@ int main(int argc, char **argv)
 
        printf_verbose("Verbose mode active.\n");
        printf_debug("Debug mode active.\n");
-
-       if (bt_value_array_is_empty(cfg->plugin_paths)) {
-               fprintf(stderr, "No plugin path specified, aborting...\n");
-               ret = -1;
-               goto end;
-       }
        component_factory = bt_component_factory_create();
        if (!component_factory) {
                fprintf(stderr, "Failed to create component factory.\n");
@@ -291,13 +286,22 @@ int main(int argc, char **argv)
                goto end;
        }
 
-       first_plugin_path_value = bt_value_array_get(cfg->plugin_paths, 0);
-       bt_value_string_get(first_plugin_path_value, &first_plugin_path);
+       if (cfg->plugin_paths && !bt_value_array_is_empty(cfg->plugin_paths)) {
+               first_plugin_path_value = bt_value_array_get(
+                               cfg->plugin_paths, 0);
+               bt_value_string_get(first_plugin_path_value,
+                               &first_plugin_path);
+               ret = bt_component_factory_load_recursive(component_factory,
+                               first_plugin_path);
+               if (ret) {
+                       fprintf(stderr, "Failed to dynamically load plugins.\n");
+                       goto end;
+               }
+       }
 
-       ret = bt_component_factory_load_recursive(component_factory,
-                       first_plugin_path);
+       ret = bt_component_factory_load_static(component_factory);
        if (ret) {
-               fprintf(stderr, "Failed to load plugins.\n");
+               fprintf(stderr, "Failed to load static plugins.\n");
                goto end;
        }
 
This page took 0.031878 seconds and 4 git commands to generate.