aboutsummaryrefslogtreecommitdiff
path: root/idlestat.c
diff options
context:
space:
mode:
authorTuukka Tikkanen <tuukka.tikkanen@linaro.org>2014-12-10 14:16:06 +0200
committerTuukka Tikkanen <tuukka.tikkanen@linaro.org>2014-12-12 08:57:27 +0200
commitf18b1b7a4df9dec114386d9839a2c1e408fb0556 (patch)
treefae4aa046536de8b900177a51f3e951cfe2d4a10 /idlestat.c
parentffff381eadc10ee8a23bcf96ddac1c81b67d7fdd (diff)
report_ops: Add mechanism for report_ops to check program options
Some reports may require some program options to be set, but other reports may not require the same options. To keep details of these checks out of main() and getoptions(), this patch adds a new operation to report_ops for doing these checks when necessary. Pointer to struct program_options is passed to the op. If the options are not suitable for operation, the op must print an error message for the user and return -1. Otherwise the op should return 0. Signed-off-by: Tuukka Tikkanen <tuukka.tikkanen@linaro.org>
Diffstat (limited to 'idlestat.c')
-rw-r--r--idlestat.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/idlestat.c b/idlestat.c
index 3020a47..228c67a 100644
--- a/idlestat.c
+++ b/idlestat.c
@@ -1491,6 +1491,9 @@ int main(int argc, char *argv[], char *const envp[])
}
output_handler = options.report_ops;
+ if (output_handler->check_options &&
+ output_handler->check_options(&options) < 0)
+ return 1;
if (output_handler->check_output(&options, options.report_data))
return 1;