This commit is contained in:
LuckyLaszlo
2021-10-31 01:10:57 +02:00
parent c0ef57499a
commit 22d4bbfdd0
9 changed files with 27 additions and 17 deletions

View File

@@ -15,10 +15,10 @@
static char *init_prompt_base(void);
static char *init_prompt(char *prompt_base);
int init(t_all *c, char *envp[])
int init(t_all *c, char *envp[])
{
g_all = c;
ft_bzero(c, sizeof *c);
ft_bzero(c, sizeof (*c));
c->envp = ft_dup_2d_char_arr(envp);
if (!c->envp)
return (ft_reti_perror(0, "ft_dup_2d_char_arr(envp) error"));
@@ -32,7 +32,7 @@ int init(t_all *c, char *envp[])
if (isatty(STDIN_FILENO))
{
if (!set_terminal_attributes(&c->ori_termios, &c->interactive_termios,
&c->termios_changed))
&c->termios_changed))
return (ft_reti_perror(0, "set_terminal_attributes() error"));
}
return (1);

View File

@@ -11,6 +11,7 @@
/* ************************************************************************** */
#include "minishell.h"
int check_operators(t_token *t, char *input, int *i, int *t_i);
enum e_in_quote_state

View File

@@ -11,6 +11,7 @@
/* ************************************************************************** */
#include "minishell.h"
int fill_token(t_token *t, char *input, int *i, int *t_i);
static t_token *alloc_token(size_t content_len);
@@ -21,7 +22,7 @@ t_token *input_to_tokens(char *input)
t_token *t_head;
t_token *t_tmp;
size_t input_len;
input_len = ft_strlen(input);
t_head = alloc_token(input_len);
if (!t_head)
@@ -41,7 +42,7 @@ static t_token *alloc_token(size_t content_len)
{
t_token *token;
token = ft_calloc(1, sizeof *token);
token = ft_calloc(1, sizeof (*token));
if (!token)
return (NULL);
token->content = ft_calloc(content_len + 1, 1);

View File

@@ -11,6 +11,7 @@
/* ************************************************************************** */
#include "minishell.h"
int valid_io_redirect(t_token **token_list);
static int valid_command_rule1(t_token **token_list);

View File

@@ -11,6 +11,7 @@
/* ************************************************************************** */
#include "minishell.h"
int valid_command(t_token **token_list);
int valid_pipeline(t_token **token_list)

View File

@@ -11,6 +11,7 @@
/* ************************************************************************** */
#include "minishell.h"
int valid_pipeline(t_token **token_list);
int valid_syntax(t_token *token_list)
@@ -18,7 +19,7 @@ int valid_syntax(t_token *token_list)
if (valid_pipeline(&token_list))
return (1);
else
{ // WIP ERROR
{
ft_putstr_fd("minishell: syntax error near unexpected token \'", 2);
ft_putstr_fd(token_list->content, 2);
ft_putstr_fd("\'\n", 2);