summaryrefslogtreecommitdiffstats
path: root/bin/ls/cmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/ls/cmp.c')
-rw-r--r--bin/ls/cmp.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/bin/ls/cmp.c b/bin/ls/cmp.c
index 903da8b..37b4a75 100644
--- a/bin/ls/cmp.c
+++ b/bin/ls/cmp.c
@@ -139,3 +139,21 @@ revstatcmp(const FTSENT *a, const FTSENT *b)
return (statcmp(b, a));
}
+
+int
+sizecmp(const FTSENT *a, const FTSENT *b)
+{
+
+ if (b->fts_statp->st_size > a->fts_statp->st_size)
+ return (1);
+ if (b->fts_statp->st_size < a->fts_statp->st_size)
+ return (-1);
+ return (strcoll(a->fts_name, b->fts_name));
+}
+
+int
+revsizecmp(const FTSENT *a, const FTSENT *b)
+{
+
+ return (sizecmp(b, a));
+}
OpenPOWER on IntegriCloud