- ret = uri_parse(alloc_path, &ctrl_uri);
- if (ret < 1) {
- ret = CMD_FATAL;
- goto error;
- }
- } else if (opt_uris) { /* Handling URIs (-U opt) */
- size = parse_uri_from_str(opt_uris, &uris);
- if (size < 1) {
- ret = CMD_ERROR;
- goto error;
- } else if (size == 1 && uris[0].dtype != LTTNG_DST_PATH) {
- ERR("Only net:// and file:// are supported. "
- "Use -C and -D for more fine grained control");
- ret = CMD_ERROR;
- goto error;
- } else if (size == 2) {
- uris[0].stype = LTTNG_STREAM_CONTROL;
- uris[1].stype = LTTNG_STREAM_DATA;
-
- for (i = 0; i < size; i++) {
- /* Set default port if none was given */
- if (uris[i].port == 0) {
- if (uris[i].stype == LTTNG_STREAM_CONTROL) {
- uris[i].port = DEFAULT_NETWORK_CONTROL_PORT;
- } else {
- uris[i].port = DEFAULT_NETWORK_DATA_PORT;
- }
- }
- }
-
- ctrl_uri = &uris[0];
- print_uri_msg(ctrl_uri);
- data_uri = &uris[1];
- print_uri_msg(data_uri);
- } else {
- ctrl_uri = &uris[0];
- print_uri_msg(ctrl_uri);
- }
- } else if (opt_ctrl_uris || opt_data_uris) {
- /* Setting up control URI (-C opt) */
- if (opt_ctrl_uris) {
- size = parse_uri_from_str(opt_ctrl_uris, &uris);
- if (size < 1) {
- ret = CMD_ERROR;
- goto error;
- }
- ctrl_uri = &uris[0];
- ctrl_uri->stype = LTTNG_STREAM_CONTROL;
- /* Set default port if none specified */
- if (ctrl_uri->port == 0) {
- ctrl_uri->port = DEFAULT_NETWORK_CONTROL_PORT;
- }
- print_uri_msg(ctrl_uri);
- }
-
- /* Setting up data URI (-D opt) */
- if (opt_data_uris) {
- size = parse_uri_from_str(opt_data_uris, &uris);
- if (size < 1) {
- ret = CMD_ERROR;
- goto error;
- }
- data_uri = &uris[0];
- data_uri->stype = LTTNG_STREAM_DATA;
- /* Set default port if none specified */
- if (data_uri->port == 0) {
- data_uri->port = DEFAULT_NETWORK_DATA_PORT;
- }
- print_uri_msg(data_uri);
- }
- } else {