diff --git a/ls/Makefile b/ls/Makefile index fe9fbfd0..6a5ec88a 100644 --- a/ls/Makefile +++ b/ls/Makefile @@ -21,10 +21,7 @@ RM = /bin/rm -rf .PHONY: all clean fclean re tags test libft -all: libft $(NAME) $(TAGFILE) - -test: - gcc -Iincludes main.c libftprintf.a +all: $(NAME) $(TAGFILE) $(TAGFILE): $(D_SRC)/*.c @ctags -f $(TAGFILE) $(addprefix $(D_SRC)/, $(F_SRC)) @@ -38,13 +35,15 @@ $(D_OBJ)/%.o: $(D_SRC)/%.c $(D_INC) libft: @$(MAKE) -C libft/ 2>/dev/null -$(NAME): $(DF_OBJ) libft/libft.a +$(NAME): libft $(DF_OBJ) libft/libft.a $(CC) $(O_INC) -Llibft -lft $(W_FLAGS) $(DF_OBJ) -o $@ $(D_FLAGS) clean: $(RM) $(D_OBJ) + @$(MAKE) -C libft clean 2>/dev/null fclean: clean $(RM) $(NAME) + @$(MAKE) -C libft fclean 2>/dev/null re: fclean all diff --git a/ls/auteur b/ls/auteur new file mode 100644 index 00000000..b0e9923f --- /dev/null +++ b/ls/auteur @@ -0,0 +1 @@ +jhalford diff --git a/ls/ft_ls.fr.pdf b/ls/ft_ls.fr.pdf deleted file mode 100644 index 1a5094c2..00000000 Binary files a/ls/ft_ls.fr.pdf and /dev/null differ diff --git a/ls/libft b/ls/libft index 27c15060..2b3b4ad4 160000 --- a/ls/libft +++ b/ls/libft @@ -1 +1 @@ -Subproject commit 27c15060b59c76458da441881cdcb05055db1711 +Subproject commit 2b3b4ad458b00949259de266fa418e55dcd8c006 diff --git a/ls/src/ft_ls.c b/ls/src/ft_ls.c index 773ac2e2..4324a28d 100644 --- a/ls/src/ft_ls.c +++ b/ls/src/ft_ls.c @@ -18,9 +18,13 @@ void ft_ls_dirs(t_list *dir, char *opts) ft_ent_print(ent, opts, dirdata, dir); if (ft_strchr(opts, 'R')) { + ft_debug(); dir_r = ft_ent_get_dirs(ent); + ft_debug(); ft_lst_merge(&dir_r, dir); + ft_debug(); dir = dir_r; + ft_debug(); } } } diff --git a/ls/src/lib_ls_long2.c b/ls/src/lib_ls_long2.c index 3b719bad..ee4b73ec 100644 --- a/ls/src/lib_ls_long2.c +++ b/ls/src/lib_ls_long2.c @@ -35,13 +35,13 @@ int ft_ls_long_lnk(t_lsdata *data) ft_bzero(&statbuf, sizeof(statbuf)); if (S_ISLNK(data->stat.st_mode)) { - printf(" -> %lld\n", statbuf.st_size); - printf("path: %s\n", data->path); + ft_printf(" -> %lld\n", statbuf.st_size); + ft_printf("path: %s\n", data->path); if ((ret = stat(data->path, &statbuf)) == -1) - printf("stat=%i, errno=%i\n", ret, errno); + ft_printf("stat=%i, errno=%i\n", ret, errno); } else - printf("\n"); + ft_putendl(""); return (0); } @@ -53,12 +53,11 @@ int ft_ls_long_xattr(char *path) x = ' '; if ((n = ft_xattr_count(path)) == -1) { - printf("\ncouldnt get xattr: %i\n", n); + ft_printf("\ncouldnt get xattr: %i\n", n); return (1); } if (n > 0) x = '@'; - /* ft_printf("%c", x); */ ft_putchar(x); return (0); } @@ -74,12 +73,11 @@ void ft_ls_long_total(t_list *ent) { data = ent->content; stat = data->stat; - /* dirent = data->dirent; */ ent = ent->next; total += stat.st_blocks; } - printf("total %i\n", total); + ft_printf("total %i\n", total); } int ft_ls_long_pads(t_list *ent, t_pads *pads) @@ -93,7 +91,6 @@ int ft_ls_long_pads(t_list *ent, t_pads *pads) { data = ent->content; stat = data->stat; - /* dirent = data->dirent; */ ent = ent->next; if ((pwd = getpwuid(stat.st_uid)) == NULL) diff --git a/ls/src/main.c b/ls/src/main.c index b734d104..671d9fd8 100644 --- a/ls/src/main.c +++ b/ls/src/main.c @@ -1,5 +1,4 @@ #include "ftls.h" -#include "ftls.h" int main(int ac, char **av) {