om

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

commit 89c5b6b9f0b5b9ee15b822d5f4879c07269847d3
parent 9c4982be1fb94c3cd8eda29253a4b3320d2426ce
Author: Larry Hynes <larry@larryhynes.com>
Date:   Thu,  6 Jul 2017 12:35:29 +0100

Handle '/' as argument a bit better

Diffstat:
om.c | 6+++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/om.c b/om.c @@ -13,6 +13,7 @@ char *dir; char buf[PATH_MAX]; char res[NAME_MAX]; +int r; /* Check for, and remove, trailing slash on argument */ char @@ -22,6 +23,8 @@ char size_t len = strlen(dir); if (dir[len -1] == '/') dir[len -1] = '\0'; + } else { + r = 1; } return dir; } @@ -87,7 +90,8 @@ void prnt(char *d, char *f) { fputs(d, stdout); - putchar('/'); + if (r != 1) + putchar('/'); puts(f); }