From: Kevin Day Date: Sun, 17 Nov 2019 06:58:40 +0000 (-0600) Subject: Bugfix: When --last is set to 0, entire file is dumped X-Git-Tag: 0.5.0~376 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=d4e3f934e2522d7e360e74d6a9414e4db35b9ed6;p=fll Bugfix: When --last is set to 0, entire file is dumped The --last value being set to 0 is internally used to represent entire file. Explicitly setting --last to 0 makes no sense, so set the minimum allowed size for --last to 1. --- diff --git a/level_3/byte_dump/c/byte_dump.c b/level_3/byte_dump/c/byte_dump.c index cda6533..5bdc724 100644 --- a/level_3/byte_dump/c/byte_dump.c +++ b/level_3/byte_dump/c/byte_dump.c @@ -219,11 +219,11 @@ extern "C" { f_number_unsigned number = 0; status = fl_console_parameter_to_number_unsigned(arguments.argv[data->parameters[byte_dump_parameter_last].additional.array[data->parameters[byte_dump_parameter_last].additional.used - 1]], &number); - if (f_status_is_error(status) || number > f_type_number_size_unsigned) { + if (f_status_is_error(status) || number < 1 || number > f_type_number_size_unsigned) { 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_last); fl_color_print(f_standard_error, data->context.error, data->context.reset, "' value can only be a number (inclusively) between "); - fl_color_print(f_standard_error, data->context.notable, data->context.reset, "0"); + fl_color_print(f_standard_error, data->context.notable, data->context.reset, "1"); fl_color_print(f_standard_error, data->context.error, data->context.reset, " and "); fl_color_print(f_standard_error, data->context.notable, data->context.reset, "%llu", f_type_number_size_unsigned); fl_color_print_line(f_standard_error, data->context.error, data->context.reset, ".");