From 8abc526e0b76ed88800b70716788884971593db4 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sun, 17 Nov 2019 00:54:28 -0600 Subject: [PATCH] Bugfix: only present error when --first and --last are both provided and --last is less than --first If --first is specified by itself, --last is implicitly defined as the EOF. --- level_3/byte_dump/c/byte_dump.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/level_3/byte_dump/c/byte_dump.c b/level_3/byte_dump/c/byte_dump.c index 3759a89..cda6533 100644 --- a/level_3/byte_dump/c/byte_dump.c +++ b/level_3/byte_dump/c/byte_dump.c @@ -235,15 +235,17 @@ extern "C" { data->last = number; } - if (data->first > data->last) { - fl_color_print(f_standard_error, data->context.error, data->context.reset, "ERROR: The parameter '"); - fl_color_print(f_standard_error, data->context.notable, data->context.reset, "--%s", byte_dump_long_first); - fl_color_print(f_standard_error, data->context.error, data->context.reset, "' value cannot be greater than the parameter '"); - fl_color_print(f_standard_error, data->context.notable, data->context.reset, "--%s", byte_dump_long_last); - fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "' value."); + if (data->parameters[byte_dump_parameter_first].result == f_console_result_additional && data->parameters[byte_dump_parameter_last].result == f_console_result_additional) { + if (data->first > data->last) { + fl_color_print(f_standard_error, data->context.error, data->context.reset, "ERROR: The parameter '"); + fl_color_print(f_standard_error, data->context.notable, data->context.reset, "--%s", byte_dump_long_first); + fl_color_print(f_standard_error, data->context.error, data->context.reset, "' value cannot be greater than the parameter '"); + fl_color_print(f_standard_error, data->context.notable, data->context.reset, "--%s", byte_dump_long_last); + fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "' value."); - byte_dump_delete_data(data); - return f_status_set_error(status); + byte_dump_delete_data(data); + return f_status_set_error(status); + } } if (data->process_pipe) { -- 1.8.3.1