+/*
+ * Convert `value` to its equivalent representation as a command line parameter
+ * value.
+ */
+
+static
+gchar *bt_value_to_cli_param_value(bt_value *value)
+{
+ GString *buf;
+ gchar *result = NULL;
+
+ buf = g_string_new(NULL);
+ if (!buf) {
+ print_err_oom();
+ goto error;
+ }
+
+ switch (bt_value_get_type(value)) {
+ case BT_VALUE_TYPE_STRING:
+ {
+ const char *str_value = bt_value_string_get(value);
+ gchar *escaped_str_value;
+
+ escaped_str_value = escape_string_value(str_value);
+ if (!escaped_str_value) {
+ goto error;
+ }
+
+ g_string_printf(buf, "\"%s\"", escaped_str_value);
+
+ g_free(escaped_str_value);
+ break;
+ }
+ default:
+ abort();
+ }
+
+ result = g_string_free(buf, FALSE);
+ buf = NULL;
+
+ goto end;
+
+error:
+ if (buf) {
+ g_string_free(buf, TRUE);
+ }
+
+end:
+ return result;
+}
+