/* By: dkaiser <dkaiser@student.42heilbronn.de +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/27 11:21:03 by dkaiser #+# #+# */
-/* Updated: 2024/08/11 12:22:45 by dkaiser ### ########.fr */
+/* Updated: 2024/09/13 16:18:29 by dkaiser ### ########.fr */
/* */
/* ************************************************************************** */
if (node == NULL)
return (NULL);
node->content.cmd.args = args;
- node->content.cmd.redirs[0] = redirs[0];
- node->content.cmd.redirs[1] = redirs[1];
- free(redirs);
- return (node);
+ if (redirs != NULL)
+ {
+ node->content.cmd.redirs[0] = redirs[0];
+ node->content.cmd.redirs[1] = redirs[1];
+ free(redirs);
+ return (node);
+ }
+ return (NULL);
}
t_node *new_string_node(char *string)
/* By: dkaiser <dkaiser@student.42heilbronn.de +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/22 15:16:53 by dkaiser #+# #+# */
-/* Updated: 2024/08/11 12:26:00 by dkaiser ### ########.fr */
+/* Updated: 2024/09/13 16:21:32 by dkaiser ### ########.fr */
/* */
/* ************************************************************************** */
static void print_ast_rec(t_node *ast, int indent)
{
- if (ast->type == CMD_NODE)
+ if (!ast)
+ panic("Parsing error");
+ else if (ast->type == CMD_NODE)
print_cmd_node(ast, indent);
else if (ast->type == PIPE_NODE)
{