* Copyright (c) 1989 The Regents of the University of California.
* %sccs.include.redist.c%
static char sccsid
[] = "@(#)ls.c 5.4 (Berkeley) %G%";
/* Derived from the print routines in the ls(1) source code. */
printlong(name
, accpath
, sb
)
char *name
; /* filename to print */
char *accpath
; /* current valid path to filename */
struct stat
*sb
; /* stat buffer */
char modep
[15], *user_from_uid(), *group_from_gid(), *strerror();
(void)printf("%6lu %4ld ", sb
->st_ino
, sb
->st_blocks
);
(void)strmode(sb
->st_mode
, modep
);
(void)printf("%s %3u %-*s %-*s ", modep
, sb
->st_nlink
, UT_NAMESIZE
,
user_from_uid(sb
->st_uid
, 0), UT_NAMESIZE
,
group_from_gid(sb
->st_gid
, 0));
if (S_ISCHR(sb
->st_mode
) || S_ISBLK(sb
->st_mode
))
(void)printf("%3d, %3d ", major(sb
->st_rdev
),
(void)printf("%8ld ", sb
->st_size
);
(void)printf("%s", name
);
if (S_ISLNK(sb
->st_mode
))
char *longstring
, *ctime();
longstring
= ctime((long *)&ftime
);
(void)putchar(longstring
[i
]);
#define SIXMONTHS ((DAYSPERNYEAR / 2) * SECSPERDAY)
if (ftime
+ SIXMONTHS
> time((time_t *)NULL
))
for (i
= 11; i
< 16; ++i
)
(void)putchar(longstring
[i
]);
for (i
= 20; i
< 24; ++i
)
(void)putchar(longstring
[i
]);
char path
[MAXPATHLEN
+ 1], *strerror();
if ((lnklen
= readlink(name
, path
, MAXPATHLEN
)) == -1) {
(void)fprintf(stderr
, "\nfind: %s: %s\n", name
, strerror(errno
));
(void)printf(" -> %s", path
);