Fix: POPT_ARG_LONGLONG does not exist in popt 1.13
[babeltrace.git] / cli / babeltrace-cfg-cli-args.c
index 6ff99871c55a03475c2ab3ad4c2b946efab8f1da..bd1bcc530ed07d3c4b8fc9b167dffb4158a1bcb0 100644 (file)
@@ -909,6 +909,9 @@ void bt_config_destroy(struct bt_object *obj)
                if (cfg->cmd_data.print_ctf_metadata.path) {
                        g_string_free(cfg->cmd_data.print_ctf_metadata.path,
                                TRUE);
+                       g_string_free(
+                               cfg->cmd_data.print_ctf_metadata.output_path,
+                               TRUE);
                }
                break;
        case BT_CONFIG_COMMAND_PRINT_LTTNG_LIVE_SESSIONS:
@@ -916,6 +919,9 @@ void bt_config_destroy(struct bt_object *obj)
                        g_string_free(
                                cfg->cmd_data.print_lttng_live_sessions.url,
                                TRUE);
+                       g_string_free(
+                               cfg->cmd_data.print_lttng_live_sessions.output_path,
+                               TRUE);
                }
                break;
        default:
@@ -1305,6 +1311,7 @@ enum {
        OPT_COMPONENT,
        OPT_CONNECT,
        OPT_DEBUG,
+       OPT_DEBUG_INFO,
        OPT_DEBUG_INFO_DIR,
        OPT_DEBUG_INFO_FULL_PATH,
        OPT_DEBUG_INFO_TARGET_PREFIX,
@@ -1316,7 +1323,6 @@ enum {
        OPT_LIST,
        OPT_NAME,
        OPT_NAMES,
-       OPT_NO_DEBUG_INFO,
        OPT_NO_DELTA,
        OPT_OMIT_HOME_PLUGIN_PATH,
        OPT_OMIT_SYSTEM_PLUGIN_PATH,
@@ -1659,6 +1665,12 @@ struct bt_config *bt_config_print_ctf_metadata_create(
                goto error;
        }
 
+       cfg->cmd_data.print_ctf_metadata.output_path = g_string_new(NULL);
+       if (!cfg->cmd_data.print_ctf_metadata.output_path) {
+               print_err_oom();
+               goto error;
+       }
+
        goto end;
 
 error:
@@ -1687,6 +1699,13 @@ struct bt_config *bt_config_print_lttng_live_sessions_create(
                goto error;
        }
 
+       cfg->cmd_data.print_lttng_live_sessions.output_path =
+               g_string_new(NULL);
+       if (!cfg->cmd_data.print_lttng_live_sessions.output_path) {
+               print_err_oom();
+               goto error;
+       }
+
        goto end;
 
 error:
@@ -2355,7 +2374,7 @@ struct bt_config *bt_config_run_from_args(int argc, const char *argv[],
        struct bt_value *connection_args = NULL;
        GString *cur_param_key = NULL;
        char error_buf[256] = { 0 };
-       long long retry_duration = -1;
+       long retry_duration = -1;
        struct poptOption run_long_options[] = {
                { "base-params", 'b', POPT_ARG_STRING, NULL, OPT_BASE_PARAMS, NULL, NULL },
                { "component", 'c', POPT_ARG_STRING, NULL, OPT_COMPONENT, NULL, NULL },
@@ -2368,7 +2387,7 @@ struct bt_config *bt_config_run_from_args(int argc, const char *argv[],
                { "params", 'p', POPT_ARG_STRING, NULL, OPT_PARAMS, NULL, NULL },
                { "plugin-path", '\0', POPT_ARG_STRING, NULL, OPT_PLUGIN_PATH, NULL, NULL },
                { "reset-base-params", 'r', POPT_ARG_NONE, NULL, OPT_RESET_BASE_PARAMS, NULL, NULL },
-               { "retry-duration", '\0', POPT_ARG_LONGLONG, &retry_duration, OPT_RETRY_DURATION, NULL, NULL },
+               { "retry-duration", '\0', POPT_ARG_LONG, &retry_duration, OPT_RETRY_DURATION, NULL, NULL },
                { "value", '\0', POPT_ARG_STRING, NULL, OPT_VALUE, NULL, NULL },
                { NULL, 0, '\0', NULL, 0, NULL, NULL },
        };
@@ -2760,6 +2779,8 @@ void print_convert_usage(FILE *fp)
        fprintf(fp, "      --run-args-0                  Print the equivalent arguments for the\n");
        fprintf(fp, "                                    `run` command to the standard output,\n");
        fprintf(fp, "                                    formatted for `xargs -0`, and quit\n");
+       fprintf(fp, "      --stream-intersection         Only process events when all streams\n");
+       fprintf(fp, "                                    are active\n");
        fprintf(fp, "  -u, --url=URL                     Set the `url` string parameter of the\n");
        fprintf(fp, "                                    current component to URL\n");
        fprintf(fp, "  -h, --help                        Show this help and quit\n");
@@ -2768,8 +2789,6 @@ void print_convert_usage(FILE *fp)
        fprintf(fp, "\n");
        fprintf(fp, "      --clock-offset=SEC            Set clock offset to SEC seconds\n");
        fprintf(fp, "      --clock-offset-ns=NS          Set clock offset to NS ns\n");
-       fprintf(fp, "      --stream-intersection         Only process events when all streams\n");
-       fprintf(fp, "                                    are active\n");
        fprintf(fp, "\n");
        fprintf(fp, "Implicit `sink.text.pretty` component options:\n");
        fprintf(fp, "\n");
@@ -2813,6 +2832,8 @@ void print_convert_usage(FILE *fp)
        fprintf(fp, "\n");
        fprintf(fp, "Implicit `filter.lttng-utils.debug-info` component options:\n");
        fprintf(fp, "\n");
+       fprintf(fp, "      --debug-info                  Create an implicit\n");
+       fprintf(fp, "                                    `filter.lttng-utils.debug-info` component\n");
        fprintf(fp, "      --debug-info-dir=DIR          Search for debug info in directory DIR\n");
        fprintf(fp, "                                    instead of `/usr/lib/debug`\n");
        fprintf(fp, "      --debug-info-full-path        Show full debug info source and\n");
@@ -2821,8 +2842,6 @@ void print_convert_usage(FILE *fp)
        fprintf(fp, "                                    Use directory DIR as a prefix when\n");
        fprintf(fp, "                                    looking up executables during debug\n");
        fprintf(fp, "                                    info analysis\n");
-       fprintf(fp, "      --no-debug-info               Do not create an implicit\n");
-       fprintf(fp, "                                    `lttng-utils.debug-info` filter component\n");
        fprintf(fp, "\n");
        fprintf(fp, "Legacy options that still work:\n");
        fprintf(fp, "\n");
@@ -2880,7 +2899,7 @@ struct poptOption convert_long_options[] = {
        { "input-format", 'i', POPT_ARG_STRING, NULL, OPT_INPUT_FORMAT, NULL, NULL },
        { "name", '\0', POPT_ARG_STRING, NULL, OPT_NAME, NULL, NULL },
        { "names", 'n', POPT_ARG_STRING, NULL, OPT_NAMES, NULL, NULL },
-       { "no-debug-info", '\0', POPT_ARG_NONE, NULL, OPT_NO_DEBUG_INFO, NULL, NULL },
+       { "debug-info", '\0', POPT_ARG_NONE, NULL, OPT_DEBUG_INFO, NULL, NULL },
        { "no-delta", '\0', POPT_ARG_NONE, NULL, OPT_NO_DELTA, NULL, NULL },
        { "omit-home-plugin-path", '\0', POPT_ARG_NONE, NULL, OPT_OMIT_HOME_PLUGIN_PATH, NULL, NULL },
        { "omit-system-plugin-path", '\0', POPT_ARG_NONE, NULL, OPT_OMIT_SYSTEM_PLUGIN_PATH, NULL, NULL },
@@ -3552,7 +3571,7 @@ end:
 static
 struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                int *retcode, bool force_omit_system_plugin_path,
-               bool force_omit_home_plugin_path, bool force_no_debug_info,
+               bool force_omit_home_plugin_path,
                struct bt_value *initial_plugin_paths, char *log_level)
 {
        poptContext pc = NULL;
@@ -3627,7 +3646,7 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
        }
 
        if (init_implicit_component_args(&implicit_debug_info_args,
-                       "filter.lttng-utils.debug-info", !force_no_debug_info)) {
+                       "filter.lttng-utils.debug-info", false)) {
                goto error;
        }
 
@@ -3926,6 +3945,7 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                case OPT_CLOCK_SECONDS:
                case OPT_COLOR:
                case OPT_DEBUG:
+               case OPT_DEBUG_INFO:
                case OPT_DEBUG_INFO_DIR:
                case OPT_DEBUG_INFO_FULL_PATH:
                case OPT_DEBUG_INFO_TARGET_PREFIX:
@@ -3933,7 +3953,6 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                case OPT_FIELDS:
                case OPT_INPUT_FORMAT:
                case OPT_NAMES:
-               case OPT_NO_DEBUG_INFO:
                case OPT_NO_DELTA:
                case OPT_OUTPUT_FORMAT:
                case OPT_OUTPUT:
@@ -4098,13 +4117,13 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                                goto error;
                        }
                        break;
-               case OPT_NO_DEBUG_INFO:
-                       implicit_debug_info_args.exists = false;
+               case OPT_DEBUG_INFO:
+                       implicit_debug_info_args.exists = true;
                        break;
                case OPT_DEBUG_INFO_DIR:
                        implicit_debug_info_args.exists = true;
                        ret = append_implicit_component_extra_param(
-                               &implicit_debug_info_args, "dir", arg);
+                               &implicit_debug_info_args, "debug-info-dir", arg);
                        if (ret) {
                                goto error;
                        }
@@ -4319,6 +4338,13 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                gs_leftover = leftovers->data;
                g_string_assign(cfg->cmd_data.print_ctf_metadata.path,
                        gs_leftover->str);
+
+               if (output) {
+                       g_string_assign(
+                               cfg->cmd_data.print_ctf_metadata.output_path,
+                               output);
+               }
+
                goto end;
        }
 
@@ -4406,6 +4432,13 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
 
                                g_string_assign(cfg->cmd_data.print_lttng_live_sessions.url,
                                        gs_leftover->str);
+
+                               if (output) {
+                                       g_string_assign(
+                                               cfg->cmd_data.print_lttng_live_sessions.output_path,
+                                               output);
+                               }
+
                                goto end;
                        }
 
@@ -4786,7 +4819,7 @@ char log_level_from_arg(const char *arg)
 
 struct bt_config *bt_config_cli_args_create(int argc, const char *argv[],
                int *retcode, bool force_omit_system_plugin_path,
-               bool force_omit_home_plugin_path, bool force_no_debug_info,
+               bool force_omit_home_plugin_path,
                struct bt_value *initial_plugin_paths)
 {
        struct bt_config *config = NULL;
@@ -4933,7 +4966,7 @@ struct bt_config *bt_config_cli_args_create(int argc, const char *argv[],
        case COMMAND_TYPE_CONVERT:
                config = bt_config_convert_from_args(command_argc, command_argv,
                        retcode, force_omit_system_plugin_path,
-                       force_omit_home_plugin_path, force_no_debug_info,
+                       force_omit_home_plugin_path,
                        initial_plugin_paths, &log_level);
                break;
        case COMMAND_TYPE_LIST_PLUGINS:
This page took 0.026569 seconds and 4 git commands to generate.