]> Kevux Git Server - fll/commitdiff
Bugfix: only present error when --first and --last are both provided and --last is...
authorKevin Day <thekevinday@gmail.com>
Sun, 17 Nov 2019 06:54:28 +0000 (00:54 -0600)
committerKevin Day <thekevinday@gmail.com>
Sun, 17 Nov 2019 06:54:28 +0000 (00:54 -0600)
If --first is specified by itself, --last is implicitly defined as the EOF.

level_3/byte_dump/c/byte_dump.c

index 3759a89f3145ce38edd2bfc14d10bd4d1201278e..cda6533a95b38b4dbd5c7cb6841cd56759c525e0 100644 (file)
@@ -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) {