exec_command_dump(c, f, prefix);
}
+void exec_command_append_list(ExecCommand **l, ExecCommand *e) {
+ ExecCommand *end;
+
+ assert(l);
+ assert(e);
+
+ if (*l) {
+ /* It's kinda important that we keep the order here */
+ LIST_FIND_TAIL(ExecCommand, command, *l, end);
+ LIST_INSERT_AFTER(ExecCommand, command, *l, end, e);
+ } else
+ *l = e;
+}
+
static const char* const exec_output_table[_EXEC_OUTPUT_MAX] = {
[EXEC_OUTPUT_CONSOLE] = "console",
[EXEC_OUTPUT_NULL] = "null",
char *exec_command_line(ExecCommand *c);
void exec_command_dump(ExecCommand *c, FILE *f, const char *prefix);
void exec_command_dump_list(ExecCommand *c, FILE *f, const char *prefix);
+void exec_command_append_list(ExecCommand **l, ExecCommand *e);
void exec_context_init(ExecContext *c);
void exec_context_done(ExecContext *c);
void *data,
void *userdata) {
- ExecCommand **e = data, *ee, *nce = NULL;
+ ExecCommand **e = data, *nce = NULL;
char **n;
char *w;
unsigned k;
if (!(nce->path = strdup(n[0])))
goto fail;
- if (*e) {
- /* It's kinda important that we keep the order here */
- LIST_FIND_TAIL(ExecCommand, command, *e, ee);
- LIST_INSERT_AFTER(ExecCommand, command, *e, ee, nce);
- } else
- *e = nce;
+ exec_command_append_list(e, nce);
return 0;