int format_line(char *file, struct stat *s, t_opt * t) { struct passwd *p; struct group *g; file = file; print_right(s); my_printf("%d ", s->st_nlink); if ((p = getpwuid(s->st_uid)) == NULL) return (1); if ((g = getgrgid(s->st_gid)) == NULL) return (1); (!t->g) ? my_printf("%s ", p->pw_name) : 0; my_printf("%s", g->gr_name); display_spaces(6 - my_intlen(s->st_size)); my_printf("%d ", s->st_size); disp_date(&s->st_mtime); if (S_ISDIR(s->st_mode)) my_printf("\033[34m%s\033[0m\n", file); else if ((s->st_mode & S_IXUSR)) my_printf("\033[32m%s\033[0m\n", file); else my_printf("%s\n", file); return (0); }
void my_fixnbr(int num, char c, int size) { int i; int length; i = 0; length = my_intlen(num); while (i < size - length) { my_putchar(c); i++; } my_putdec(num); }