-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtxt
148 lines (117 loc) · 2.4 KB
/
txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
char* ft_strcat(char *dest, char *src)
{
char* p_dest;
char* p_src;
p_dest = dest;
while (*p_dest != '\0')
{
p_dest++;
}
p_src = src;
while (*p_src != '\0')
{
*p_dest++ = *p_src++;
}
*p_dest = '\0';
return dest;
}
void print_tree(t_node* root)
{
char indent[1024] = "";
if (root->right != NULL)
{
print_tree_node(root->right, true, "");
}
printf("[%s]\n", root->data);
if (root->left != NULL)
{
print_tree_node(root->left, false, "");
}
}
void print_tree_node(t_node* node, bool is_right, char *indent)
{
char r_indent[512];
char l_indent[512];
ft_strlcpy(r_indent, indent , 512);
ft_strlcpy(l_indent, indent , 512);
if (node->right != NULL)
{
print_tree_node(node->right, true, ft_strcat(r_indent, is_right ? " " : " | "));
}
printf("%s", indent);
if (is_right)
{
printf(" /");
}
else
{
printf(" \\");
}
printf("----- ");
printf("[%s]\n", node->data);
if (node->left != NULL)
{
print_tree_node(node->left, false, ft_strcat(l_indent, is_right ? " " : " | "));
}
}
static void print_envs(char **envs)
{
char **p_envs;
p_envs = envs;
while (*p_envs != NULL)
{
printf("%s\n", *p_envs);
++p_envs;
}
}
static void print_command(t_command *command)
{
int i;
i = 0;
while (i < command->num_token)
{
printf("%s\n", command->tokens[i]);
++i;
}
}
gcc -Wall -Werror -Wextra -I ./as_tree ./allow_function ./builtin ./command_initializer ./env_variable ./execute ./exit_code ./libft ./sig ./stdio_manager -I ~/.brew/opt/readline/include -c main.c -o objects/main.o
gcc -Wall -Werror -Wextra -I ./includes -I ~/.brew/opt/readline/include -c ./srcs/main.c -o objects/main.o
Prompt :echo <3
zsh: segmentation fault ./minishell
Prompt :ls
No such file or directory
echo O
env O
pwd O
ls -a | sort | grep e > txt
무한루프
시그널 -> o
add_history -> 증상파악못한걸로
파이프
Prompt :cat 1 | cat 2 | cat 3
cat: stdin: Bad file descriptor
cat: stdin: Bad file descriptor
pipe고치기
exit code 세팅
놈 고치기
<< : 제대로 작동하는지 체크
해결 :
Prompt :unset
Process 37975: 0 leaks for 0 total leaked bytes.
Prompt :echo $?
?
해결
bash-3.2$ ./minishell
Prompt :cat << a
> lsdnasldv dasldvskl asdv klnasdvl
> a
lsdnasldv dasldvskl asdv klnasdvl
Process 41554: 0 leaks for 0 total leaked bytes.
Prompt :echo << a
> lsadnsl asdvlknsdvlk
> a
Segmentation fault: 11
bash-3.2$
bash-3.2$ echo << a << b
> a
> b