subsh bool

This commit is contained in:
Nathan Lebrun
2025-02-06 10:53:02 +01:00
parent 22c2f9ba02
commit 362a63a836
9 changed files with 29 additions and 28 deletions

View File

@@ -62,17 +62,13 @@ t_dio_node get_cmd_txt(t_ast_n *node)
// txt.redir = translate_redir(node->redir);
// txt.inf = ft_sprintf("Infile : %s%s", node->infile, NL);
// txt.outf = ft_sprintf("Outfile : %s", node->outfile);
txt.redir = "";
txt.inf = ft_sprintf("Infile : UNCHECKED");
txt.outf = ft_sprintf("Outfile : UNCHECKED");
txt.files = ft_sprintf("redir: UNCHECKED\n");
}
else
{
txt.cmd = ft_calloc(1, 1);
txt.args = ft_calloc(1, 1);
txt.redir = "";
txt.inf = ft_calloc(1, 1);
txt.outf = ft_calloc(1, 1);
txt.files = ft_calloc(1, 1);
}
return (txt);
}

View File

@@ -15,15 +15,19 @@
char *get_node_txt(t_ast_n *node)
{
t_dio_node txt;
char *out;
static char *subsh;
char *out;
txt = get_cmd_txt(node);
out = ft_sprintf("%s%s%s%s%s%s%s", txt.st, txt.cmd, txt.args,
NL, txt.redir, txt.inf, txt.outf);
if (node->sh == true)
subsh = " (subsh) ";
else
subsh = "";
out = ft_sprintf("%s%s%s%s%s", txt.st, txt.cmd, txt.args,
subsh, txt.files);
free(txt.cmd);
free(txt.args);
free(txt.inf);
free(txt.outf);
free(txt.files);
return (out);
}