fix: error in parsing is now right supported
This commit is contained in:
parent
770facd9d7
commit
a3bd87f956
@ -29,11 +29,8 @@ int main(int ac, char **av, char **env_str)
|
|||||||
{
|
{
|
||||||
cmds_list = parsing(line, env);
|
cmds_list = parsing(line, env);
|
||||||
free(line);
|
free(line);
|
||||||
if (cmds_list == NULL)
|
if (cmds_list != NULL)
|
||||||
{
|
{
|
||||||
lst_clear(env, &env_del);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
for (size_t i = 0; cmds_list[i] != NULL; i++)
|
for (size_t i = 0; cmds_list[i] != NULL; i++)
|
||||||
{
|
{
|
||||||
if (cmds_list_exec(cmds_list[i], env))
|
if (cmds_list_exec(cmds_list[i], env))
|
||||||
@ -43,6 +40,7 @@ int main(int ac, char **av, char **env_str)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
cmds_list_destroyer(cmds_list);
|
cmds_list_destroyer(cmds_list);
|
||||||
|
}
|
||||||
line = get_user_input(env);
|
line = get_user_input(env);
|
||||||
}
|
}
|
||||||
lst_clear(env, &env_del);
|
lst_clear(env, &env_del);
|
||||||
|
@ -1,9 +1,4 @@
|
|||||||
#include "../cmd/cmd.h"
|
#include "parsing.h"
|
||||||
#include "../utils/utils.h"
|
|
||||||
#include "../exec/exec.h"
|
|
||||||
#include "../../lib/bozolib/bozolib.h"
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
char* parsing_executable(const char* executable, lst** env)
|
char* parsing_executable(const char* executable, lst** env)
|
||||||
{
|
{
|
||||||
if (strchr("./", executable[0]))
|
if (strchr("./", executable[0]))
|
||||||
@ -13,9 +8,8 @@ char* parsing_executable(const char* executable, lst** env)
|
|||||||
|
|
||||||
int parsing_cmd(char *str, cmd* command, lst** env)
|
int parsing_cmd(char *str, cmd* command, lst** env)
|
||||||
{
|
{
|
||||||
// if (get_redirections(str, command))
|
if (get_redirections(str, command))
|
||||||
// return 1;
|
return 1;
|
||||||
// remove_redirections(str);
|
|
||||||
command->args = split_quoted_charset(str, "\t ");
|
command->args = split_quoted_charset(str, "\t ");
|
||||||
if (command->args == NULL)
|
if (command->args == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
@ -43,7 +37,11 @@ lst **parsing_pipe(const char *str, lst** env)
|
|||||||
current = *cmds;
|
current = *cmds;
|
||||||
for (size_t i = 0; cmds_str[i] != NULL; i++)
|
for (size_t i = 0; cmds_str[i] != NULL; i++)
|
||||||
{
|
{
|
||||||
parsing_cmd(cmds_str[i], current->content, env);
|
if (parsing_cmd(cmds_str[i], current->content, env))
|
||||||
|
{
|
||||||
|
tab_free((void**)cmds_str);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
current = current->next;
|
current = current->next;
|
||||||
}
|
}
|
||||||
tab_free((void**)cmds_str);
|
tab_free((void**)cmds_str);
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "../../lib/bozolib/bozolib.h"
|
|
||||||
|
|
||||||
|
#include "../exec/exec.h"
|
||||||
|
#include "../../lib/bozolib/bozolib.h"
|
||||||
|
#include "../redirection/redirection.h"
|
||||||
lst*** parsing(const char* str, lst** env);
|
lst*** parsing(const char* str, lst** env);
|
||||||
|
Loading…
Reference in New Issue
Block a user