void makeflow_wrapper_add_command( struct makeflow_wrapper *w, const char *cmd ) { if(!w->command) { w->command = xxstrdup(cmd); } else { char *command = string_wrap_command(w->command,cmd); free(w->command); w->command = command; } }
/* Takes node->command and wraps it in wrapper_command. Then, if in monitor * * mode, wraps the wrapped command in the monitor command. */ char *makeflow_wrap_wrapper( char *command, struct dag_node *n, struct makeflow_wrapper *w ) { if(!w) return xxstrdup(command); char *nodeid = string_format("%d",n->nodeid); char *wrap_tmp = string_replace_percents(w->command, nodeid); free(nodeid); char *result = string_wrap_command(command, wrap_tmp); free(wrap_tmp); return result; }
/** Wraps the specified command using string_wrap_command. See stringtools for a more detailed example of its use. Frees the previously set command after wrapping. */ void batch_task_wrap_command(struct batch_task *t, const char *command) { if(!command) return; char *id = string_format("%d",t->taskid); char *wrap_tmp = string_replace_percents(command, id); free(id); char *result = string_wrap_command(t->command, wrap_tmp); free(wrap_tmp); free(t->command); t->command = result; }