-
Notifications
You must be signed in to change notification settings - Fork 0
/
files3.c
89 lines (82 loc) · 2.39 KB
/
files3.c
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* files3.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: zwalad <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/08/11 20:32:04 by zwalad #+# #+# */
/* Updated: 2022/08/25 01:12:53 by zwalad ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
t_list *south_herdo2(t_list *p)
{
char c;
c = p->line[p->i];
p->i++;
while (p->line[p->i] != c && p->line[p->i])
p->m->her[p->m->hr] = put_char(p->m->her[p->m->hr], p->line[p->i++]);
if (p->line[p->i] == c)
p->i++;
p->m->hflag = 1;
return (p);
}
t_list *south_inpu2(t_list *p)
{
char c;
c = p->line[p->i];
p->i++;
while (p->line[p->i] != c && p->line[p->i])
p->m->inf[p->m->ii] = put_char(p->m->inf[p->m->ii], p->line[p->i++]);
if (p->line[p->i] == c)
p->i++;
return (p);
}
t_list *south_herdo(t_list *p)
{
p->m->hflag = 0;
p->i += 2;
p->m->her[p->m->hr] = pr_strdup("");
p->i = skip_space(p->line, p->i);
while (check_ffile(p->line[p->i]) && p->line[p->i])
{
if (p->line[p->i] == '"' || p->line[p->i] == '\'')
p = south_herdo2(p);
else if (check_mfile(p->line[p->i]) && p->line[p->i])
p->m->her[p->m->hr] = put_char(p->m->her[p->m->hr], \
p->line[p->i++]);
else
break ;
}
if (p->m->her[p->m->hr][0] != 0)
{
p->m->hr++;
p->m->itype = HERDO;
}
return (p);
}
t_list *south_inpu(t_list *p)
{
p->i++;
p->m->inf[p->m->ii] = pr_strdup("");
p->i = skip_space(p->line, p->i);
while (check_ffile(p->line[p->i]) && p->line[p->i])
{
if (p->line[p->i] == '"' || p->line[p->i] == '\'')
p = south_inpu2(p);
else if (check_mfile(p->line[p->i]))
p->m->inf[p->m->ii] = put_char(p->m->inf[p->m->ii], \
p->line[p->i++]);
else
break ;
}
if (p->m->inf[p->m->ii][0] != 0)
{
p->m->ii++;
p->m->itype = INPU;
p->m->open[p->m->op] = INFF;
p->m->op++;
}
return (p);
}