-
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
Minsu Kim
committed
Sep 13, 2022
1 parent
bc5f78b
commit 946c2e3
Showing
8 changed files
with
115 additions
and
60 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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: :::::::: */ | ||
/* dict_utils.c :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: minsuki2 <minsuki2@student.42seoul.kr +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2022/09/13 22:51:24 by minsuki2 #+# #+# */ | ||
/* Updated: 2022/09/13 23:29:36 by minsuki2 ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#include "minishell.h" | ||
|
||
t_dict *find_env_dict(t_dict *cur, const char *name) | ||
{ | ||
while (cur) | ||
{ | ||
if (check_match_word(cur->name, name) == TRUE) | ||
return (cur); | ||
cur = cur->next; | ||
} | ||
return (NULL); | ||
} | ||
|
||
// void erase_dict(char *name) | ||
// { | ||
// t_dict *find_node; | ||
// | ||
// find_node = find_env_dict(g_dict[chr_to_idx(*name)], ); | ||
// } | ||
|
||
// void add_dict(char *name, char *value) | ||
// { | ||
// } |
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
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: :::::::: */ | ||
/* about_env.c :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: minsuki2 <minsuki2@student.42seoul.kr +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2022/09/13 16:59:38 by minsuki2 #+# #+# */ | ||
/* Updated: 2022/09/13 23:02:24 by minsuki2 ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#include "minishell.h" | ||
|
||
#include "../minishell.h" | ||
|
||
char *my_getenv(const char *name) | ||
{ | ||
int idx; | ||
t_dict *find_node; | ||
|
||
idx = chr_to_idx(*name); | ||
find_node = find_env_dict(g_dict[idx].next, name); | ||
if (!find_node) | ||
return (NULL); | ||
return (find_node->value); | ||
} |