-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
67 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: esali <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2023/06/12 16:57:31 by simao #+# #+# */ | ||
/* Updated: 2023/08/12 15:35:17 by esali ### ########.fr */ | ||
/* Updated: 2023/08/12 16:44:45 by esali ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -36,7 +36,7 @@ int calc_exit(int exit) | |
return (0); | ||
else if (exit < 0) | ||
{ | ||
while(exit < 0) | ||
while (exit < 0) | ||
exit = exit + 256; | ||
} | ||
else | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: esali <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2023/06/12 16:57:50 by simao #+# #+# */ | ||
/* Updated: 2023/08/10 20:23:38 by esali ### ########.fr */ | ||
/* Updated: 2023/08/12 16:50:16 by esali ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -25,7 +25,7 @@ void cmd_unset(char **variable) | |
if (!variable[1]) | ||
return ; | ||
i = 1; | ||
while(variable[i]) | ||
while (variable[i]) | ||
{ | ||
lst = get_env(); | ||
while (lst->nxt != NULL) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: esali <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2023/06/20 17:16:06 by esali #+# #+# */ | ||
/* Updated: 2023/08/12 16:02:35 by esali ### ########.fr */ | ||
/* Updated: 2023/08/12 16:49:55 by esali ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -185,7 +185,6 @@ void print_export_error(char *msg); | |
int maxlen(char *s1, char *s2); | ||
void increase_shlvl(void); | ||
|
||
|
||
/* File Handling */ | ||
|
||
void reset_original_std(void); | ||
|
@@ -198,5 +197,4 @@ int its_a_pipe(t_list *node); | |
int its_append(t_list *node); | ||
int its_heredoc(t_list *node); | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,12 +6,25 @@ | |
/* By: esali <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2023/06/20 18:04:06 by esali #+# #+# */ | ||
/* Updated: 2023/08/06 11:20:59 by esali ### ########.fr */ | ||
/* Updated: 2023/08/12 16:43:25 by esali ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#include "../minishell.h" | ||
|
||
int is_pipe(char *token) | ||
{ | ||
int len; | ||
|
||
if (ft_strlen(token) > 1) | ||
len = ft_strlen(token); | ||
else | ||
len = 1; | ||
if (ft_strncmp(token, "|", len) == 0) | ||
return (1); | ||
return (0); | ||
} | ||
|
||
// checks if token is redirection | ||
int is_red(char *token) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: esali <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2023/06/17 00:00:40 by esali #+# #+# */ | ||
/* Updated: 2023/08/07 15:43:56 by esali ### ########.fr */ | ||
/* Updated: 2023/08/12 16:20:35 by esali ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -105,13 +105,14 @@ char *change_env(char *input, int i) | |
|
||
/* checks if there is a valid char after $, | ||
and changes counter to the position after var expansion */ | ||
// && str[c[0] + 1] != '"' -> 117) | ||
char *manage_env(char *str, int *c) | ||
{ | ||
int len_diff; | ||
char *ret; | ||
|
||
ret = ft_strdup(str); | ||
if (str[c[0] + 1] && str[c[0] + 1] != ' ') // && str[c[0] + 1] != '"') | ||
if (str[c[0] + 1] && str[c[0] + 1] != ' ') | ||
{ | ||
len_diff = get_env_len_diff(ret, c[0]); | ||
ret = change_env(ret, c[0]); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,13 +6,12 @@ | |
/* By: esali <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2023/08/12 15:06:00 by esali #+# #+# */ | ||
/* Updated: 2023/08/12 16:06:05 by esali ### ########.fr */ | ||
/* Updated: 2023/08/12 16:40:56 by esali ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#include "../minishell.h" | ||
|
||
|
||
int is_digit(const char *s) | ||
{ | ||
int i; | ||
|
@@ -22,7 +21,7 @@ int is_digit(const char *s) | |
is_minus = 0; | ||
if (s[i] == '-' || s[i] == '+') | ||
{ | ||
if(s[i] == '-') | ||
if (s[i] == '-') | ||
is_minus = 1; | ||
i++; | ||
} | ||
|
@@ -32,7 +31,7 @@ int is_digit(const char *s) | |
return (0); | ||
i++; | ||
} | ||
if(is_minus) | ||
if (is_minus) | ||
return (2); | ||
return (1); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters