From 50efd881f6dd18869d3b493cf6ff4994b4a3e60a Mon Sep 17 00:00:00 2001 From: tth Date: Wed, 5 Dec 2018 16:04:09 +0100 Subject: [PATCH] add verbosity control, first part --- fake-values.c | 3 +++ funcs.c | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/fake-values.c b/fake-values.c index 82fc01a..6b412ac 100644 --- a/fake-values.c +++ b/fake-values.c @@ -5,10 +5,13 @@ #include #include "funcs.h" +int verbosity; + int main(int argc, char *argv[]) { fprintf(stderr, "fake values - %s %s\n", __DATE__, __TIME__); +verbosity = 1; printf("%d\n", random1000(0)); return 0; diff --git a/funcs.c b/funcs.c index bf47dfc..15cba7a 100644 --- a/funcs.c +++ b/funcs.c @@ -7,9 +7,13 @@ #include "funcs.h" +extern int verbosity; + int random1000(int foo) { int value; +if (verbosity) + fprintf(stderr, "%s(%d)\n", __func__, foo); value = rand() % 1000; return value; }