void format_long(char *name, t_stat st, t_env *e) { ino_number(st, e); file_mode(st); number_of_link(st, e); owner_name(st, e); group_name(st, e); number_of_bytes(st, e); last_modif(e, st); path_name(name, st, e); }
int max_user(char **tab, char *option) { int max; t_stat *buf; int j; j = 0; max = 0; (!(buf = (t_stat*)malloc(sizeof(t_stat)))) ? perror_malloc() : 0; while (tab[j]) { if ((IS_A_2 && !is_main(tab[j])) || IS_A || IS_F || !(is_hidden(tab[j]))) { init_buf(tab[j], &buf); if ((int)ft_strlen(owner_name(buf->st_uid)) > max) max = ft_strlen(owner_name(buf->st_uid)); } ++j; } ft_tstatdel(&buf); return (max); }
static void disp_all(char *file, t_stat *buf, t_max *max, char *option) { disp_permit(buf->st_mode); disp_xattr(file); disp_link(buf, max->max_lnk); if (!(IS_G)) disp_owner(owner_name(buf->st_uid), max->max_user); if (!(IS_O)) disp_group(group_name(buf->st_gid), max->max_group); if (IS_O && IS_G) write(1, " ", 2); disp_size(buf, max->max_size, max->is_b_c_file); ft_putstr(s_time(buf)); write(1, " ", 1); (is_lnk(file)) ? disp_lnk_name(file) : 0; if (!(is_lnk(file))) ft_putstr_name(file); if (IS_P && is_file_or_dir(file) == 2) write(1, "/", 1); if (!(is_lnk(file))) write(1, "\n", 1); }