-
Notifications
You must be signed in to change notification settings - Fork 0
/
add.c
35 lines (32 loc) · 1.34 KB
/
add.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* add.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gsferopo <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/09/04 07:57:58 by gsferopo #+# #+# */
/* Updated: 2017/09/04 08:01:02 by gsferopo ### ########.fr */
/* */
/* ************************************************************************** */
#include "lslib.h"
void addentry(t_lst **list, t_dir *info, char *directory, char *perm)
{
t_lst *temp;
t_lst *current;
current = *list;
temp = (t_lst *)malloc(sizeof(t_lst));
temp->next = NULL;
temp->dir = ft_strjoin(directory, "/");
temp->name = ft_strdup(info->entry->d_name);
temp->time = info->statbuf.st_mtime;
temp->perm = ft_strdup(perm);
if (*list == NULL)
*list = temp;
else
{
while (current->next)
current = current->next;
current->next = temp;
}
}