8/11/16 days work on memory leaks, BLK/CHR printing and padding
This commit is contained in:
parent
f108baab24
commit
b0bb8de22c
15 changed files with 298 additions and 96 deletions
16
ls/.tags
16
ls/.tags
|
|
@ -1,6 +1,8 @@
|
||||||
|
FT_MAX_WR src/lib_ls_long2.c /^#define FT_MAX_WR(a,b) a = FT_MAX(a,b)$/
|
||||||
Mmain src/main.c /^int main(int ac, char **av)$/
|
Mmain src/main.c /^int main(int ac, char **av)$/
|
||||||
ft_dir_get_ents src/lib_dirs.c /^t_list *ft_dir_get_ents(t_lsdata *topdir)$/
|
ft_dir_get_ents src/ft_dir_get_ents.c /^t_list *ft_dir_get_ents(t_lsdata *topdir)$/
|
||||||
ft_ent_filter src/lib_dirents.c /^void ft_ent_filter(t_list **ent, char *opts)$/
|
ft_ent_filter src/lib_dirents.c /^void ft_ent_filter(t_list **ent, char *opts)$/
|
||||||
|
ft_ent_free src/ft_ent_free.c /^void ft_ent_free(void *ptr, size_t size)$/
|
||||||
ft_ent_get_dirs src/lib_dirents.c /^t_list *ft_ent_get_dirs(t_list *ent)$/
|
ft_ent_get_dirs src/lib_dirents.c /^t_list *ft_ent_get_dirs(t_list *ent)$/
|
||||||
ft_ent_print src/lib_dirents.c /^void ft_ent_print(t_list *ent, char *opts, t_lsdat/
|
ft_ent_print src/lib_dirents.c /^void ft_ent_print(t_list *ent, char *opts, t_lsdat/
|
||||||
ft_ent_sort src/lib_dirents.c /^void ft_ent_sort(t_list **ent, char *opts)$/
|
ft_ent_sort src/lib_dirents.c /^void ft_ent_sort(t_list **ent, char *opts)$/
|
||||||
|
|
@ -14,15 +16,15 @@ ft_ls_long_lnk src/lib_ls_long2.c /^int ft_ls_long_lnk(t_lsdata *data)$/
|
||||||
ft_ls_long_middle src/lib_ls_long.c /^int ft_ls_long_middle(struct stat *stat, t_pads */
|
ft_ls_long_middle src/lib_ls_long.c /^int ft_ls_long_middle(struct stat *stat, t_pads */
|
||||||
ft_ls_long_pads src/lib_ls_long2.c /^int ft_ls_long_pads(t_list *ent, t_pads *pads)$/
|
ft_ls_long_pads src/lib_ls_long2.c /^int ft_ls_long_pads(t_list *ent, t_pads *pads)$/
|
||||||
ft_ls_long_print src/ft_ls_long.c /^int ft_ls_long_print(t_list *ent, t_pads pads)$/
|
ft_ls_long_print src/ft_ls_long.c /^int ft_ls_long_print(t_list *ent, t_pads pads)$/
|
||||||
ft_ls_long_rights src/lib_ls_long2.c /^void ft_ls_long_rights(int st_mode)$/
|
ft_ls_long_rights src/lib_ls_long2.c /^void ft_ls_long_rights(mode_t m)$/
|
||||||
ft_ls_long_total src/lib_ls_long2.c /^void ft_ls_long_total(t_list *ent)$/
|
ft_ls_long_total src/lib_ls_long2.c /^void ft_ls_long_total(t_list *ent)$/
|
||||||
ft_ls_long_type src/lib_ls_long.c /^void ft_ls_long_type(mode_t m)$/
|
ft_ls_long_type src/lib_ls_long.c /^void ft_ls_long_type(mode_t m)$/
|
||||||
ft_ls_long_xattr src/lib_ls_long2.c /^int ft_ls_long_xattr(char *path)$/
|
ft_ls_long_xattr src/lib_ls_long2.c /^int ft_ls_long_xattr(mode_t m, char *path)$/
|
||||||
|
ft_ls_parse src/lib_parse.c /^char *ft_ls_parse(int ac, char **av, t_list **dir/
|
||||||
|
ft_ls_parse_files src/lib_parse.c /^static void ft_ls_parse_files(int ac, char **av, t/
|
||||||
|
ft_ls_parse_options src/lib_parse.c /^static int ft_ls_parse_options(int ac, char **av, /
|
||||||
ft_ls_short src/ft_ls_short.c /^void ft_ls_short(t_list *ent)$/
|
ft_ls_short src/ft_ls_short.c /^void ft_ls_short(t_list *ent)$/
|
||||||
ft_lsdata_cmp0 src/lib_lsdata.c /^int ft_lsdata_cmp0(t_lsdata *dat, char *dataref)$/
|
ft_lsdata_cmp0 src/lib_lsdata.c /^int ft_lsdata_cmp0(t_lsdata *data, char *dataref)/
|
||||||
ft_lsdata_cmp_name src/lib_lsdata.c /^int ft_lsdata_cmp_name(t_lsdata *dat1, t_lsdata */
|
ft_lsdata_cmp_name src/lib_lsdata.c /^int ft_lsdata_cmp_name(t_lsdata *dat1, t_lsdata */
|
||||||
ft_lsdata_cmp_time src/lib_lsdata.c /^int ft_lsdata_cmp_time(t_lsdata *dat1, t_lsdata */
|
ft_lsdata_cmp_time src/lib_lsdata.c /^int ft_lsdata_cmp_time(t_lsdata *dat1, t_lsdata */
|
||||||
ft_lsdata_filename src/lib_lsdata.c /^void ft_lsdata_filename(t_lsdata *data)$/
|
ft_lsdata_filename src/lib_lsdata.c /^void ft_lsdata_filename(t_lsdata *data)$/
|
||||||
ft_parse_ls src/lib_parse.c /^char *ft_parse_ls(int ac, char **av, t_list **dir,/
|
|
||||||
ft_parse_ls_files src/lib_parse.c /^void ft_parse_ls_files(int ac, char **av, t_list */
|
|
||||||
ft_parse_ls_options src/lib_parse.c /^int ft_parse_ls_options(int ac, char **av, char */
|
|
||||||
|
|
|
||||||
144
ls/Session.vim
Normal file
144
ls/Session.vim
Normal file
|
|
@ -0,0 +1,144 @@
|
||||||
|
let SessionLoad = 1
|
||||||
|
if &cp | set nocp | endif
|
||||||
|
let s:so_save = &so | let s:siso_save = &siso | set so=0 siso=0
|
||||||
|
let v:this_session=expand("<sfile>:p")
|
||||||
|
silent only
|
||||||
|
cd ~/ft_ls
|
||||||
|
if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == ''
|
||||||
|
let s:wipebuf = bufnr('%')
|
||||||
|
endif
|
||||||
|
set shortmess=aoO
|
||||||
|
badd +103 src/lib_ls_long2.c
|
||||||
|
badd +27 src/ft_ls_long.c
|
||||||
|
badd +45 includes/ft_ls.h
|
||||||
|
badd +60 ~/.tmux.conf
|
||||||
|
badd +47 src/lib_ls_long.c
|
||||||
|
badd +35 src/lib_lsdata.c
|
||||||
|
badd +59 src/lib_parse.c
|
||||||
|
badd +22 libft/src/ft_printf/lib_pad.c
|
||||||
|
badd +19 libft/src/ft_printf/lib_pad_sharp.c
|
||||||
|
badd +9 libft/src/lst/ft_lst_filter.c
|
||||||
|
badd +30 src/lib_dirents.c
|
||||||
|
badd +26 src/main.c
|
||||||
|
badd +32 src/ft_ls.c
|
||||||
|
badd +23 src/ft_ent_free.c
|
||||||
|
badd +1 Makefile
|
||||||
|
badd +14 src/lib_error.c
|
||||||
|
badd +32 src/lib_dirs.c
|
||||||
|
badd +29 src/ft_dir_get_ents.c
|
||||||
|
args src/lib_ls_long2.c
|
||||||
|
edit src/main.c
|
||||||
|
set splitbelow splitright
|
||||||
|
wincmd _ | wincmd |
|
||||||
|
vsplit
|
||||||
|
1wincmd h
|
||||||
|
wincmd w
|
||||||
|
set nosplitbelow
|
||||||
|
set nosplitright
|
||||||
|
wincmd t
|
||||||
|
set winheight=1 winwidth=1
|
||||||
|
exe 'vert 1resize ' . ((&columns * 105 + 102) / 205)
|
||||||
|
exe 'vert 2resize ' . ((&columns * 99 + 102) / 205)
|
||||||
|
argglobal
|
||||||
|
setlocal fdm=manual
|
||||||
|
setlocal fde=0
|
||||||
|
setlocal fmr={{{,}}}
|
||||||
|
setlocal fdi=#
|
||||||
|
setlocal fdl=0
|
||||||
|
setlocal fml=1
|
||||||
|
setlocal fdn=20
|
||||||
|
setlocal fen
|
||||||
|
silent! normal! zE
|
||||||
|
let s:l = 25 - ((24 * winheight(0) + 37) / 75)
|
||||||
|
if s:l < 1 | let s:l = 1 | endif
|
||||||
|
exe s:l
|
||||||
|
normal! zt
|
||||||
|
25
|
||||||
|
normal! 01l
|
||||||
|
wincmd w
|
||||||
|
argglobal
|
||||||
|
edit includes/ft_ls.h
|
||||||
|
setlocal fdm=manual
|
||||||
|
setlocal fde=0
|
||||||
|
setlocal fmr={{{,}}}
|
||||||
|
setlocal fdi=#
|
||||||
|
setlocal fdl=0
|
||||||
|
setlocal fml=1
|
||||||
|
setlocal fdn=20
|
||||||
|
setlocal fen
|
||||||
|
silent! normal! zE
|
||||||
|
let s:l = 24 - ((23 * winheight(0) + 37) / 75)
|
||||||
|
if s:l < 1 | let s:l = 1 | endif
|
||||||
|
exe s:l
|
||||||
|
normal! zt
|
||||||
|
24
|
||||||
|
normal! 0
|
||||||
|
wincmd w
|
||||||
|
exe 'vert 1resize ' . ((&columns * 105 + 102) / 205)
|
||||||
|
exe 'vert 2resize ' . ((&columns * 99 + 102) / 205)
|
||||||
|
tabedit src/lib_parse.c
|
||||||
|
set splitbelow splitright
|
||||||
|
wincmd _ | wincmd |
|
||||||
|
vsplit
|
||||||
|
1wincmd h
|
||||||
|
wincmd w
|
||||||
|
set nosplitbelow
|
||||||
|
set nosplitright
|
||||||
|
wincmd t
|
||||||
|
set winheight=1 winwidth=1
|
||||||
|
exe 'vert 1resize ' . ((&columns * 105 + 102) / 205)
|
||||||
|
exe 'vert 2resize ' . ((&columns * 99 + 102) / 205)
|
||||||
|
argglobal
|
||||||
|
setlocal fdm=manual
|
||||||
|
setlocal fde=0
|
||||||
|
setlocal fmr={{{,}}}
|
||||||
|
setlocal fdi=#
|
||||||
|
setlocal fdl=0
|
||||||
|
setlocal fml=1
|
||||||
|
setlocal fdn=20
|
||||||
|
setlocal fen
|
||||||
|
silent! normal! zE
|
||||||
|
let s:l = 41 - ((32 * winheight(0) + 37) / 75)
|
||||||
|
if s:l < 1 | let s:l = 1 | endif
|
||||||
|
exe s:l
|
||||||
|
normal! zt
|
||||||
|
41
|
||||||
|
normal! 0
|
||||||
|
wincmd w
|
||||||
|
argglobal
|
||||||
|
edit src/lib_ls_long2.c
|
||||||
|
setlocal fdm=manual
|
||||||
|
setlocal fde=0
|
||||||
|
setlocal fmr={{{,}}}
|
||||||
|
setlocal fdi=#
|
||||||
|
setlocal fdl=0
|
||||||
|
setlocal fml=1
|
||||||
|
setlocal fdn=20
|
||||||
|
setlocal fen
|
||||||
|
silent! normal! zE
|
||||||
|
let s:l = 68 - ((37 * winheight(0) + 37) / 75)
|
||||||
|
if s:l < 1 | let s:l = 1 | endif
|
||||||
|
exe s:l
|
||||||
|
normal! zt
|
||||||
|
68
|
||||||
|
normal! 03l
|
||||||
|
wincmd w
|
||||||
|
exe 'vert 1resize ' . ((&columns * 105 + 102) / 205)
|
||||||
|
exe 'vert 2resize ' . ((&columns * 99 + 102) / 205)
|
||||||
|
tabnext 1
|
||||||
|
if exists('s:wipebuf')
|
||||||
|
silent exe 'bwipe ' . s:wipebuf
|
||||||
|
endif
|
||||||
|
unlet! s:wipebuf
|
||||||
|
set winheight=1 winwidth=20 shortmess=filnxtToO
|
||||||
|
let s:sx = expand("<sfile>:p:r")."x.vim"
|
||||||
|
if file_readable(s:sx)
|
||||||
|
exe "source " . fnameescape(s:sx)
|
||||||
|
endif
|
||||||
|
let &so = s:so_save | let &siso = s:siso_save
|
||||||
|
let g:this_session = v:this_session
|
||||||
|
let g:this_obsession = v:this_session
|
||||||
|
let g:this_obsession_status = 2
|
||||||
|
doautoall SessionLoadPost
|
||||||
|
unlet SessionLoad
|
||||||
|
" vim: set ft=vim :
|
||||||
|
|
@ -6,13 +6,22 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/07 15:10:03 by jhalford #+# #+# */
|
/* Created: 2016/11/07 15:10:03 by jhalford #+# #+# */
|
||||||
/* Updated: 2016/11/07 17:38:28 by jhalford ### ########.fr */
|
/* Updated: 2016/11/08 16:20:29 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#ifndef FT_LS_H
|
#ifndef FT_LS_H
|
||||||
# define FT_LS_H
|
# define FT_LS_H
|
||||||
# define ALL_OPTS "lRart"
|
# define LS_LEGAL_OPTS "larRt"
|
||||||
|
# define LS_MSG_ILLEGAL_OPT "ft_ls: illegal option -- %c\n"
|
||||||
|
# define LS_MSG_USAGE "usage: ls [-%s] [file ...]\n"
|
||||||
|
# define LS_MSG_FILE_ERR "ls: %s: no such file or directory\n"
|
||||||
|
# define FT_MINORBITS 20
|
||||||
|
# define FT_MINORMASK ((1U << FT_MINORBITS) - 1)
|
||||||
|
# define FT_MINOR(dev) ((unsigned int) ((dev) >> FT_MINORBITS))
|
||||||
|
# define FT_MAJOR(dev) ((unsigned int) ((dev) & FT_MINORMASK))
|
||||||
|
# define FT_MKDEV(ma,mi) (((ma) << FT_MINORBITS) | (mi))
|
||||||
|
|
||||||
# include "libft.h"
|
# include "libft.h"
|
||||||
# include <errno.h>
|
# include <errno.h>
|
||||||
# include <dirent.h>
|
# include <dirent.h>
|
||||||
|
|
@ -37,18 +46,18 @@ struct s_pads
|
||||||
int name;
|
int name;
|
||||||
int gr_name;
|
int gr_name;
|
||||||
int size;
|
int size;
|
||||||
|
int major;
|
||||||
|
int minor;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct s_lsdata t_lsdata;
|
typedef struct s_lsdata t_lsdata;
|
||||||
typedef struct s_pads t_pads;
|
typedef struct s_pads t_pads;
|
||||||
|
|
||||||
|
char *ft_ls_parse(int ac, char **av, t_list **dir, t_list **ent);
|
||||||
|
|
||||||
void ft_ls_dirs(t_list *dir, char *opts);
|
void ft_ls_dirs(t_list *dir, char *opts);
|
||||||
void ft_ls_files(t_list *ent, t_list *dir, char *opts);
|
void ft_ls_files(t_list *ent, t_list *dir, char *opts);
|
||||||
|
|
||||||
char *ft_parse_ls(int ac, char **av, t_list **dir, t_list **ent);
|
|
||||||
int ft_parse_ls_options(int ac, char **av, char *opts);
|
|
||||||
void ft_parse_ls_files(int ac, char **av, t_list **dir, t_list **ent);
|
|
||||||
|
|
||||||
void ft_lsdata_filename(t_lsdata *data);
|
void ft_lsdata_filename(t_lsdata *data);
|
||||||
int ft_lsdata_cmp_name(t_lsdata *dat1, t_lsdata *dat2);
|
int ft_lsdata_cmp_name(t_lsdata *dat1, t_lsdata *dat2);
|
||||||
int ft_lsdata_cmp_time(t_lsdata *dat1, t_lsdata *dat2);
|
int ft_lsdata_cmp_time(t_lsdata *dat1, t_lsdata *dat2);
|
||||||
|
|
@ -60,7 +69,7 @@ void ft_ent_print(
|
||||||
t_list *ent, char *opts, t_lsdata *topdir, t_list *nextdir);
|
t_list *ent, char *opts, t_lsdata *topdir, t_list *nextdir);
|
||||||
|
|
||||||
t_list *ft_ent_get_dirs(t_list *ent);
|
t_list *ft_ent_get_dirs(t_list *ent);
|
||||||
t_list *ft_dir_get_ents(t_lsdata *dir);
|
t_list *ft_dir_get_ents(t_lsdata *topdir);
|
||||||
|
|
||||||
void ft_ls_short(t_list *ent);
|
void ft_ls_short(t_list *ent);
|
||||||
|
|
||||||
|
|
@ -70,8 +79,8 @@ int ft_ls_long_print(t_list *ent, t_pads pads);
|
||||||
void ft_ls_long_total(t_list *ent);
|
void ft_ls_long_total(t_list *ent);
|
||||||
int ft_ls_long_pads(t_list *ent, t_pads *pads);
|
int ft_ls_long_pads(t_list *ent, t_pads *pads);
|
||||||
void ft_ls_long_type(mode_t m);
|
void ft_ls_long_type(mode_t m);
|
||||||
void ft_ls_long_rights(int st_mode);
|
void ft_ls_long_rights(mode_t m);
|
||||||
int ft_ls_long_xattr(char *path);
|
int ft_ls_long_xattr(mode_t m, char *path);
|
||||||
int ft_ls_long_middle(struct stat *stat, t_pads *pads);
|
int ft_ls_long_middle(struct stat *stat, t_pads *pads);
|
||||||
void ft_ls_long_date(struct stat *stat);
|
void ft_ls_long_date(struct stat *stat);
|
||||||
int ft_ls_long_lnk(t_lsdata *data);
|
int ft_ls_long_lnk(t_lsdata *data);
|
||||||
|
|
@ -79,4 +88,5 @@ int ft_ls_long_lnk(t_lsdata *data);
|
||||||
void ft_error_option(char c);
|
void ft_error_option(char c);
|
||||||
void ft_error_dir(char *s);
|
void ft_error_dir(char *s);
|
||||||
|
|
||||||
|
void ft_ent_free(void *ptr, size_t size);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
2
ls/libft
2
ls/libft
|
|
@ -1 +1 @@
|
||||||
Subproject commit 34d66b7d370ecf8b2db35e73f8544d93e45ed4c9
|
Subproject commit 38bb3a862175ea55b1243c37d7afcabd7d46dc45
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/07 14:58:49 by jhalford #+# #+# */
|
/* Created: 2016/11/07 14:58:49 by jhalford #+# #+# */
|
||||||
/* Updated: 2016/11/07 15:30:07 by jhalford ### ########.fr */
|
/* Updated: 2016/11/08 15:04:00 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -23,10 +23,10 @@ t_list *ft_dir_get_ents(t_lsdata *topdir)
|
||||||
stream = opendir(topdir->path);
|
stream = opendir(topdir->path);
|
||||||
while ((dirent = readdir(stream)))
|
while ((dirent = readdir(stream)))
|
||||||
{
|
{
|
||||||
data.path = ft_strjoin(topdir->path, "/");
|
data.path = ft_str3join(topdir->path, "/", dirent->d_name);
|
||||||
data.path = ft_strjoin(data.path, dirent->d_name);
|
|
||||||
lstat(data.path, &data.stat);
|
lstat(data.path, &data.stat);
|
||||||
data.dirent = dirent;
|
data.dirent = ft_memalloc(sizeof(dirent));
|
||||||
|
ft_memcpy(data.dirent, &dirent, sizeof(dirent));
|
||||||
ft_lstadd(&ent, ft_lstnew(&data, sizeof(data)));
|
ft_lstadd(&ent, ft_lstnew(&data, sizeof(data)));
|
||||||
}
|
}
|
||||||
closedir(stream);
|
closedir(stream);
|
||||||
29
ls/src/ft_ent_free.c
Normal file
29
ls/src/ft_ent_free.c
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_ent_free.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2016/11/08 11:10:13 by jhalford #+# #+# */
|
||||||
|
/* Updated: 2016/11/08 15:05:59 by jhalford ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "ft_ls.h"
|
||||||
|
|
||||||
|
void ft_ent_free(void *ptr, size_t size)
|
||||||
|
{
|
||||||
|
t_lsdata *data;
|
||||||
|
|
||||||
|
(void)size;
|
||||||
|
data = (t_lsdata *)ptr;
|
||||||
|
if (data)
|
||||||
|
{
|
||||||
|
if (data->path)
|
||||||
|
ft_strdel(&data->path);
|
||||||
|
if (data->dirent)
|
||||||
|
free(data->dirent);
|
||||||
|
free(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/07 14:57:21 by jhalford #+# #+# */
|
/* Created: 2016/11/07 14:57:21 by jhalford #+# #+# */
|
||||||
/* Updated: 2016/11/07 17:41:26 by jhalford ### ########.fr */
|
/* Updated: 2016/11/08 15:04:46 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -17,15 +17,17 @@ void ft_ls_dirs(t_list *dir, char *opts)
|
||||||
t_list *dir_r;
|
t_list *dir_r;
|
||||||
t_list *ent;
|
t_list *ent;
|
||||||
t_lsdata *dirdata;
|
t_lsdata *dirdata;
|
||||||
|
t_list *tmp;
|
||||||
|
|
||||||
ft_ent_sort(&dir, opts);
|
ft_ent_sort(&dir, opts);
|
||||||
while (dir)
|
while (dir)
|
||||||
{
|
{
|
||||||
dirdata = dir->content;
|
dirdata = dir->content;
|
||||||
|
tmp = dir;
|
||||||
dir = dir->next;
|
dir = dir->next;
|
||||||
ent = ft_dir_get_ents(dirdata);
|
ent = ft_dir_get_ents(dirdata);
|
||||||
ft_ent_filter(&ent, opts);
|
|
||||||
ft_ent_sort(&ent, opts);
|
ft_ent_sort(&ent, opts);
|
||||||
|
ft_ent_filter(&ent, opts);
|
||||||
ft_ent_print(ent, opts, dirdata, dir);
|
ft_ent_print(ent, opts, dirdata, dir);
|
||||||
if (ft_strchr(opts, 'R'))
|
if (ft_strchr(opts, 'R'))
|
||||||
{
|
{
|
||||||
|
|
@ -33,6 +35,7 @@ void ft_ls_dirs(t_list *dir, char *opts)
|
||||||
ft_lst_merge(&dir_r, dir);
|
ft_lst_merge(&dir_r, dir);
|
||||||
dir = dir_r;
|
dir = dir_r;
|
||||||
}
|
}
|
||||||
|
ft_lstdelone(&tmp, &ft_ent_free);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -40,8 +43,8 @@ void ft_ls_files(t_list *ent, t_list *dir, char *opts)
|
||||||
{
|
{
|
||||||
if (ent)
|
if (ent)
|
||||||
{
|
{
|
||||||
ft_ent_filter(&ent, opts);
|
|
||||||
ft_ent_sort(&ent, opts);
|
ft_ent_sort(&ent, opts);
|
||||||
|
ft_ent_filter(&ent, opts);
|
||||||
ft_ent_print(ent, opts, NULL, dir);
|
ft_ent_print(ent, opts, NULL, dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/07 14:58:05 by jhalford #+# #+# */
|
/* Created: 2016/11/07 14:58:05 by jhalford #+# #+# */
|
||||||
/* Updated: 2016/11/07 16:43:01 by jhalford ### ########.fr */
|
/* Updated: 2016/11/08 11:01:33 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -41,7 +41,7 @@ int ft_ls_long_print(t_list *ent, t_pads pads)
|
||||||
ent = ent->next;
|
ent = ent->next;
|
||||||
ft_ls_long_type(stat.st_mode);
|
ft_ls_long_type(stat.st_mode);
|
||||||
ft_ls_long_rights(stat.st_mode);
|
ft_ls_long_rights(stat.st_mode);
|
||||||
if (ft_ls_long_xattr(data->path))
|
if (ft_ls_long_xattr(stat.st_mode, data->path))
|
||||||
return (1);
|
return (1);
|
||||||
if (ft_ls_long_middle(&stat, &pads))
|
if (ft_ls_long_middle(&stat, &pads))
|
||||||
return (1);
|
return (1);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/07 15:00:05 by jhalford #+# #+# */
|
/* Created: 2016/11/07 15:00:05 by jhalford #+# #+# */
|
||||||
/* Updated: 2016/11/07 17:42:16 by jhalford ### ########.fr */
|
/* Updated: 2016/11/08 15:01:55 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
void ft_ent_filter(t_list **ent, char *opts)
|
void ft_ent_filter(t_list **ent, char *opts)
|
||||||
{
|
{
|
||||||
if (!ft_strchr(opts, 'a'))
|
if (!ft_strchr(opts, 'a'))
|
||||||
ft_lst_delif(ent, ".", &ft_lsdata_cmp0, &ft_lst_cfree);
|
ft_lst_delif(ent, ".", &ft_lsdata_cmp0, &ft_ent_free);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ft_ent_sort(t_list **ent, char *opts)
|
void ft_ent_sort(t_list **ent, char *opts)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/07 14:57:43 by jhalford #+# #+# */
|
/* Created: 2016/11/07 14:57:43 by jhalford #+# #+# */
|
||||||
/* Updated: 2016/11/07 15:30:13 by jhalford ### ########.fr */
|
/* Updated: 2016/11/08 15:29:02 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -14,10 +14,11 @@
|
||||||
|
|
||||||
void ft_error_option(char c)
|
void ft_error_option(char c)
|
||||||
{
|
{
|
||||||
ft_printf("warning option '%c' is unsupported\n", c);
|
ft_printf(LS_MSG_ILLEGAL_OPT, c);
|
||||||
|
ft_printf(LS_MSG_USAGE, LS_LEGAL_OPTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ft_error_dir(char *s)
|
void ft_error_dir(char *s)
|
||||||
{
|
{
|
||||||
ft_printf("ls: %s: no such file or directory\n", s);
|
ft_printf(LS_MSG_FILE_ERR, s);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/07 14:59:51 by jhalford #+# #+# */
|
/* Created: 2016/11/07 14:59:51 by jhalford #+# #+# */
|
||||||
/* Updated: 2016/11/07 17:29:49 by jhalford ### ########.fr */
|
/* Updated: 2016/11/08 10:54:39 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -24,6 +24,11 @@ int ft_ls_long_middle(struct stat *stat, t_pads *pads)
|
||||||
ft_printf(" %*hu", pads->nlink, stat->st_nlink);
|
ft_printf(" %*hu", pads->nlink, stat->st_nlink);
|
||||||
ft_printf(" %-*s", pads->name, pwd->pw_name);
|
ft_printf(" %-*s", pads->name, pwd->pw_name);
|
||||||
ft_printf(" %-*s", pads->gr_name, grp->gr_name);
|
ft_printf(" %-*s", pads->gr_name, grp->gr_name);
|
||||||
|
if (S_ISBLK(stat->st_mode) || S_ISCHR(stat->st_mode))
|
||||||
|
ft_printf(" % *i,% *i",
|
||||||
|
pads->major + 1, major(stat->st_rdev),
|
||||||
|
pads->minor + 1, minor(stat->st_rdev));
|
||||||
|
else
|
||||||
ft_printf(" %*lld", pads->size, stat->st_size);
|
ft_printf(" %*lld", pads->size, stat->st_size);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
@ -37,12 +42,11 @@ void ft_ls_long_date(struct stat *stat)
|
||||||
|
|
||||||
date = ctime(&stat->st_mtime);
|
date = ctime(&stat->st_mtime);
|
||||||
month = ft_strsub(date, 4, 3);
|
month = ft_strsub(date, 4, 3);
|
||||||
month[0] += 32;
|
|
||||||
day = ft_strsub(date, 8, 2);
|
day = ft_strsub(date, 8, 2);
|
||||||
time = ft_time_isrecent(stat->st_mtime)
|
time = ft_time_isrecent(stat->st_mtime)
|
||||||
? ft_strsub(date, 11, 5)
|
? ft_strsub(date, 11, 5)
|
||||||
: ft_strsub(date, 20, 4);
|
: ft_strsub(date, 20, 4);
|
||||||
ft_printf(" %s %s %5s", day, month, time);
|
ft_printf(" %s %s %5s", month, day, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ft_ls_long_type(mode_t m)
|
void ft_ls_long_type(mode_t m)
|
||||||
|
|
|
||||||
|
|
@ -6,20 +6,19 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/07 15:01:01 by jhalford #+# #+# */
|
/* Created: 2016/11/07 15:01:01 by jhalford #+# #+# */
|
||||||
/* Updated: 2016/11/07 17:38:27 by jhalford ### ########.fr */
|
/* Updated: 2016/11/08 16:26:08 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "ft_ls.h"
|
#include "ft_ls.h"
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
void ft_ls_long_rights(int st_mode)
|
void ft_ls_long_rights(mode_t m)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *rights;
|
char *rights;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
rights = ft_itoa_base(st_mode, "01", "");
|
rights = ft_itoa_base(m, "01", "");
|
||||||
rights = rights + ft_strlen(rights) - 9;
|
rights = rights + ft_strlen(rights) - 9;
|
||||||
while (rights[i])
|
while (rights[i])
|
||||||
{
|
{
|
||||||
|
|
@ -56,16 +55,19 @@ int ft_ls_long_lnk(t_lsdata *data)
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ft_ls_long_xattr(char *path)
|
int ft_ls_long_xattr(mode_t m, char *path)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
char x;
|
char x;
|
||||||
|
|
||||||
x = ' ';
|
x = ' ';
|
||||||
|
n = 0;
|
||||||
|
if (!(m & (S_IFCHR | S_IFBLK)))
|
||||||
if ((n = ft_xattr_count(path)) == -1)
|
if ((n = ft_xattr_count(path)) == -1)
|
||||||
{
|
{
|
||||||
ft_printf("\ncouldnt get xattr: %i\n", n);
|
;
|
||||||
return (1);
|
/* ft_printf("\ncouldnt get xattr: %i\n", n); */
|
||||||
|
/* return (1); */
|
||||||
}
|
}
|
||||||
if (n > 0)
|
if (n > 0)
|
||||||
x = '@';
|
x = '@';
|
||||||
|
|
@ -90,30 +92,33 @@ void ft_ls_long_total(t_list *ent)
|
||||||
ft_printf("total %i\n", total);
|
ft_printf("total %i\n", total);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define FT_MAX_WR(a,b) a = FT_MAX(a,b)
|
||||||
|
|
||||||
int ft_ls_long_pads(t_list *ent, t_pads *pads)
|
int ft_ls_long_pads(t_list *ent, t_pads *pads)
|
||||||
{
|
{
|
||||||
struct passwd *pwd;
|
struct passwd *pwd;
|
||||||
struct group *grp;
|
struct group *grp;
|
||||||
struct stat stat;
|
struct stat stat;
|
||||||
t_lsdata *data;
|
|
||||||
|
|
||||||
pads->nlink = 0;
|
ft_bzero(pads, sizeof(*pads));
|
||||||
pads->name = 0;
|
|
||||||
pads->gr_name = 0;
|
|
||||||
pads->size = 0;
|
|
||||||
while (ent)
|
while (ent)
|
||||||
{
|
{
|
||||||
data = ent->content;
|
stat = ((t_lsdata*)ent->content)->stat;
|
||||||
stat = data->stat;
|
|
||||||
ent = ent->next;
|
ent = ent->next;
|
||||||
if ((pwd = getpwuid(stat.st_uid)) == NULL)
|
if (!(pwd = getpwuid(stat.st_uid)))
|
||||||
return (1);
|
return (1);
|
||||||
if ((grp = getgrgid(stat.st_gid)) == NULL)
|
if (!(grp = getgrgid(stat.st_gid)))
|
||||||
return (1);
|
return (1);
|
||||||
pads->nlink = FT_MAX(pads->nlink, (int)ft_uilen(stat.st_nlink));
|
FT_MAX_WR(pads->name, (int)ft_strlen(pwd->pw_name));
|
||||||
pads->name = FT_MAX(pads->name, (int)ft_strlen(pwd->pw_name));
|
FT_MAX_WR(pads->gr_name, (int)ft_strlen(grp->gr_name));
|
||||||
pads->gr_name = FT_MAX(pads->gr_name, (int)ft_strlen(grp->gr_name));
|
FT_MAX_WR(pads->nlink, (int)ft_uilen(stat.st_nlink));
|
||||||
pads->size = FT_MAX(pads->size, (int)ft_ilen(stat.st_size));
|
FT_MAX_WR(pads->size, (int)ft_ilen(stat.st_size));
|
||||||
|
if (S_ISCHR(stat.st_mode) || S_ISBLK(stat.st_mode))
|
||||||
|
{
|
||||||
|
FT_MAX_WR(pads->minor, (int)ft_ilen(minor(stat.st_rdev)));
|
||||||
|
FT_MAX_WR(pads->major, (int)ft_ilen(major(stat.st_rdev)));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
pads->size = FT_MAX(pads->size, pads->minor + pads->major + 3);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/07 14:59:09 by jhalford #+# #+# */
|
/* Created: 2016/11/07 14:59:09 by jhalford #+# #+# */
|
||||||
/* Updated: 2016/11/07 15:30:33 by jhalford ### ########.fr */
|
/* Updated: 2016/11/08 13:40:06 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -17,10 +17,12 @@ void ft_lsdata_filename(t_lsdata *data)
|
||||||
struct dirent *dirent;
|
struct dirent *dirent;
|
||||||
|
|
||||||
dirent = data->dirent;
|
dirent = data->dirent;
|
||||||
if (dirent)
|
if (data->path)
|
||||||
|
ft_printf("%s", ft_path_notdir(data->path));
|
||||||
|
else if (dirent && *dirent->d_name)
|
||||||
ft_printf("%s", dirent->d_name);
|
ft_printf("%s", dirent->d_name);
|
||||||
else
|
else
|
||||||
ft_printf("%s", data->path);
|
ft_printf("noname!");
|
||||||
}
|
}
|
||||||
|
|
||||||
int ft_lsdata_cmp_name(t_lsdata *dat1, t_lsdata *dat2)
|
int ft_lsdata_cmp_name(t_lsdata *dat1, t_lsdata *dat2)
|
||||||
|
|
@ -36,13 +38,13 @@ int ft_lsdata_cmp_time(t_lsdata *dat1, t_lsdata *dat2)
|
||||||
return (ft_strcmp(dat1->path, dat2->path));
|
return (ft_strcmp(dat1->path, dat2->path));
|
||||||
}
|
}
|
||||||
|
|
||||||
int ft_lsdata_cmp0(t_lsdata *dat, char *dataref)
|
int ft_lsdata_cmp0(t_lsdata *data, char *dataref)
|
||||||
{
|
{
|
||||||
char *filename;
|
char *filename;
|
||||||
|
|
||||||
if (dat->dirent)
|
if (data->path)
|
||||||
filename = dat->dirent->d_name;
|
filename = ft_path_notdir(data->path);
|
||||||
else
|
else
|
||||||
filename = ft_path_notdir(dat->path);
|
filename = data->dirent->d_name;
|
||||||
return (*filename != *dataref);
|
return (*filename != *dataref);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,33 +6,13 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/07 15:02:46 by jhalford #+# #+# */
|
/* Created: 2016/11/07 15:02:46 by jhalford #+# #+# */
|
||||||
/* Updated: 2016/11/07 17:53:03 by jhalford ### ########.fr */
|
/* Updated: 2016/11/08 16:26:12 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "ft_ls.h"
|
#include "ft_ls.h"
|
||||||
|
|
||||||
char *ft_parse_ls(int ac, char **av, t_list **dir, t_list **ent)
|
static void ft_ls_parse_files(int ac, char **av, t_list **dir, t_list **ent)
|
||||||
{
|
|
||||||
int i;
|
|
||||||
char *opts;
|
|
||||||
t_lsdata data;
|
|
||||||
|
|
||||||
if (!(opts = (char *)ft_strnew(sizeof(char) * 7)))
|
|
||||||
return (NULL);
|
|
||||||
i = ft_parse_ls_options(ac, av, opts);
|
|
||||||
ft_strcat(opts, (ac - i <= 1) ? "0" : "");
|
|
||||||
if (i == ac)
|
|
||||||
{
|
|
||||||
data.path = ft_strdup(".");
|
|
||||||
data.dirent = NULL;
|
|
||||||
ft_lstadd(dir, ft_lstnew(&data, sizeof(data)));
|
|
||||||
}
|
|
||||||
ft_parse_ls_files(ac - i, av + i, dir, ent);
|
|
||||||
return (opts);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ft_parse_ls_files(int ac, char **av, t_list **dir, t_list **ent)
|
|
||||||
{
|
{
|
||||||
DIR *stream;
|
DIR *stream;
|
||||||
t_lsdata data;
|
t_lsdata data;
|
||||||
|
|
@ -56,7 +36,7 @@ void ft_parse_ls_files(int ac, char **av, t_list **dir, t_list **ent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int ft_parse_ls_options(int ac, char **av, char *opts)
|
static int ft_ls_parse_options(int ac, char **av, char *opts)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
|
|
@ -64,18 +44,18 @@ int ft_parse_ls_options(int ac, char **av, char *opts)
|
||||||
i = 0;
|
i = 0;
|
||||||
while (++i < ac)
|
while (++i < ac)
|
||||||
{
|
{
|
||||||
if (av[i][0] == '-' && av[i][1] != '\0')
|
if (av[i][0] == '-')
|
||||||
{
|
{
|
||||||
j = 0;
|
j = 0;
|
||||||
while (av[i][++j])
|
while (av[i][++j])
|
||||||
{
|
{
|
||||||
if (ft_strchr(ALL_OPTS, av[i][j]))
|
if (!ft_strchr(LS_LEGAL_OPTS, av[i][j]))
|
||||||
{
|
{
|
||||||
if (!ft_strchr(opts, av[i][j]))
|
|
||||||
ft_strcat(opts, av[i] + j);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ft_error_option(av[i][j]);
|
ft_error_option(av[i][j]);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
else if (!ft_strchr(opts, av[i][j]))
|
||||||
|
ft_strcat(opts, av[i] + j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -83,3 +63,23 @@ int ft_parse_ls_options(int ac, char **av, char *opts)
|
||||||
}
|
}
|
||||||
return (i);
|
return (i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *ft_ls_parse(int ac, char **av, t_list **dir, t_list **ent)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
char *opts;
|
||||||
|
t_lsdata data;
|
||||||
|
|
||||||
|
if (!(opts = (char *)ft_strnew(sizeof(char) * 7)))
|
||||||
|
return (NULL);
|
||||||
|
i = ft_ls_parse_options(ac, av, opts);
|
||||||
|
ft_strcat(opts, (ac - i <= 1) ? "0" : "");
|
||||||
|
if (i == ac)
|
||||||
|
{
|
||||||
|
data.path = ft_strdup(".");
|
||||||
|
data.dirent = NULL;
|
||||||
|
ft_lstadd(dir, ft_lstnew(&data, sizeof(data)));
|
||||||
|
}
|
||||||
|
ft_ls_parse_files(ac - i, av + i, dir, ent);
|
||||||
|
return (opts);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/07 15:00:15 by jhalford #+# #+# */
|
/* Created: 2016/11/07 15:00:15 by jhalford #+# #+# */
|
||||||
/* Updated: 2016/11/07 17:42:33 by jhalford ### ########.fr */
|
/* Updated: 2016/11/08 16:26:15 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -20,8 +20,10 @@ int main(int ac, char **av)
|
||||||
|
|
||||||
dir = NULL;
|
dir = NULL;
|
||||||
ent = NULL;
|
ent = NULL;
|
||||||
opts = ft_parse_ls(ac, av, &dir, &ent);
|
opts = ft_ls_parse(ac, av, &dir, &ent);
|
||||||
ft_ls_files(ent, dir, opts);
|
ft_ls_files(ent, dir, opts);
|
||||||
|
ft_lstdel(&ent, &ft_ent_free);
|
||||||
ft_ls_dirs(dir, opts);
|
ft_ls_dirs(dir, opts);
|
||||||
|
ft_strdel(&opts);
|
||||||
return (errno);
|
return (errno);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue