From: Kevin Day Date: Sun, 17 Nov 2019 06:54:28 +0000 (-0600) Subject: Bugfix: only present error when --first and --last are both provided and --last is... X-Git-Tag: 0.5.0~377 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=8abc526e0b76ed88800b70716788884971593db4;p=fll 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. --- 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) {