diff --git a/fake-values.c b/fake-values.c index 09f95bf..4ba730c 100644 --- a/fake-values.c +++ b/fake-values.c @@ -3,16 +3,33 @@ */ #include +#include + #include "funcs.h" int verbosity; +/* --------------------------------------------------------------- */ + int main(int argc, char *argv[]) { -fprintf(stderr, "fake values - %s %s\n", __DATE__, __TIME__); +int opt; + +while ((opt = getopt(argc, argv, "v")) != -1) { + switch (opt) { + case 'v': verbosity++; break; + default: break; + } + } + +if (verbosity > 1) + fprintf(stderr, "fake values - %s %s\n", __DATE__, __TIME__); + + -verbosity = 1; printf("%f %d\n", dtime(), random1000(0)); return 0; } + +/* --------------------------------------------------------------- */ diff --git a/funcs.c b/funcs.c index b099c2a..0587335 100644 --- a/funcs.c +++ b/funcs.c @@ -16,7 +16,7 @@ int random1000(int foo) { int value; if (verbosity) - fprintf(stderr, "%s(%d)\n", __func__, foo); + fprintf(stderr, ">>> %s(%d)\n", __func__, foo); value = rand() % 1000; return value; }