starting to clear moulitest errors, still much to do apparently
This commit is contained in:
parent
f249b18aec
commit
c23ee4d832
12 changed files with 117 additions and 43 deletions
1
ls/.tags
1
ls/.tags
|
|
@ -7,6 +7,7 @@ ft_ent_get_dirs src/ft_ent_get_dirs.c /^t_list *ft_ent_get_dirs(t_list **ent)$/
|
||||||
ft_ent_has_dir src/ft_ent_has_dir.c /^int ft_ent_has_dir(t_list *ent)$/
|
ft_ent_has_dir src/ft_ent_has_dir.c /^int ft_ent_has_dir(t_list *ent)$/
|
||||||
ft_ent_print src/lib_ent.c /^void ft_ent_print(t_list *ent, int *opts, t_lsdata/
|
ft_ent_print src/lib_ent.c /^void ft_ent_print(t_list *ent, int *opts, t_lsdata/
|
||||||
ft_ent_sort src/lib_ent.c /^void ft_ent_sort(t_list **ent, int opts)$/
|
ft_ent_sort src/lib_ent.c /^void ft_ent_sort(t_list **ent, int opts)$/
|
||||||
|
ft_error_access src/lib_error.c /^void ft_error_access(char *s)$/
|
||||||
ft_error_dir src/lib_error.c /^void ft_error_dir(char *s)$/
|
ft_error_dir src/lib_error.c /^void ft_error_dir(char *s)$/
|
||||||
ft_error_option src/lib_error.c /^void ft_error_option(char c)$/
|
ft_error_option src/lib_error.c /^void ft_error_option(char c)$/
|
||||||
ft_getopts src/lib_parse.c /^static int ft_getopts(char *str)$/
|
ft_getopts src/lib_parse.c /^static int ft_getopts(char *str)$/
|
||||||
|
|
|
||||||
|
|
@ -8,24 +8,24 @@ if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == ''
|
||||||
let s:wipebuf = bufnr('%')
|
let s:wipebuf = bufnr('%')
|
||||||
endif
|
endif
|
||||||
set shortmess=aoO
|
set shortmess=aoO
|
||||||
badd +28 src/lib_ls_long2.c
|
badd +116 src/lib_ls_long2.c
|
||||||
badd +23 src/ft_ls_long.c
|
badd +26 src/ft_ls_long.c
|
||||||
badd +1 includes/ft_ls.h
|
badd +1 includes/ft_ls.h
|
||||||
badd +60 ~/.tmux.conf
|
badd +60 ~/.tmux.conf
|
||||||
badd +28 src/lib_ls_long.c
|
badd +29 src/lib_ls_long.c
|
||||||
badd +35 src/lib_lsdata.c
|
badd +35 src/lib_lsdata.c
|
||||||
badd +92 src/lib_parse.c
|
badd +34 src/lib_parse.c
|
||||||
badd +22 libft/src/ft_printf/lib_pad.c
|
badd +22 libft/src/ft_printf/lib_pad.c
|
||||||
badd +19 libft/src/ft_printf/lib_pad_sharp.c
|
badd +19 libft/src/ft_printf/lib_pad_sharp.c
|
||||||
badd +14 libft/src/lst/ft_lst_filter.c
|
badd +14 libft/src/lst/ft_lst_filter.c
|
||||||
badd +14 src/lib_dirents.c
|
badd +14 src/lib_dirents.c
|
||||||
badd +25 src/main.c
|
badd +21 src/main.c
|
||||||
badd +43 src/ft_ls.c
|
badd +30 src/ft_ls.c
|
||||||
badd +23 src/ft_ent_free.c
|
badd +23 src/ft_ent_free.c
|
||||||
badd +1 Makefile
|
badd +1 Makefile
|
||||||
badd +22 src/lib_error.c
|
badd +21 src/lib_error.c
|
||||||
badd +32 src/lib_dirs.c
|
badd +32 src/lib_dirs.c
|
||||||
badd +31 src/ft_dir_get_ents.c
|
badd +25 src/ft_dir_get_ents.c
|
||||||
badd +69 libft/src/ft_printf/ft_printf.c
|
badd +69 libft/src/ft_printf/ft_printf.c
|
||||||
badd +46 libft/includes/ft_printf.h
|
badd +46 libft/includes/ft_printf.h
|
||||||
badd +2 libft/src/printing/ft_putstr_fd.c
|
badd +2 libft/src/printing/ft_putstr_fd.c
|
||||||
|
|
@ -44,7 +44,7 @@ badd +25 libft/src/lst/ft_lst_removeif.c
|
||||||
badd +42 ~/.vimrc
|
badd +42 ~/.vimrc
|
||||||
badd +12 src/ft_ent_has_dir.c
|
badd +12 src/ft_ent_has_dir.c
|
||||||
badd +35 src/ft_ent_get_dirs.c
|
badd +35 src/ft_ent_get_dirs.c
|
||||||
badd +18 src/lib_ent.c
|
badd +50 src/lib_ent.c
|
||||||
badd +11 .Makefile.swp
|
badd +11 .Makefile.swp
|
||||||
badd +18 ~/dotfiles/vim.symlink/plugins.vim
|
badd +18 ~/dotfiles/vim.symlink/plugins.vim
|
||||||
badd +22 libft/src/str/ft_strsub.c
|
badd +22 libft/src/str/ft_strsub.c
|
||||||
|
|
@ -65,8 +65,8 @@ set nosplitbelow
|
||||||
set nosplitright
|
set nosplitright
|
||||||
wincmd t
|
wincmd t
|
||||||
set winheight=1 winwidth=1
|
set winheight=1 winwidth=1
|
||||||
exe 'vert 1resize ' . ((&columns * 90 + 90) / 181)
|
exe 'vert 1resize ' . ((&columns * 98 + 98) / 196)
|
||||||
exe 'vert 2resize ' . ((&columns * 90 + 90) / 181)
|
exe 'vert 2resize ' . ((&columns * 97 + 98) / 196)
|
||||||
argglobal
|
argglobal
|
||||||
setlocal fdm=manual
|
setlocal fdm=manual
|
||||||
setlocal fde=0
|
setlocal fde=0
|
||||||
|
|
@ -77,12 +77,12 @@ setlocal fml=1
|
||||||
setlocal fdn=20
|
setlocal fdn=20
|
||||||
setlocal fen
|
setlocal fen
|
||||||
silent! normal! zE
|
silent! normal! zE
|
||||||
let s:l = 61 - ((45 * winheight(0) + 40) / 81)
|
let s:l = 96 - ((77 * winheight(0) + 40) / 80)
|
||||||
if s:l < 1 | let s:l = 1 | endif
|
if s:l < 1 | let s:l = 1 | endif
|
||||||
exe s:l
|
exe s:l
|
||||||
normal! zt
|
normal! zt
|
||||||
61
|
96
|
||||||
normal! 067l
|
normal! 029l
|
||||||
wincmd w
|
wincmd w
|
||||||
argglobal
|
argglobal
|
||||||
edit Makefile
|
edit Makefile
|
||||||
|
|
@ -95,17 +95,66 @@ setlocal fml=1
|
||||||
setlocal fdn=20
|
setlocal fdn=20
|
||||||
setlocal fen
|
setlocal fen
|
||||||
silent! normal! zE
|
silent! normal! zE
|
||||||
let s:l = 17 - ((16 * winheight(0) + 40) / 81)
|
let s:l = 17 - ((0 * winheight(0) + 40) / 80)
|
||||||
if s:l < 1 | let s:l = 1 | endif
|
if s:l < 1 | let s:l = 1 | endif
|
||||||
exe s:l
|
exe s:l
|
||||||
normal! zt
|
normal! zt
|
||||||
17
|
17
|
||||||
normal! 011l
|
normal! 011l
|
||||||
wincmd w
|
wincmd w
|
||||||
exe 'vert 1resize ' . ((&columns * 90 + 90) / 181)
|
exe 'vert 1resize ' . ((&columns * 98 + 98) / 196)
|
||||||
exe 'vert 2resize ' . ((&columns * 90 + 90) / 181)
|
exe 'vert 2resize ' . ((&columns * 97 + 98) / 196)
|
||||||
tabedit src/main.c
|
tabedit src/main.c
|
||||||
set splitbelow splitright
|
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 * 98 + 98) / 196)
|
||||||
|
exe 'vert 2resize ' . ((&columns * 97 + 98) / 196)
|
||||||
|
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 = 21 - ((20 * winheight(0) + 40) / 80)
|
||||||
|
if s:l < 1 | let s:l = 1 | endif
|
||||||
|
exe s:l
|
||||||
|
normal! zt
|
||||||
|
21
|
||||||
|
normal! 01l
|
||||||
|
wincmd w
|
||||||
|
argglobal
|
||||||
|
edit src/ft_ls.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 = 31 - ((30 * winheight(0) + 40) / 80)
|
||||||
|
if s:l < 1 | let s:l = 1 | endif
|
||||||
|
exe s:l
|
||||||
|
normal! zt
|
||||||
|
31
|
||||||
|
normal! 03l
|
||||||
|
wincmd w
|
||||||
|
exe 'vert 1resize ' . ((&columns * 98 + 98) / 196)
|
||||||
|
exe 'vert 2resize ' . ((&columns * 97 + 98) / 196)
|
||||||
|
tabedit src/ft_dir_get_ents.c
|
||||||
|
set splitbelow splitright
|
||||||
set nosplitbelow
|
set nosplitbelow
|
||||||
set nosplitright
|
set nosplitright
|
||||||
wincmd t
|
wincmd t
|
||||||
|
|
@ -120,13 +169,13 @@ setlocal fml=1
|
||||||
setlocal fdn=20
|
setlocal fdn=20
|
||||||
setlocal fen
|
setlocal fen
|
||||||
silent! normal! zE
|
silent! normal! zE
|
||||||
let s:l = 23 - ((22 * winheight(0) + 40) / 80)
|
let s:l = 24 - ((23 * winheight(0) + 40) / 80)
|
||||||
if s:l < 1 | let s:l = 1 | endif
|
if s:l < 1 | let s:l = 1 | endif
|
||||||
exe s:l
|
exe s:l
|
||||||
normal! zt
|
normal! zt
|
||||||
23
|
24
|
||||||
normal! 01l
|
normal! 0
|
||||||
tabedit src/ft_ls.c
|
tabedit src/lib_ent.c
|
||||||
set splitbelow splitright
|
set splitbelow splitright
|
||||||
set nosplitbelow
|
set nosplitbelow
|
||||||
set nosplitright
|
set nosplitright
|
||||||
|
|
@ -147,8 +196,8 @@ if s:l < 1 | let s:l = 1 | endif
|
||||||
exe s:l
|
exe s:l
|
||||||
normal! zt
|
normal! zt
|
||||||
49
|
49
|
||||||
normal! 026l
|
normal! 01l
|
||||||
tabnext 2
|
tabnext 4
|
||||||
if exists('s:wipebuf')
|
if exists('s:wipebuf')
|
||||||
silent exe 'bwipe ' . s:wipebuf
|
silent exe 'bwipe ' . s:wipebuf
|
||||||
endif
|
endif
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* 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/21 14:30:51 by jhalford ### ########.fr */
|
/* Updated: 2016/11/22 16:55:20 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -16,13 +16,15 @@
|
||||||
# define LS_MSG_ILLEGAL_OPT "ft_ls: illegal option -- %c\n"
|
# define LS_MSG_ILLEGAL_OPT "ft_ls: illegal option -- %c\n"
|
||||||
# define LS_MSG_USAGE "usage: ls [-%s] [file ...]\n"
|
# define LS_MSG_USAGE "usage: ls [-%s] [file ...]\n"
|
||||||
# define LS_MSG_FILE_ERR "ls: %s: no such file or directory\n"
|
# define LS_MSG_FILE_ERR "ls: %s: no such file or directory\n"
|
||||||
|
# define LS_MSG_ACC_ERR "ls: %s: Permission Denied\n"
|
||||||
|
|
||||||
# define OPTS_LL 0x0001
|
# define OPTS_LL 0x0001
|
||||||
# define OPTS_LA 0x0002
|
# define OPTS_LA 0x0002
|
||||||
# define OPTS_LR 0x0004
|
# define OPTS_LR 0x0004
|
||||||
# define OPTS_UR 0x0008
|
# define OPTS_UR 0x0008
|
||||||
# define OPTS_LT 0x0010
|
# define OPTS_LT 0x0010
|
||||||
# define OPTS_HEAD 0x0020
|
# define OPTS_ONE 0x0020
|
||||||
|
# define OPTS_HEAD 0x1000
|
||||||
|
|
||||||
# include "libft.h"
|
# include "libft.h"
|
||||||
# include <errno.h>
|
# include <errno.h>
|
||||||
|
|
@ -91,6 +93,7 @@ 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_error_access(char *s);
|
||||||
|
|
||||||
void ft_ent_free(void *ptr, size_t size);
|
void ft_ent_free(void *ptr, size_t size);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -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/21 14:23:30 by jhalford ### ########.fr */
|
/* Updated: 2016/11/22 17:11:46 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -20,7 +20,11 @@ t_list *ft_dir_get_ents(t_lsdata *topdir)
|
||||||
DIR *stream;
|
DIR *stream;
|
||||||
|
|
||||||
ent = NULL;
|
ent = NULL;
|
||||||
stream = opendir(topdir->path);
|
if (!(stream = opendir(topdir->path)))
|
||||||
|
{
|
||||||
|
ft_error_access(topdir->path);
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
while ((dirent = readdir(stream)))
|
while ((dirent = readdir(stream)))
|
||||||
{
|
{
|
||||||
data.path = ft_str3join(topdir->path, "/", dirent->d_name);
|
data.path = ft_str3join(topdir->path, "/", dirent->d_name);
|
||||||
|
|
|
||||||
|
|
@ -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/21 14:44:54 by jhalford ### ########.fr */
|
/* Updated: 2016/11/22 17:11:40 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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/21 14:25:24 by jhalford ### ########.fr */
|
/* Updated: 2016/11/22 16:07:01 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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/21 18:23:05 by jhalford ### ########.fr */
|
/* Updated: 2016/11/22 17:12:03 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -47,6 +47,10 @@ void ft_ent_print(t_list *ent, int *opts, t_lsdata *topdir, t_list *nextdir)
|
||||||
else
|
else
|
||||||
ft_ls_short(ent);
|
ft_ls_short(ent);
|
||||||
}
|
}
|
||||||
if (ent && (nextdir || ((*opts & OPTS_UR) && ft_ent_has_dir(ent))))
|
/* else */
|
||||||
|
/* ft_error_access(topdir->path); */
|
||||||
|
if ((!topdir && nextdir && ent)
|
||||||
|
|| (topdir && nextdir)
|
||||||
|
|| (ent && ((*opts & OPTS_UR) && ft_ent_has_dir(ent))))
|
||||||
ft_putchar('\n');
|
ft_putchar('\n');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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/21 13:21:32 by jhalford ### ########.fr */
|
/* Updated: 2016/11/22 16:58:14 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -18,7 +18,12 @@ void ft_error_option(char c)
|
||||||
ft_dprintf(2, LS_MSG_USAGE, LS_LEGAL_OPTS);
|
ft_dprintf(2, LS_MSG_USAGE, LS_LEGAL_OPTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ft_error_access(char *s)
|
||||||
|
{
|
||||||
|
ft_dprintf(2, LS_MSG_ACC_ERR, s);
|
||||||
|
}
|
||||||
|
|
||||||
void ft_error_dir(char *s)
|
void ft_error_dir(char *s)
|
||||||
{
|
{
|
||||||
ft_printf(LS_MSG_FILE_ERR, s);
|
ft_dprintf(2, 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/21 17:22:25 by jhalford ### ########.fr */
|
/* Updated: 2016/11/22 16:07:09 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* 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/21 17:54:05 by jhalford ### ########.fr */
|
/* Updated: 2016/11/22 16:19:55 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -113,6 +113,7 @@ int ft_ls_long_pads(t_list *ent, t_pads *pads)
|
||||||
FT_MAX_WR(pads->major, (int)ft_ilen(major(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);
|
pads->size = FT_MAX(pads->size, pads->minor ?
|
||||||
|
pads->minor + pads->major + 3 : pads->size);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* 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/21 14:39:25 by jhalford ### ########.fr */
|
/* Updated: 2016/11/22 17:01:37 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -14,7 +14,6 @@
|
||||||
|
|
||||||
static void ft_ls_parse_files(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)
|
||||||
{
|
{
|
||||||
DIR *stream;
|
|
||||||
t_lsdata data;
|
t_lsdata data;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
@ -28,11 +27,8 @@ static void ft_ls_parse_files(int ac, char **av, t_list **dir, t_list **ent)
|
||||||
continue ;
|
continue ;
|
||||||
}
|
}
|
||||||
data.path = ft_strdup(av[i]);
|
data.path = ft_strdup(av[i]);
|
||||||
if ((stream = opendir(data.path)))
|
if (S_ISDIR(data.stat.st_mode))
|
||||||
{
|
|
||||||
ft_lstadd(dir, ft_lstnew(&data, sizeof(data)));
|
ft_lstadd(dir, ft_lstnew(&data, sizeof(data)));
|
||||||
closedir(stream);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
ft_lstadd(ent, ft_lstnew(&data, sizeof(data)));
|
ft_lstadd(ent, ft_lstnew(&data, sizeof(data)));
|
||||||
}
|
}
|
||||||
|
|
@ -49,6 +45,8 @@ static int ft_getopts(char *str)
|
||||||
{
|
{
|
||||||
if (str[i] == 'l')
|
if (str[i] == 'l')
|
||||||
opts |= OPTS_LL;
|
opts |= OPTS_LL;
|
||||||
|
else if (str[i] == '1')
|
||||||
|
opts |= OPTS_ONE;
|
||||||
else if (str[i] == 'a')
|
else if (str[i] == 'a')
|
||||||
opts |= OPTS_LA;
|
opts |= OPTS_LA;
|
||||||
else if (str[i] == 't')
|
else if (str[i] == 't')
|
||||||
|
|
@ -75,7 +73,16 @@ static int ft_ls_parse_options(int ac, char **av, int *opts)
|
||||||
while (++i < ac)
|
while (++i < ac)
|
||||||
{
|
{
|
||||||
if (av[i][0] == '-')
|
if (av[i][0] == '-')
|
||||||
|
{
|
||||||
|
if (!av[i][1])
|
||||||
|
break ;
|
||||||
|
if (av[i][1] == '-' && !av[i][2])
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
break ;
|
||||||
|
}
|
||||||
*opts |= ft_getopts(av[i] + 1);
|
*opts |= ft_getopts(av[i] + 1);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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/21 18:23:52 by jhalford ### ########.fr */
|
/* Updated: 2016/11/22 16:47:59 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue