void core(t_opt arg, t_list *path, int multidir) { DIR *dir; t_list *file; t_list *directory; t_list *cur; file = NULL; directory = NULL; cur = path; while (cur) { if ((dir = opendir(cur->content)) == NULL) errno != ENOTDIR ? basicerror("ft_ls: ", cur->content, 0) : \ ft_lstpushback(&file, cur->content, cur->content_size); else { ft_lstpushback(&directory, cur->content, cur->content_size); if (closedir(dir) == -1) basicerror("ft_ls: ", cur->content, 0); } cur = cur->next; } file ? do_ls_file(arg, file) : NULL; file && directory ? ft_putchar('\n') : NULL; directory ? do_ls_dir(arg, directory, multidir) : NULL; }
void generror(int n, int data) /* * most errors come here */ { if (inputFile) basicerror(n, (void*)data); }
void generror(int n, int data) /* * most errors come here */ { basicerror(n, (void*)data); }
void Error(char *string) /* * some of the library functions required a generic error function * * we are remapping it to the C/C++ error routines */ { basicerror(ERR_INTERP, (void*)string); }
void gensymerror(int n, char *data) /* * errors come here if the error has a symbol name */ { char buf[100]; if (data) strcpy(buf, data); else buf[0] = 0; basicerror(n, (void*)rcStrdup(buf)); }
void do_recursion(t_opt arg, char *path) { t_elem *files; DIR *dir; files = NULL; ft_putchar('\n'); ft_putstr(path); ft_putstr(":\n"); if ((dir = opendir(path)) != NULL) { while (elemget(&files, readdir(dir), \ ft_strjoin(path, "/"), arg) != 0) ; closedir(dir); if (files) display_file(arg, files, 1); files = NULL; } else basicerror("ft_ls: ", path, 0); }
void gensymerrorexp(int n, char *data) { basicerror(n, (void*)rcStrdup(data)); }
void generrorexp(int n, int data) { basicerror(n, (void*)data); }