This patch adds the '-v' option in the command line. The level of verbosity is choosen by the number of time the -v occurs.
no -v option : verbosity 0 -v : verbosity 1 -vv : verbosity 2 -vvv : verbosity 3 etc ... Note this option is not yet used in the code. Signed-off-by: Daniel Lezcano <daniel.lezc...@linaro.org> --- idlestat.c | 6 +++++- idlestat.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/idlestat.c b/idlestat.c index abbb787..8138e35 100644 --- a/idlestat.c +++ b/idlestat.c @@ -1070,6 +1070,7 @@ int getoptions(int argc, char *argv[], struct program_options *options) { "duration", required_argument, NULL, 't' }, { "version", no_argument, NULL, 'V' }, { "dump", no_argument, NULL, 'z' }, + { "verbose", no_argument, NULL, 'v' }, { 0, 0, 0, 0 } }; int c; @@ -1082,7 +1083,7 @@ int getoptions(int argc, char *argv[], struct program_options *options) int optindex = 0; - c = getopt_long(argc, argv, ":df:hi:t:Vz", + c = getopt_long(argc, argv, ":df:hi:t:Vvz", long_options, &optindex); if (c == -1) break; @@ -1108,6 +1109,9 @@ int getoptions(int argc, char *argv[], struct program_options *options) case 'z': options->dump = true; break; + case 'v': + options->verbose++; + break; case 0: /* getopt_long() set a variable, just keep going */ break; case ':': /* missing option argument */ diff --git a/idlestat.h b/idlestat.h index 3317a8f..f874bb8 100644 --- a/idlestat.h +++ b/idlestat.h @@ -133,6 +133,7 @@ struct program_options { int format; unsigned int duration; char *filename; + int verbose; }; -- 1.7.9.5 _______________________________________________ linaro-dev mailing list linaro-dev@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-dev