om

om - the most recently modified file in a directory
git clone git://git.larryhynes.net/om
Log | Files | Refs | README | LICENSE

commit 55ac011634edab1668e1900d0e2bc1b676755810
parent addc3ee160733c9b719c45f2336c69addf1634e3
Author: Larry Hynes <larry@larryhynes.com>
Date:   Thu, 13 Jul 2017 09:20:07 +0100

Remove inode sort

I wasn't sure about this to begin with, and now I'm less sure. On
balance, I think om should concentrate on mtime only. That will
skew things in certain directories but, I think in most 'everyday'
situations om will do The Right Thing.

Diffstat:
om.c | 10----------
1 file changed, 0 insertions(+), 10 deletions(-)

diff --git a/om.c b/om.c @@ -45,7 +45,6 @@ om(void) struct dirent *ent; struct stat sb; time_t mtime = 0; - ino_t ino = 0; size_t len; int c = 0; @@ -76,15 +75,6 @@ om(void) errx(1, "Filename too long"); mtime = sb.st_mtime; } - if (sb.st_mtime == mtime) { - if (sb.st_ino > ino) { - len = strlcpy(res, ent->d_name, - sizeof(res)); - if (len >= sizeof(res)) - errx(1, "Filename too long"); - ino = sb.st_ino; - } - } } }