-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_ls.h
92 lines (84 loc) · 2.67 KB
/
ft_ls.h
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_ls.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rklein <rklein@student.hive.fi> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/06/05 12:01:01 by rklein #+# #+# */
/* Updated: 2020/06/05 12:04:01 by rklein ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FT_LS_H
# define FT_LS_H
# include <stdlib.h>
# include <unistd.h>
# include <stdbool.h>
# include <sys/stat.h>
# include <sys/types.h>
# include <dirent.h>
# include <time.h>
# include <pwd.h>
# include <grp.h>
# include <uuid/uuid.h>
# include <errno.h>
# include "libft/libft.h"
typedef struct s_flag
{
_Bool a;
_Bool l;
_Bool r;
_Bool rr;
_Bool t;
} t_flag;
typedef struct s_param
{
char *name;
time_t secs;
struct s_param *next;
} t_param;
typedef struct s_dir
{
char *name;
struct s_dir *next;
} t_dir;
typedef struct s_file
{
char *name;
char *sl_path;
char *path;
time_t secs;
char *mode;
char *bytes;
char *links;
char *user;
char *group;
struct s_file *left;
struct s_file *right;
} t_file;
int ft_flags(int ac, char **av, t_flag *flags);
void ft_ls(int ac, char **av, int i, t_flag *flags);
void *ft_param_sort(t_param *param, t_flag *flags);
t_param *ft_dir_list(t_param *dlst, char *str, time_t secs);
char ft_type(char *type);
void ft_insert_tree(t_file **ftree, char *path, t_flag *flags,
struct stat buf);
void ft_bufclr(char *str);
void ft_print_tree(t_file *ftree, t_flag *flags);
char *ft_stripname(const char *s);
int ft_seccmp(time_t a, time_t b);
int ft_open_dir(char *str, t_flag *flags, int count);
void ft_dirscan_tree(t_file *ftree, t_flag *flags);
void ft_direct(t_file *ptree, t_param *dlst, t_flag *flags,
int count);
char *ft_mode(char *mode);
char *ft_date(time_t secs);
char *ft_path(char *path, char *file);
void ft_allign_field(t_file *ftree, t_flag *flags);
char *ft_user(uid_t st_uid);
char *ft_group(gid_t st_gid);
char *ft_sl_path(char *path);
void ft_bytes(t_file *ftree, struct stat buf);
void ft_free_tree(t_file *ftree, t_flag *flag);
void ft_free_list(t_param *list);
#endif