om

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

commit 402aa560ed0ce4823c1b5ed5dcae747020b51318
parent 80c37f2cf8544a71a0431bba540c2820a5856bb7
Author: Larry Hynes <larry@larryhynes.com>
Date:   Tue Apr 11 16:10:36 +0100

Don't use sysexits.h

- errx(1, "foo") will suffice
- while here, ensure main returns 0 on success

Diffstat:
om.c | 9++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/om.c b/om.c @@ -5,7 +5,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <sysexits.h> #define MAX_LEN 1024 @@ -21,7 +20,7 @@ isadir() return 0; } else { - errx(EX_NOINPUT, "Could not stat %s", dir); + errx(1, "Could not stat %s", dir); return 1; } } @@ -53,7 +52,7 @@ om(const char* dir, char* rcnt) closedir(dirp); } else { - errx(EX_NOINPUT, "Could not open %s", dir); + errx(1, "Could not open %s", dir); } } @@ -65,7 +64,7 @@ main(int argc, char *argv[]) dir = argv[1]; } else { - errx(EX_USAGE, "Usage: %s directory", argv[0]); + errx(1, "Usage: %s directory", argv[0]); } isadir(); @@ -73,7 +72,7 @@ main(int argc, char *argv[]) om(dir, rcnt); printf("%s\n", rcnt); - return 1; + return 0; }