Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement : 파이프 에러 수정 #82

Merged
merged 3 commits into from
Jan 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions execute/child.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: wonyang <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/11 23:33:05 by wonyang #+# #+# */
/* Updated: 2023/01/16 16:37:51 by wonyang ### ########seoul.kr */
/* Updated: 2023/01/16 21:18:36 by wonyang ### ########seoul.kr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -86,7 +86,7 @@ static pid_t fork_child(t_tnode *cmd_node, int *before_fd)
|| (tmp != STDIN_FILENO && ft_dup2(tmp, STDIN_FILENO) == ERROR)
|| ft_dup2(fd[1], STDOUT_FILENO) == ERROR
|| child_execute(cmd_node) == ERROR)
return (0);
exit(1);
}
if ((tmp != STDIN_FILENO && close(tmp) == -1)
|| close(fd[1]) == -1)
Expand Down
32 changes: 16 additions & 16 deletions parsing/wildcard.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
/* ::: :::::::: */
/* wildcard.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jeongmin <jeongmin@student.42.fr> +#+ +:+ +#+ */
/* By: wonyang <wonyang@student.42seoul.kr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/13 17:42:37 by jeongmin #+# #+# */
/* Updated: 2023/01/16 20:55:23 by jeongmin ### ########.fr */
/* Updated: 2023/01/16 21:51:53 by wonyang ### ########seoul.kr */
/* */
/* ************************************************************************** */

Expand All @@ -31,26 +31,26 @@ static t_token *make_node_token(char *line, t_ttype type)
return (token);
}

static bool match_wcard(char *pattern, char *dname)
static bool match_wcard(char *str, char *dname)
{
int len_p;
int len_w;
int nth;
int str_len;
int d_len;
int i;
int skip;

nth = 0;
len_p = ft_strlen(pattern);
len_w = ft_strlen(dname);
while (nth < len_p && nth < len_w && (pattern[nth] == dname[nth]))
nth++;
if (len_p == nth)
return (nth == len_w);
if (pattern[nth] == WILDCARD)
i = 0;
str_len = ft_strlen(str);
d_len = ft_strlen(dname);
while (i < str_len && i < d_len && (str[i] == dname[i]))
i++;
if (str_len == i)
return (i == d_len);
if (str[i] == WILDCARD)
{
skip = 0;
while (skip + nth <= len_w)
while (skip + i <= d_len)
{
if (match_wcard(pattern + nth + 1, dname + skip + nth))
if (match_wcard(str + i + 1, dname + skip + i))
return (true);
skip += 1;
}
Expand Down