-/*
- * Add output from the user URL (machine interface).
- */
-static int mi_add_output(const char *url)
-{
- int ret;
- struct lttng_snapshot_output *output = NULL;
- char name[NAME_MAX];
- const char *n_ptr;
-
- if (!url && (!opt_data_url || !opt_ctrl_url)) {
- ret = CMD_ERROR;
- goto error;
- }
-
- output = create_output_from_args(url);
- if (!output) {
- ret = CMD_FATAL;
- goto error;
- }
-
- /* This call, if successful, populates the id of the output object. */
- ret = lttng_snapshot_add_output(current_session_name, output);
- if (ret < 0) {
- goto error;
- }
-
- n_ptr = lttng_snapshot_output_get_name(output);
- if (*n_ptr == '\0') {
- int pret;
- pret = snprintf(name, sizeof(name), DEFAULT_SNAPSHOT_NAME "-%" PRIu32,
- lttng_snapshot_output_get_id(output));
- if (pret < 0) {
- PERROR("snprintf add output name");
- }
- n_ptr = name;
- }
-
- ret = mi_lttng_snapshot_add_output(writer, current_session_name, n_ptr,
- output);
- if (ret) {
- ret = CMD_ERROR;
- }
-
-error:
- lttng_snapshot_output_destroy(output);
- return ret;
-}
-