-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflags.c
94 lines (88 loc) · 2.66 KB
/
flags.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
90
91
92
93
94
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* flags.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: akalombo <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/08/14 08:24:51 by akalombo #+# #+# */
/* Updated: 2019/08/14 08:25:13 by akalombo ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_ls.h"
//this method will be used to handle the flags
void flag_l(t_list *lst, t_list *head)
{
t_list *tmp;
tmp = head;
while (lst != head)
{
if (lst->fileName[0] != '.')
{
ft_putstr(lst->permits);
ft_putchar('\t');
ft_putnbr(lst->nLinks);
ft_putchar('\t');
ft_putstr(lst->user);
ft_putchar('\t');
ft_putstr(lst->group);
ft_putchar('\t');
ft_putnbr(lst->nBytes);
ft_putchar('\t');
ft_putstr(lst->last_modified);
ft_putchar('\t');
ft_putstr(lst->fileName);
ft_putchar('\n');
}
lst = lst->prev;
}
}
void flag_al(t_list *lst, t_list *head)
{
t_list *tmp;
tmp = head;
while (lst != head)
{
ft_putstr(lst->permits);
ft_putchar('\t');
ft_putnbr(lst->nLinks);
ft_putchar('\t');
ft_putstr(lst->user);
ft_putchar('\t');
ft_putstr(lst->group);
ft_putchar('\t');
ft_putnbr(lst->nBytes);
ft_putchar('\t');
ft_putstr(lst->last_modified);
ft_putchar('\t');
ft_putstr(lst->fileName);
ft_putchar('\n');
lst = lst->prev;
}
}
//method that will be used to show the fidden files
void flag_a(t_list *lst, t_list *head)
{
while (lst != head)
{
ft_putstr(lst->fileName);
ft_putchar('\n');
lst = lst->prev;
}
}
//method will be used to display the list when no flags are passed
void no_flag(t_list *lst, t_list *head)
{
int i;
i = 0;
while (lst != head)
{
if (lst->fileName[i] != '.')
{
ft_putstr(lst->fileName);
ft_putchar('\n');
}
i++;
lst = lst->prev;
}
}