From patchwork Thu Nov 22 16:30:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [2/3] lib: fwts_framework: sanity check new options Date: Thu, 22 Nov 2012 06:30:33 -0000 From: Colin King X-Patchwork-Id: 201081 Message-Id: <1353601834-5335-3-git-send-email-colin.king@canonical.com> To: fwts-devel@lists.ubuntu.com From: Colin Ian King The --filter-error-discard and --filter-error-keep options are mutually exclusive. So check for this. Signed-off-by: Colin Ian King Acked-by: Keng-Yu Lin Acked-by: Ivan Hu --- src/lib/src/fwts_framework.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c index 1f01466..eac05bd 100644 --- a/src/lib/src/fwts_framework.c +++ b/src/lib/src/fwts_framework.c @@ -1233,6 +1233,16 @@ int fwts_framework_args(const int argc, char **argv) goto tidy_close; } + /* These are mutually exclusive, both cannot have items */ + if ((fwts_list_len(&fw->errors_filter_keep) > 0) && + (fwts_list_len(&fw->errors_filter_discard) > 0)) { + fprintf(stderr, + "The --filter-error-discard and --filter-error-keep options are\n" + "mutually exclusive. Specify one or the other, but not both.\n"); + ret = FWTS_ERROR; + goto tidy_close; + } + /* Ensure we have just one log type specified for non-filename logging */ if (fwts_log_type_count(fw->log_type) > 1 && fwts_log_get_filename_type(fw->results_logname) != LOG_FILENAME_TYPE_FILE) {