fixed argv open().

previously wrongly dup2() to STDIN.
This commit is contained in:
lperrey
2021-12-20 22:52:41 +01:00
parent 6a9b7bae1b
commit 8ed97346f7
11 changed files with 78 additions and 87 deletions

View File

@@ -6,13 +6,29 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/08 09:22:12 by lperrey #+# #+# */
/* Updated: 2021/12/18 04:28:46 by lperrey ### ########.fr */
/* Updated: 2021/12/20 22:25:46 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
char *init_prompt_base(void)
static char *init_prompt_base(void);
int init_prompt(t_all *c, int script_fd)
{
if (!script_fd && isatty(STDIN_FILENO))
{
c->prompt_base = init_prompt_base();
if (!c->prompt_base)
return (0);
c->prompt = update_prompt(c->prompt_base);
if (!c->prompt)
return (0);
}
return (1);
}
static char *init_prompt_base(void)
{
char *prompt_base;
char *tmp;
@@ -40,7 +56,7 @@ char *init_prompt_base(void)
return (prompt_base);
}
char *init_prompt(char *prompt_base)
char *update_prompt(char *prompt_base)
{
char *prompt;