commit: 1a77146620d5a3d5d252f825707f14ea0f544d7f
parent 321c636e8f9fe8822d8ef36a89c39ad7ff818774
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Wed, 24 Sep 2025 06:16:02 +0200
add -v (verbose) option
Diffstat:
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/checksrc.c b/checksrc.c
@@ -8,6 +8,7 @@
#include <stdio.h>
#include <string.h>
#include <unistd.h>
+#include <stdbool.h>
#if 0
static const char *generated[] = {
@@ -31,6 +32,8 @@ static const char *generated[] = {
// Maybe this table should be passed to lex for efficiency
#endif
+bool verbose = false;
+
static int
checkfile(const char *fname)
{
@@ -139,6 +142,8 @@ checkfile(const char *fname)
}
}
+ if(verbose) printf("%s: OK\n", fname);
+
return 0;
}
@@ -218,8 +223,18 @@ checkdir(const char *dirname)
int
main(int argc, char *argv[])
{
- argc -= 1;
- argv += 1;
+ for(int c = -1; (c = getopt(argc, argv, "v")) != -1;)
+ {
+ switch(c)
+ {
+ case 'v':
+ verbose = true;
+ break;
+ }
+ }
+
+ argc -= optind;
+ argv += optind;
return checkdir(".");
}