diff options
author | José Bollo <jose.bollo@iot.bzh> | 2015-12-10 16:39:05 +0100 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2015-12-10 16:39:05 +0100 |
commit | f3d64b7c741677cd28e2a11deed67196cd02b46a (patch) | |
tree | 57b6ee3ca5a206d78a39dbcdae49cac5a75ae59a /src/verbose.c | |
parent | 63f8720a3e610c0dc37bda3138d2e8de98ec1a78 (diff) |
added info retrieval
Change-Id: I6f91b15e87308cf01db4ddafa3c2715c251f5fe5
Diffstat (limited to 'src/verbose.c')
-rw-r--r-- | src/verbose.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/verbose.c b/src/verbose.c new file mode 100644 index 0000000..1472a90 --- /dev/null +++ b/src/verbose.c @@ -0,0 +1,36 @@ +/* + Copyright 2015 IoT.bzh + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include <string.h> + +int verbosity = 1; + +int verbose_scan_args(int argc, char **argv) +{ + int i, r; + for (i=r=0 ; i < argc ; i++) { + if (!strcmp(argv[i], "-q")) + verbosity = verbosity ? verbosity-1 : 0; + else if (!strcmp(argv[i], "-v")) + verbosity++; + else + argv[r++] = argv[i]; + } + argv[r] = NULL; + return r; +} + + |