om

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

commit c102fbe4c9a52d6c4b572115ba7d2a6c4f1cf44a
parent 2383eb9ca4d7767279003ccd4bc5b2c73ebb2c1d
Author: Larry Hynes <larry@larryhynes.com>
Date:   Wed,  5 Jul 2017 01:03:56 +0100

Handle '/' as the argument

Diffstat:
om.c | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/om.c b/om.c @@ -30,9 +30,11 @@ isdir() char *strp() { - size_t len = strlen(dir); - if ((len > 0) && (dir[len -1] == '/')) - dir[len -1] = '\0'; + if (strcmp(dir, "/") != 0) { + size_t len = strlen(dir); + if ((dir[len -1] == '/')) + dir[len -1] = '\0'; + } return dir; }