summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Malone <dwmalone@FreeBSD.org>2004-06-22 16:02:29 +0000
committerDavid Malone <dwmalone@FreeBSD.org>2004-06-22 16:02:29 +0000
commit60e52383e720dd163ea4af154c9d3686cbd930aa (patch)
treed762a81f458c2eb80a3c1a3fcd4f7cdde19c6a3e
parent291cb0ac6992cd391b65e904144faf1103eb38cb (diff)
Notes
-rw-r--r--bin/ls/cmp.c48
1 files changed, 42 insertions, 6 deletions
diff --git a/bin/ls/cmp.c b/bin/ls/cmp.c
index aebb46a9d9de..17c856e53c29 100644
--- a/bin/ls/cmp.c
+++ b/bin/ls/cmp.c
@@ -63,35 +63,71 @@ revnamecmp(const FTSENT *a, const FTSENT *b)
int
modcmp(const FTSENT *a, const FTSENT *b)
{
- return (b->fts_statp->st_mtime - a->fts_statp->st_mtime);
+ if (b->fts_statp->st_mtimespec.tv_sec >
+ a->fts_statp->st_mtimespec.tv_sec)
+ return 1;
+ if (b->fts_statp->st_mtimespec.tv_sec <
+ a->fts_statp->st_mtimespec.tv_sec)
+ return -1;
+ if (b->fts_statp->st_mtimespec.tv_nsec >
+ a->fts_statp->st_mtimespec.tv_nsec)
+ return 1;
+ if (b->fts_statp->st_mtimespec.tv_nsec <
+ a->fts_statp->st_mtimespec.tv_nsec)
+ return -1;
+ return (strcoll(a->fts_name, b->fts_name));
}
int
revmodcmp(const FTSENT *a, const FTSENT *b)
{
- return (a->fts_statp->st_mtime - b->fts_statp->st_mtime);
+ return (modcmp(b,a));
}
int
acccmp(const FTSENT *a, const FTSENT *b)
{
- return (b->fts_statp->st_atime - a->fts_statp->st_atime);
+ if (b->fts_statp->st_atimespec.tv_sec >
+ a->fts_statp->st_atimespec.tv_sec)
+ return 1;
+ if (b->fts_statp->st_atimespec.tv_sec <
+ a->fts_statp->st_atimespec.tv_sec)
+ return -1;
+ if (b->fts_statp->st_atimespec.tv_nsec >
+ a->fts_statp->st_atimespec.tv_nsec)
+ return 1;
+ if (b->fts_statp->st_atimespec.tv_nsec <
+ a->fts_statp->st_atimespec.tv_nsec)
+ return -1;
+ return (strcoll(a->fts_name, b->fts_name));
}
int
revacccmp(const FTSENT *a, const FTSENT *b)
{
- return (a->fts_statp->st_atime - b->fts_statp->st_atime);
+ return (acccmp(b,a));
}
int
statcmp(const FTSENT *a, const FTSENT *b)
{
- return (b->fts_statp->st_ctime - a->fts_statp->st_ctime);
+ if (b->fts_statp->st_ctimespec.tv_sec >
+ a->fts_statp->st_ctimespec.tv_sec)
+ return 1;
+ if (b->fts_statp->st_ctimespec.tv_sec <
+ a->fts_statp->st_ctimespec.tv_sec)
+ return -1;
+ if (b->fts_statp->st_ctimespec.tv_nsec >
+ a->fts_statp->st_ctimespec.tv_nsec)
+ return 1;
+ if (b->fts_statp->st_ctimespec.tv_nsec <
+ a->fts_statp->st_ctimespec.tv_nsec)
+ return -1;
+ return (strcoll(a->fts_name, b->fts_name));
}
int
revstatcmp(const FTSENT *a, const FTSENT *b)
{
- return (a->fts_statp->st_ctime - b->fts_statp->st_ctime);
+ return (statcmp(b,a));
}