diff options
author | Tuukka Tikkanen <tuukka.tikkanen@linaro.org> | 2014-12-10 14:16:06 +0200 |
---|---|---|
committer | Tuukka Tikkanen <tuukka.tikkanen@linaro.org> | 2014-12-12 08:57:27 +0200 |
commit | f18b1b7a4df9dec114386d9839a2c1e408fb0556 (patch) | |
tree | fae4aa046536de8b900177a51f3e951cfe2d4a10 /idlestat.c | |
parent | ffff381eadc10ee8a23bcf96ddac1c81b67d7fdd (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.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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; |