-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbonus2.c
87 lines (80 loc) · 2.21 KB
/
bonus2.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* bonus2.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dbaldy <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/01/07 11:54:54 by dbaldy #+# #+# */
/* Updated: 2016/01/07 15:59:56 by dbaldy ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_ls.h"
void ft_print_nolong_s(t_car_list *temp)
{
while (temp != NULL)
{
if ((g_flag & OPT_A) != OPT_A && temp->name[0] != '.')
{
print_mins(temp);
ft_putendl(temp->name);
}
else if ((g_flag & OPT_MAJA) == OPT_MAJA &&
ft_strcmp(temp->name, ".") != 0 &&
ft_strcmp(temp->name, "..") != 0)
{
print_mins(temp);
ft_putendl(temp->name);
}
else if ((g_flag & OPT_A) == OPT_A)
{
print_mins(temp);
ft_putendl(temp->name);
}
temp = temp->next;
}
}
void ft_print_nolong(t_car_list *temp)
{
if ((g_flag & OPT_MINS) == OPT_MINS)
ft_print_nolong_s(temp);
else
{
while (temp != NULL)
{
if ((g_flag & OPT_A) != OPT_A && temp->name[0] != '.')
ft_putendl(temp->name);
else if ((g_flag & OPT_MAJA) == OPT_MAJA &&
ft_strcmp(temp->name, ".") != 0 &&
ft_strcmp(temp->name, "..") != 0)
ft_putendl(temp->name);
else if ((g_flag & OPT_A) == OPT_A)
ft_putendl(temp->name);
temp = temp->next;
}
}
}
int test_hidden(t_car_list *temp)
{
t_car_list *buf;
buf = temp;
while (buf != NULL)
{
if (buf->name[0] != '.')
return (1);
buf = buf->next;
}
return (0);
}
int test_2(t_car_list *temp)
{
t_car_list *buf;
buf = temp;
while (buf != NULL)
{
if (ft_strcmp(buf->name, ".") != 0 && ft_strcmp(buf->name, "..") != 0)
return (1);
buf = buf->next;
}
return (0);
}