-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstrings.c
59 lines (49 loc) · 930 Bytes
/
strings.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
#include "header.h"
#include <stdio.h>
#define BUFF_SIZE 500 // Should be big enough
char *fileLongMake(t_list *file)
{
char *buffer;
fileInfo *f;
buffer = nc_malloc(BUFF_SIZE);
f = file->content;
sprintf(buffer, "%s %2d %5s %5s %lld %s %s%s%s %s",
f->mode,
f->nlink,
f->pname,
f->gname,
f->size,
f->time,
f->color, f->name, RESET,
f->link);
return buffer;
}
char *fileShortMake(t_list *file)
{
char *buffer;
fileInfo *f;
f = file->content;
buffer = nc_malloc(BUFF_SIZE);
sprintf(buffer, "%s%s%s", f->color, f->name, RESET);
return buffer;
}
void print(t_list **files)
{
t_list *file;
file = *files;
while(file)
{
printf("%s\n", ((char *)file->content));
file = file->next;
}
}
void printTrash(t_list **files)
{
t_list *file;
file = *files;
while(file)
{
printf("ls: %s: No such file or directory\n", ((char *)file->content));
file = file->next;
}
}