Lines Matching refs:cmd

87 	struct command *cmd;  in command_new()  local
89 AURA_MALLOC(cmd, command); in command_new()
91 cmd->cmdline = NULL; in command_new()
92 cmd->desc = NULL; in command_new()
93 cmd->log_mode = COMMAND_LOG_VERBOSE; in command_new()
94 cmd->failure_mode = COMMAND_FAILURE_ABORT; in command_new()
95 cmd->tag = NULL; in command_new()
96 cmd->result = COMMAND_RESULT_NEVER_EXECUTED; in command_new()
97 cmd->output = NULL; in command_new()
99 cmd->next = NULL; in command_new()
101 cmds->head = cmd; in command_new()
103 cmds->tail->next = cmd; in command_new()
105 cmd->prev = cmds->tail; in command_new()
106 cmds->tail = cmd; in command_new()
108 return(cmd); in command_new()
120 struct command *cmd; in command_add() local
122 cmd = command_new(cmds); in command_add()
125 vasprintf(&cmd->cmdline, fmt, args); in command_add()
128 return(cmd); in command_add()
139 command_set_log_mode(struct command *cmd, int log_mode) in command_set_log_mode() argument
141 cmd->log_mode = log_mode; in command_set_log_mode()
152 command_set_failure_mode(struct command *cmd, int failure_mode) in command_set_failure_mode() argument
154 cmd->failure_mode = failure_mode; in command_set_failure_mode()
162 command_set_desc(struct command *cmd, const char *fmt, ...) in command_set_desc() argument
166 if (cmd->desc != NULL) in command_set_desc()
167 free(cmd->desc); in command_set_desc()
170 vasprintf(&cmd->desc, fmt, args); in command_set_desc()
178 command_set_tag(struct command *cmd, const char *fmt, ...) in command_set_tag() argument
182 if (cmd->tag != NULL) in command_set_tag()
183 free(cmd->tag); in command_set_tag()
186 vasprintf(&cmd->tag, fmt, args); in command_set_tag()
197 command_get_next(const struct command *cmd) in command_get_next() argument
199 return(cmd->next); in command_get_next()
203 command_get_cmdline(const struct command *cmd) in command_get_cmdline() argument
205 return(cmd->cmdline); in command_get_cmdline()
209 command_get_tag(const struct command *cmd) in command_get_tag() argument
211 return(cmd->tag); in command_get_tag()
215 command_get_result(const struct command *cmd) in command_get_result() argument
217 return(cmd->result); in command_get_result()
261 struct command *cmd; in commands_preview() local
266 for (cmd = cmds->head; cmd != NULL; cmd = cmd->next) { in commands_preview()
267 aura_buffer_cat(preview, cmd->cmdline); in commands_preview()
287 struct command *cmd, int *cancelled) in pipe_loop() argument
297 asprintf(&command, "(%s) 2>&1 </dev/null", cmd->cmdline); in pipe_loop()
344 if (cmd->log_mode == COMMAND_LOG_VERBOSE) { in pipe_loop()
346 } else if (cmd->log_mode != COMMAND_LOG_SILENT) { in pipe_loop()
380 struct command *cmd) in command_execute() argument
386 if (cmd->desc != NULL) in command_execute()
387 dfui_info_set_short_desc(dfui_progress_get_info(pr), cmd->desc); in command_execute()
389 dfui_info_set_short_desc(dfui_progress_get_info(pr), cmd->cmdline); in command_execute()
399 if (cmd->log_mode != COMMAND_LOG_SILENT) in command_execute()
400 i_log(a, ",-<<< Executing `%s'", cmd->cmdline); in command_execute()
401 cmd->result = pipe_loop(a, pr, cmd, &cancelled); in command_execute()
402 if (cmd->log_mode != COMMAND_LOG_SILENT) in command_execute()
403 i_log(a, "`->>> Exit status: %d\n", cmd->result); in command_execute()
418 cmd->cmdline)) { in command_execute()
430 cmd->result = COMMAND_RESULT_CANCELLED; in command_execute()
436 cmd->result = COMMAND_RESULT_SKIPPED; in command_execute()
446 } else if (cmd->failure_mode == COMMAND_FAILURE_IGNORE) { in command_execute()
447 cmd->result = 0; in command_execute()
449 } else if (cmd->result != 0 && cmd->failure_mode != COMMAND_FAILURE_WARN) { in command_execute()
459 cmd->cmdline, cmd->result)) { in command_execute()
471 cmd->result = COMMAND_RESULT_CANCELLED; in command_execute()
478 cmd->result = COMMAND_RESULT_SKIPPED; in command_execute()
493 return(cmd->result); in command_execute()
505 struct command *cmd; in commands_execute() local
511 cmd = cmds->head; in commands_execute()
512 while (cmd != NULL) { in commands_execute()
514 cmd = cmd->next; in commands_execute()
527 for (cmd = cmds->head; cmd != NULL; cmd = cmd->next, i++) { in commands_execute()
528 result = command_execute(a, pr, cmd); in commands_execute()
535 if (cmd->failure_mode == COMMAND_FAILURE_ABORT) { in commands_execute()
557 struct command *cmd, *next; in commands_free() local
559 cmd = cmds->head; in commands_free()
560 while (cmd != NULL) { in commands_free()
561 next = cmd->next; in commands_free()
562 if (cmd->cmdline != NULL) in commands_free()
563 free(cmd->cmdline); in commands_free()
564 if (cmd->desc != NULL) in commands_free()
565 free(cmd->desc); in commands_free()
566 if (cmd->tag != NULL) in commands_free()
567 free(cmd->tag); in commands_free()
568 AURA_FREE(cmd, command); in commands_free()
569 cmd = next; in commands_free()