-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprint_contents.c
More file actions
61 lines (55 loc) · 1.64 KB
/
print_contents.c
File metadata and controls
61 lines (55 loc) · 1.64 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* print_contents.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: event <event@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/21 15:37:35 by event #+# #+# */
/* Updated: 2019/08/30 10:05:38 by lpetsoan ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_ls.h"
void print_contents(t_file *head, t_flags *flags)
{
int i;
i = 1;
if (flags->p_long)
print_long(head, flags);
else
print_short(head, flags);
}
void print_short(t_file *head, t_flags *flags)
{
int i;
i = 1;
while (head != NULL)
{
if (head->name[0] == '.' && !flags->p_all)
{
head = head->next;
continue;
}
print_form(IS_DIR_SHORT, head->name);
i++;
head = head->next;
}
}
void print_long(t_file *head, t_flags *flags)
{
int i;
i = 0;
while (head != NULL)
{
if (head->name[0] == '.' && !flags->p_all)
{
head = head->next;
continue;
}
print_perms(head->perms, head->is_dir);
print_form(IS_DIR_FORM, head->links, head->u_name,
head->g_name, head->size, head->mod_time, head->name);
i++;
head = head->next;
}
}