add verbosity control, first part

This commit is contained in:
tth 2018-12-05 16:04:09 +01:00
parent b022744a46
commit 50efd881f6
2 changed files with 7 additions and 0 deletions

View File

@ -5,10 +5,13 @@
#include <stdio.h> #include <stdio.h>
#include "funcs.h" #include "funcs.h"
int verbosity;
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
fprintf(stderr, "fake values - %s %s\n", __DATE__, __TIME__); fprintf(stderr, "fake values - %s %s\n", __DATE__, __TIME__);
verbosity = 1;
printf("%d\n", random1000(0)); printf("%d\n", random1000(0));
return 0; return 0;

View File

@ -7,9 +7,13 @@
#include "funcs.h" #include "funcs.h"
extern int verbosity;
int random1000(int foo) int random1000(int foo)
{ {
int value; int value;
if (verbosity)
fprintf(stderr, "%s(%d)\n", __func__, foo);
value = rand() % 1000; value = rand() % 1000;
return value; return value;
} }