Skip to content

Commit

Permalink
Merge pull request #82 from mingxoxo/implement/make-tmp-diractory
Browse files Browse the repository at this point in the history
Implement : 파이프 에러 수정
  • Loading branch information
wonyangs authored Jan 16, 2023
2 parents 3fa87f0 + e11c9d7 commit 73367ed
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
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

0 comments on commit 73367ed

Please sign in to comment.