Skip to content

Commit 60fbeb0

Browse files
Merge pull request #219 from Bombatomica64/nominetting
Update file permissions and fix parser bugs
2 parents 85ac9d4 + 47858f0 commit 60fbeb0

4 files changed

Lines changed: 58 additions & 32 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ settings.json
5757

5858
#temp files
5959
.nfs*
60+
file*
6061

6162
# executables
6263
minishell

file1

Lines changed: 50 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,50 @@
1-
bash.pdf
2-
bonus
3-
built_in
4-
~c
5-
file
6-
file1
7-
file2
8-
file3
9-
file4
10-
ft_printf
11-
ignore_readline.supp
12-
lexer
13-
libft
14-
Makefile
15-
minishell
16-
minishell_tester
17-
parser
18-
philo
19-
pipex
20-
README.md
21-
srcs
22-
subject.pdf
23-
utils
24-
wewe
1+
total 2568
2+
-rwxrwxrwx 1 lmicheli 2023_florence 795771 Mar 4 17:47 bash.pdf
3+
drwxrwxrwx 2 lmicheli 2023_florence 4096 Mar 13 10:57 bonus
4+
drwxrwxrwx 2 lmicheli 2023_florence 4096 Mar 20 16:48 built_in
5+
-rwxrwxrwx 1 lmicheli 2023_florence 4 Feb 26 10:11 ~c
6+
-rwxrwxrwx 1 lmicheli 2023_florence 6 Mar 20 10:40 file
7+
-rwxr-xr-x 1 lmicheli 2023_florence 0 Mar 20 18:36 file1
8+
-rwxr-xr-x 1 lmicheli 2023_florence 0 Mar 20 15:53 file2
9+
-rwxrwxrwx 1 lmicheli 2023_florence 2825 Mar 18 16:20 file3
10+
-rwxrwxrwx 1 lmicheli 2023_florence 0 Feb 19 10:02 file4
11+
drwxrwxrwx 2 lmicheli 2023_florence 4096 Mar 13 10:57 ft_printf
12+
-rwxrwxrwx 1 lmicheli 2023_florence 92 Feb 28 10:02 ignore_readline.supp
13+
drwxrwxrwx 2 lmicheli 2023_florence 4096 Mar 19 11:22 lexer
14+
drwxrwxrwx 2 lmicheli 2023_florence 4096 Mar 20 18:35 libft
15+
-rwxr-xr-x 1 lmicheli 2023_florence 2786 Mar 20 10:16 Makefile
16+
-rwxr-xr-x 1 lmicheli 2023_florence 143176 Mar 20 18:36 minishell
17+
drwxr-xr-x 2 lmicheli 2023_florence 4096 Mar 19 18:20 minishell_tester
18+
drwxrwxrwx 2 lmicheli 2023_florence 4096 Mar 20 16:48 parser
19+
-rwxrwxrwx 1 lmicheli 2023_florence 48072 Mar 14 18:15 philo
20+
drwxrwxrwx 2 lmicheli 2023_florence 4096 Mar 19 11:22 pipex
21+
-rwxrwxrwx 1 lmicheli 2023_florence 96 Feb 19 11:59 README.md
22+
drwxrwxrwx 2 lmicheli 2023_florence 4096 Mar 19 18:20 srcs
23+
-rwxrwxrwx 1 lmicheli 2023_florence 1568461 Feb 6 18:07 subject.pdf
24+
drwxrwxrwx 2 lmicheli 2023_florence 4096 Mar 20 16:48 utils
25+
-rw-r--r-- 1 lmicheli 2023_florence 0 Mar 20 10:41 wewe
26+
total 2572
27+
-rwxrwxrwx 1 lmicheli 2023_florence 795771 Mar 4 17:47 bash.pdf
28+
drwxrwxrwx 2 lmicheli 2023_florence 4096 Mar 13 10:57 bonus
29+
drwxrwxrwx 2 lmicheli 2023_florence 4096 Mar 20 16:48 built_in
30+
-rwxrwxrwx 1 lmicheli 2023_florence 4 Feb 26 10:11 ~c
31+
-rwxrwxrwx 1 lmicheli 2023_florence 6 Mar 20 10:40 file
32+
-rwxr-xr-x 1 lmicheli 2023_florence 1571 Mar 20 18:36 file1
33+
-rwxr-xr-x 1 lmicheli 2023_florence 0 Mar 20 15:53 file2
34+
-rwxrwxrwx 1 lmicheli 2023_florence 2825 Mar 18 16:20 file3
35+
-rwxrwxrwx 1 lmicheli 2023_florence 0 Feb 19 10:02 file4
36+
drwxrwxrwx 2 lmicheli 2023_florence 4096 Mar 13 10:57 ft_printf
37+
-rwxrwxrwx 1 lmicheli 2023_florence 92 Feb 28 10:02 ignore_readline.supp
38+
drwxrwxrwx 2 lmicheli 2023_florence 4096 Mar 19 11:22 lexer
39+
drwxrwxrwx 2 lmicheli 2023_florence 4096 Mar 20 18:35 libft
40+
-rwxr-xr-x 1 lmicheli 2023_florence 2786 Mar 20 10:16 Makefile
41+
-rwxr-xr-x 1 lmicheli 2023_florence 143168 Mar 20 18:36 minishell
42+
drwxr-xr-x 2 lmicheli 2023_florence 4096 Mar 19 18:20 minishell_tester
43+
drwxrwxrwx 2 lmicheli 2023_florence 4096 Mar 20 16:48 parser
44+
-rwxrwxrwx 1 lmicheli 2023_florence 48072 Mar 14 18:15 philo
45+
drwxrwxrwx 2 lmicheli 2023_florence 4096 Mar 19 11:22 pipex
46+
-rwxrwxrwx 1 lmicheli 2023_florence 96 Feb 19 11:59 README.md
47+
drwxrwxrwx 2 lmicheli 2023_florence 4096 Mar 19 18:20 srcs
48+
-rwxrwxrwx 1 lmicheli 2023_florence 1568461 Feb 6 18:07 subject.pdf
49+
drwxrwxrwx 2 lmicheli 2023_florence 4096 Mar 20 16:48 utils
50+
-rw-r--r-- 1 lmicheli 2023_florence 0 Mar 20 10:41 wewe

parser/get_hicat.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/* By: lmicheli <lmicheli@student.42.fr> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2024/03/20 10:05:27 by gduranti #+# #+# */
9-
/* Updated: 2024/03/20 18:00:02 by lmicheli ### ########.fr */
9+
/* Updated: 2024/03/20 18:36:24 by lmicheli ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

@@ -19,7 +19,6 @@ t_bool get_command(int *off, char *str, t_parser *parser, t_data *data)
1919

2020
i = 0;
2121
squote = (t_quote){FALSE, 0};
22-
printf("parser->tmp: %s\n", parser->tmp);
2322
if (ft_islimiter(str[*off]) == TRUE)
2423
(*off)++;
2524
while (str[i])
@@ -31,7 +30,6 @@ t_bool get_command(int *off, char *str, t_parser *parser, t_data *data)
3130
i++;
3231
}
3332
parser->tmp = expand_name(parser->tmp, data, squote, off);
34-
printf("parser->tmp: %s\n", parser->tmp);
3533
return (TRUE);
3634
}
3735

@@ -57,7 +55,10 @@ t_bool get_inout(int *off, char *str, t_parser *parser, t_data *data)
5755
}
5856
*off = i;
5957
parser->tmp = expand_name(parser->tmp, data, squote, off);
60-
if ((ft_islimiter(str[i]) == FALSE && str[i]) || str[i] == '\0')
58+
*off += skip_spaces2(str + *off);
59+
if (str[*off] == '\0')
60+
return (TRUE);
61+
if ((ft_islimiter(str[i]) == FALSE && str[i + 1]))
6162
return (FALSE);
6263
return (TRUE);
6364
}
@@ -86,7 +87,6 @@ char *ft_reparsing(char *str, int i, t_data *data)
8687
args = ft_substr(str, i, j);
8788
dst = ft_strjoin_2free(args, file);
8889
dst = ft_newstrjoin(dst, str + j);
89-
printf("dst: %s\n", dst);
9090
return (free(str), ft_inputclear(&data->input), dst);
9191
}
9292
//echo ciao > "file1 |" pippo 'amico|' ls

parser/parser.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/* By: lmicheli <lmicheli@student.42.fr> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2024/02/27 11:11:17 by lmicheli #+# #+# */
9-
/* Updated: 2024/03/20 18:00:53 by lmicheli ### ########.fr */
9+
/* Updated: 2024/03/20 18:35:25 by lmicheli ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

@@ -16,7 +16,7 @@ t_bool get_name(char *str, t_parser *parser, t_data *data, int *off)
1616
{
1717
t_bool check;
1818

19-
check = FALSE;
19+
check = TRUE;
2020
if (parser->tmp_type == COMMAND)
2121
check = get_command(off, str, parser, data);
2222
else if (parser->tmp_type == HEREDOC || parser->tmp_type == INPUT
@@ -122,7 +122,6 @@ t_bool parser(char *str, t_data *data, int offset, t_parser parser)
122122
quote = (t_quote){FALSE, 0};
123123
while (str)
124124
{
125-
printf("str: %s\n", str);
126125
offset = skip_spaces2(str);
127126
parser.tmp_type = ft_file_type(str, &offset);
128127
error = get_name(str, &parser, data, &offset);

0 commit comments

Comments
 (0)