diff options
Diffstat (limited to 'bin/ls/cmp.c')
-rw-r--r-- | bin/ls/cmp.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/bin/ls/cmp.c b/bin/ls/cmp.c index 37b4a75..badd108 100644 --- a/bin/ls/cmp.c +++ b/bin/ls/cmp.c @@ -115,6 +115,32 @@ revacccmp(const FTSENT *a, const FTSENT *b) } int +birthcmp(const FTSENT *a, const FTSENT *b) +{ + + if (b->fts_statp->st_birthtimespec.tv_sec > + a->fts_statp->st_birthtimespec.tv_sec) + return (1); + if (b->fts_statp->st_birthtimespec.tv_sec < + a->fts_statp->st_birthtimespec.tv_sec) + return (-1); + if (b->fts_statp->st_birthtimespec.tv_nsec > + a->fts_statp->st_birthtimespec.tv_nsec) + return (1); + if (b->fts_statp->st_birthtimespec.tv_nsec < + a->fts_statp->st_birthtimespec.tv_nsec) + return (-1); + return (strcoll(a->fts_name, b->fts_name)); +} + +int +revbirthcmp(const FTSENT *a, const FTSENT *b) +{ + + return (birthcmp(b, a)); +} + +int statcmp(const FTSENT *a, const FTSENT *b) { |