]> Kevux Git Server - fll/commitdiff
Update: only print newline when --empty is used and --select is 0
authorKevin Day <thekevinday@gmail.com>
Sat, 16 Nov 2019 21:06:05 +0000 (15:06 -0600)
committerKevin Day <thekevinday@gmail.com>
Sat, 16 Nov 2019 21:11:51 +0000 (15:11 -0600)
In all other cases with --empty and --select, such as --select 1, if that selection is empty do not print any newlines.

Remove some impossible conditions.

level_3/fss_extended_read/c/private-fss_extended_read.c

index 08cd7601b4f453c9d66a78875f76117c460c593f..153680221af85b75d2529372dff3c3e9a4237210 100644 (file)
@@ -449,8 +449,6 @@ extern "C" {
                     if (select < data->contents.array[i].used) {
                       f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[i].array[select]);
                       fprintf(f_standard_output, "%c", f_string_eol);
-                    } else if (include_empty) {
-                      fprintf(f_standard_output, "%c", f_string_eol);
                     }
                   }
                   else {
@@ -466,7 +464,14 @@ extern "C" {
                   }
                 }
                 else if (include_empty) {
-                  fprintf(f_standard_output, "%c", f_string_eol);
+                  if (data->parameters[fss_extended_read_parameter_select].result == f_console_result_additional) {
+                    if (select == 0) {
+                      fprintf(f_standard_output, "%c", f_string_eol);
+                    }
+                  }
+                  else {
+                    fprintf(f_standard_output, "%c", f_string_eol);
+                  }
                 }
               }
 
@@ -480,8 +485,6 @@ extern "C" {
                 if (select < data->contents.array[i].used) {
                   f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[i].array[select]);
                   fprintf(f_standard_output, "%c", f_string_eol);
-                } else if (include_empty) {
-                  fprintf(f_standard_output, "%c", f_string_eol);
                 }
               }
               else {
@@ -497,7 +500,14 @@ extern "C" {
               }
             }
             else if (include_empty) {
-              fprintf(f_standard_output, "%c", f_string_eol);
+              if (data->parameters[fss_extended_read_parameter_select].result == f_console_result_additional) {
+                if (select == 0) {
+                  fprintf(f_standard_output, "%c", f_string_eol);
+                }
+              }
+              else {
+                fprintf(f_standard_output, "%c", f_string_eol);
+              }
             }
 
             break;
@@ -557,8 +567,6 @@ extern "C" {
             if (select < data->contents.array[i].used) {
               f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[i].array[select]);
               fprintf(f_standard_output, "%c", f_string_eol);
-            } else if (include_empty) {
-              fprintf(f_standard_output, "%c", f_string_eol);
             }
           }
           else {
@@ -591,7 +599,7 @@ extern "C" {
       }
 
       if (data->contents.array[i].used == 0) {
-        if (include_empty) {
+        if (include_empty && select == 0) {
           fprintf(f_standard_output, "%c", f_string_eol);
         }
 
@@ -602,8 +610,6 @@ extern "C" {
         if (select < data->contents.array[i].used) {
           f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[i].array[select]);
           fprintf(f_standard_output, "%c", f_string_eol);
-        } else if (include_empty) {
-          fprintf(f_standard_output, "%c", f_string_eol);
         }
       }
       else {