static int _t_print_long(char const * archive, struct ar_hdr * hdr, char const * name) { mode_t mode; uid_t uid; gid_t gid; size_t size; struct tm * tm; char buf[24]; if(_ar_get_mode(hdr, &mode) != 0 || _ar_get_uid(hdr, &uid) != 0 || _ar_get_gid(hdr, &gid) != 0 || _ar_get_size(hdr, &size) != 0 || (tm = _ar_get_date(hdr)) == NULL) { fprintf(stderr, "%s%s%s", PACKAGE ": ", archive, ": Invalid archive\n"); return 1; } if(strftime(buf, sizeof(buf), "%b %d %H:%M %Y", tm) == 0) return _ar_error("strftime", 1); printf("%s %u/%u %lu %s %s\n", _long_mode(mode), uid, gid, (unsigned long)size, buf, name); return 0; }
static void _long_print(Prefs * prefs, char const * filename, char const * basename, struct stat * st) { char mode[11]; char const * owner; char const * group; char const * date; _long_mode(mode, st->st_mode); owner = _long_owner(st->st_uid); group = _long_group(st->st_gid); if(*prefs & LS_PREFS_u) date = _long_date(st->st_atime); else if(*prefs & LS_PREFS_c) date = _long_date(st->st_ctime); else date = _long_date(st->st_mtime); printf("%s %2u %-7s %-7s %6u %s %s", mode, (unsigned)st->st_nlink, owner, group, (unsigned)st->st_size, date, basename); if(S_ISLNK(st->st_mode) && !(*prefs & LS_PREFS_L)) /* FIXME not in POSIX? */ _print_link(filename); else if(*prefs & LS_PREFS_F) fputc(_file_mode_letter(st->st_mode), stdout); fputc('\n', stdout); }