-
Notifications
You must be signed in to change notification settings - Fork 0
/
read.c
53 lines (48 loc) · 1.49 KB
/
read.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* read.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dmoureu- <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/02/10 18:45:31 by dmoureu- #+# #+# */
/* Updated: 2016/02/10 19:05:16 by dmoureu- ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_ls.h"
void readfiles(t_ls *ls)
{
t_arg *arg;
arg = ls->args;
while (arg)
{
listfiles(arg, ls);
arg = arg->next;
}
if (ls->sort_time && ls->files)
sortentstime(ls->files, ls->sort_time);
print_ents(".", ls->files, ls, 0);
}
void readargs(t_arg *args, t_ls *ls)
{
t_arg *arg;
arg = args;
while (arg)
{
timedir(arg);
arg = arg->next;
}
arg = args;
if (ls->sort_alpha)
sortargs(arg, ls->sort_alpha);
if (ls->sort_time)
sortargstime(arg, ls->sort_time);
while (arg)
{
listdir(arg, ls);
print_args(arg, ls);
if (ls->opts['R'] && arg->sub)
readargs(arg->sub, ls);
arg = arg->next;
}
}