+static int launch_local(
+ struct afm_launch_desc *desc,
+ pid_t children[2],
+ struct launchparam *params
+)
+{
+ if (params->slave == NULL)
+ return launch_local_1(desc, children, params);
+ return launch_local_2(desc, children, params);
+}
+
+static int launch_remote(
+ struct afm_launch_desc *desc,
+ pid_t children[2],
+ struct launchparam *params
+)
+{
+ int rc;
+ char *uri;
+
+ /* instanciate the uri */
+ if (params->slave == NULL)
+ uri = strdup("");
+ else
+ uri = instantiate_arguments(params->slave, desc, params, 0).scalar;
+ if (uri == NULL) {
+ ERROR("out of memory for remote uri");
+ errno = ENOMEM;
+ return -1;
+ }
+
+ /* launch the command */
+ rc = launch_local_1(desc, children, params);
+ if (rc)
+ free(uri);
+ else
+ *params->uri = uri;
+ return rc;
+}
+