This logic is already done with --line and other parameters.
Doing this same thing with --name and --at makes the code/logic more consistent and reasonable.
printf("%c", f_string_eol);
+ printf(" When both ");
+ fl_color_print(f_standard_output, data.context.notable, data.context.reset, "--%s", fss_basic_list_read_long_at);
+ printf(" and ");
+ fl_color_print(f_standard_output, data.context.notable, data.context.reset, "--%s", fss_basic_list_read_long_name);
+ printf(" parameters are specified (at the same depth), the ");
+ fl_color_print(f_standard_output, data.context.notable, data.context.reset, "--%s", fss_basic_list_read_long_at);
+ printf(" parameter value will be treated as a position relative to the specified ");
+ fl_color_print(f_standard_output, data.context.notable, data.context.reset, "--%s", fss_basic_list_read_long_name);
+ printf(" parameter value.%c", f_string_eol);
+
+ printf("%c", f_string_eol);
+
printf(" This program may support parameters, such as ");
fl_color_print(f_standard_output, data.context.notable, data.context.reset, "--%s", fss_basic_list_read_long_depth);
printf(" or ");
}
if (depths.array[0].index_at > 0) {
- if (depths.array[0].value_at < data->objects.used && names[depths.array[0].value_at]) {
- f_print_string_dynamic_partial(f_standard_output, data->buffer, data->objects.array[depths.array[0].value_at]);
- fprintf(f_standard_output, "%c", f_string_eol);
- }
+ f_array_length at = 0;
+ f_array_length i = 0;
+
+ for (; i < data->objects.used; i++) {
+ if (names[i]) {
+ if (at == depths.array[0].value_at) {
+ f_print_string_dynamic_partial(f_standard_output, data->buffer, data->objects.array[i]);
+ fprintf(f_standard_output, "%c", f_string_eol);
+ break;
+ }
+
+ at++;
+ }
+ } // for
return f_none;
}
}
if (depths.array[0].index_at > 0) {
- if (names[depths.array[0].value_at]) {
- if (depths.array[0].value_at >= data->objects.used) {
- if (data->parameters[fss_basic_list_read_parameter_total].result == f_console_result_found) {
- fprintf(f_standard_output, "0%c", f_string_eol);
- }
-
- return f_none;
+ if (depths.array[0].value_at >= data->objects.used) {
+ if (names[depths.array[0].value_at] && data->parameters[fss_basic_list_read_parameter_total].result == f_console_result_found) {
+ fprintf(f_standard_output, "0%c", f_string_eol);
}
- else if (data->parameters[fss_basic_list_read_parameter_total].result == f_console_result_found) {
- if (data->contents.array[depths.array[0].value_at].used == 0) {
- fprintf(f_standard_output, "0%c", f_string_eol);
- }
- else {
- fprintf(f_standard_output, "1%c", f_string_eol);
- }
- return f_none;
- }
+ return f_none;
+ }
- if (data->parameters[fss_basic_list_read_parameter_line].result == f_console_result_additional) {
- if (data->contents.array[depths.array[0].value_at].used == 0) {
- if (include_empty && line == 0) {
- fprintf(f_standard_output, "%c", f_string_eol);
+ f_array_length at = 0;
+ f_array_length i = 0;
+
+ for (; i < data->objects.used; i++) {
+ if (names[i]) {
+ if (at == depths.array[0].value_at) {
+ if (data->parameters[fss_basic_list_read_parameter_total].result == f_console_result_found) {
+ if (data->contents.array[i].used == 0) {
+ fprintf(f_standard_output, "0%c", f_string_eol);
+ }
+ else {
+ f_string_length total = 1;
+
+ for (f_string_length j = data->contents.array[i].array[0].start; j <= data->contents.array[i].array[0].stop; j++) {
+ if (data->buffer.string[j] == f_string_eos) continue;
+
+ if (data->buffer.string[j] == f_string_eol) {
+ total++;
+ }
+ } // for
+
+ fprintf(f_standard_output, "%llu%c", total, f_string_eol);
+ }
+
+ return f_none;
}
- }
- else {
- f_string_length i = data->contents.array[depths.array[0].value_at].array[0].start;
- if (line == 0) {
- for (; i <= data->contents.array[depths.array[0].value_at].array[0].stop; i++) {
- if (data->buffer.string[i] == f_string_eos) continue;
- if (data->buffer.string[i] == f_string_eol) {
+ if (data->parameters[fss_basic_list_read_parameter_line].result == f_console_result_additional) {
+ if (data->contents.array[i].used == 0) {
+ if (include_empty && line == 0) {
fprintf(f_standard_output, "%c", f_string_eol);
- break;
}
+ }
+ else {
+ f_string_length i = data->contents.array[i].array[0].start;
+
+ if (line == 0) {
+ for (; i <= data->contents.array[i].array[0].stop; i++) {
+ if (data->buffer.string[i] == f_string_eos) continue;
+ if (data->buffer.string[i] == f_string_eol) {
+ fprintf(f_standard_output, "%c", f_string_eol);
+ break;
+ }
+
+ fprintf(f_standard_output, "%c", data->buffer.string[i]);
+ } // for
+ }
+ else {
+ f_string_length line_current = 0;
- fprintf(f_standard_output, "%c", data->buffer.string[i]);
- } // for
- }
- else {
- f_string_length line_current = 0;
+ for (; i <= data->contents.array[i].array[0].stop; i++) {
+ if (data->buffer.string[i] == f_string_eos) continue;
+
+ if (data->buffer.string[i] == f_string_eol) {
+ line_current++;
- for (; i <= data->contents.array[depths.array[0].value_at].array[0].stop; i++) {
- if (data->buffer.string[i] == f_string_eos) continue;
+ if (line_current == line) {
+ i++;
- if (data->buffer.string[i] == f_string_eol) {
- line_current++;
+ for (; i <= data->contents.array[i].array[0].stop; i++) {
+ if (data->buffer.string[i] == f_string_eos) continue;
+ if (data->buffer.string[i] == f_string_eol) {
+ fprintf(f_standard_output, "%c", f_string_eol);
+ break;
+ }
- if (line_current == line) {
- i++;
+ fprintf(f_standard_output, "%c", data->buffer.string[i]);
+ } // for
- for (; i <= data->contents.array[depths.array[0].value_at].array[0].stop; i++) {
- if (data->buffer.string[i] == f_string_eos) continue;
- if (data->buffer.string[i] == f_string_eol) {
- fprintf(f_standard_output, "%c", f_string_eol);
break;
}
+ }
+ } // for
+ }
+ }
- fprintf(f_standard_output, "%c", data->buffer.string[i]);
- } // for
+ return f_none;
+ }
- break;
- }
- }
- } // for
+ if (data->contents.array[i].used > 0) {
+ f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[i].array[0]);
+ }
+ else if (include_empty) {
+ fprintf(f_standard_output, "%c", f_string_eol);
}
- }
- return f_none;
- }
+ break;
+ }
- if (data->contents.array[depths.array[0].value_at].used > 0) {
- f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[depths.array[0].value_at].array[0]);
+ at++;
}
- else if (include_empty) {
- fprintf(f_standard_output, "%c", f_string_eol);
- }
- }
+ } // for
return f_none;
}
f_string_length total = 0;
for (f_string_length i = 0; i < data->objects.used; i++) {
- if (!names[i]) {
- continue;
- }
+ if (!names[i]) continue;
+
+ if (data->contents.array[i].used == 0) {
+ if (include_empty) {
+ total++;
+ }
- if (data->contents.array[i].used == 0 && !include_empty) {
continue;
}
- total++;
+ for (f_string_length j = data->contents.array[i].array[0].start; j <= data->contents.array[i].array[0].stop; j++) {
+ if (data->buffer.string[j] == f_string_eos) continue;
+
+ if (data->buffer.string[j] == f_string_eol) {
+ total++;
+ }
+ } // for
} // for
fprintf(f_standard_output, "%llu%c", total, f_string_eol);
printf("%c", f_string_eol);
+ printf(" When both ");
+ fl_color_print(f_standard_output, data.context.notable, data.context.reset, "--%s", fss_basic_read_long_at);
+ printf(" and ");
+ fl_color_print(f_standard_output, data.context.notable, data.context.reset, "--%s", fss_basic_read_long_name);
+ printf(" parameters are specified (at the same depth), the ");
+ fl_color_print(f_standard_output, data.context.notable, data.context.reset, "--%s", fss_basic_read_long_at);
+ printf(" parameter value will be treated as a position relative to the specified ");
+ fl_color_print(f_standard_output, data.context.notable, data.context.reset, "--%s", fss_basic_read_long_name);
+ printf(" parameter value.%c", f_string_eol);
+
+ printf("%c", f_string_eol);
+
printf(" This program may support parameters, such as ");
fl_color_print(f_standard_output, data.context.notable, data.context.reset, "--%s", fss_basic_read_long_depth);
printf(" or ");
}
if (depths.array[0].index_at > 0) {
- if (depths.array[0].value_at < data->objects.used && names[depths.array[0].value_at]) {
- f_print_string_dynamic_partial(f_standard_output, data->buffer, data->objects.array[depths.array[0].value_at]);
- fprintf(f_standard_output, "%c", f_string_eol);
- }
+ f_array_length at = 0;
+ f_array_length i = 0;
+
+ for (; i < data->objects.used; i++) {
+ if (names[i]) {
+ if (at == depths.array[0].value_at) {
+ f_print_string_dynamic_partial(f_standard_output, data->buffer, data->objects.array[i]);
+ fprintf(f_standard_output, "%c", f_string_eol);
+ break;
+ }
+
+ at++;
+ }
+ } // for
return f_none;
}
- for (f_string_length i = 0; i < data->objects.used; i++) {
+ for (f_array_length i = 0; i < data->objects.used; i++) {
if (names[i] == 0) continue;
f_print_string_dynamic_partial(f_standard_output, data->buffer, data->objects.array[i]);
}
if (depths.array[0].index_at > 0) {
- if (names[depths.array[0].value_at]) {
- if (depths.array[0].value_at >= data->objects.used) {
- if (data->parameters[fss_basic_read_parameter_total].result == f_console_result_found) {
- fprintf(f_standard_output, "0%c", f_string_eol);
- }
-
- return f_none;
+ if (depths.array[0].value_at >= data->objects.used) {
+ if (names[depths.array[0].value_at] && data->parameters[fss_basic_read_parameter_total].result == f_console_result_found) {
+ fprintf(f_standard_output, "0%c", f_string_eol);
}
- else if (data->parameters[fss_basic_read_parameter_total].result == f_console_result_found) {
- if (data->contents.array[depths.array[0].value_at].used == 0) {
- fprintf(f_standard_output, "0%c", f_string_eol);
- }
- else {
- fprintf(f_standard_output, "1%c", f_string_eol);
- }
+ return f_none;
+ }
+
+ if (data->parameters[fss_basic_read_parameter_line].result == f_console_result_additional) {
+ if (line > 0) {
return f_none;
}
+ }
- if (data->parameters[fss_basic_read_parameter_line].result == f_console_result_additional) {
- if (line == 0) {
- if (data->contents.array[depths.array[0].value_at].used > 0) {
- f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[depths.array[0].value_at].array[0]);
- fprintf(f_standard_output, "%c", f_string_eol);
+ f_array_length at = 0;
+ f_array_length i = 0;
+
+ for (; i < data->objects.used; i++) {
+ if (names[i]) {
+ if (at == depths.array[0].value_at) {
+ if (data->parameters[fss_basic_read_parameter_total].result == f_console_result_found) {
+ if (data->contents.array[i].used == 0) {
+ fprintf(f_standard_output, "0%c", f_string_eol);
+ }
+ else {
+ fprintf(f_standard_output, "1%c", f_string_eol);
+ }
}
- else if (include_empty) {
- fprintf(f_standard_output, "%c", f_string_eol);
+ else if (data->parameters[fss_basic_read_parameter_line].result == f_console_result_additional) {
+ if (data->contents.array[i].used > 0) {
+ f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[i].array[0]);
+ fprintf(f_standard_output, "%c", f_string_eol);
+ }
+ else if (include_empty) {
+ fprintf(f_standard_output, "%c", f_string_eol);
+ }
+ }
+ else {
+ if (data->contents.array[i].used > 0) {
+ f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[i].array[0]);
+ fprintf(f_standard_output, "%c", f_string_eol);
+ }
+ else if (include_empty) {
+ fprintf(f_standard_output, "%c", f_string_eol);
+ }
}
- }
- return f_none;
- }
+ break;
+ }
- if (data->contents.array[depths.array[0].value_at].used > 0) {
- f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[depths.array[0].value_at].array[0]);
- fprintf(f_standard_output, "%c", f_string_eol);
+ at++;
}
- else if (include_empty) {
- fprintf(f_standard_output, "%c", f_string_eol);
- }
- }
+ } // for
return f_none;
}
printf("%c", f_string_eol);
+ printf(" When both ");
+ fl_color_print(f_standard_output, data.context.notable, data.context.reset, "--%s", fss_extended_read_long_at);
+ printf(" and ");
+ fl_color_print(f_standard_output, data.context.notable, data.context.reset, "--%s", fss_extended_read_long_name);
+ printf(" parameters are specified (at the same depth), the ");
+ fl_color_print(f_standard_output, data.context.notable, data.context.reset, "--%s", fss_extended_read_long_at);
+ printf(" parameter value will be treated as a position relative to the specified ");
+ fl_color_print(f_standard_output, data.context.notable, data.context.reset, "--%s", fss_extended_read_long_name);
+ printf(" parameter value.%c", f_string_eol);
+
+ printf("%c", f_string_eol);
+
printf(" This program may support parameters, such as ");
fl_color_print(f_standard_output, data.context.notable, data.context.reset, "--%s", fss_extended_read_long_depth);
printf(" or ");
}
if (depths.array[0].index_at > 0) {
- if (depths.array[0].value_at < data->objects.used && names[depths.array[0].value_at]) {
- f_print_string_dynamic_partial(f_standard_output, data->buffer, data->objects.array[depths.array[0].value_at]);
- fprintf(f_standard_output, "%c", f_string_eol);
- }
+ f_array_length at = 0;
+ f_array_length i = 0;
+
+ for (; i < data->objects.used; i++) {
+ if (names[i]) {
+ if (at == depths.array[0].value_at) {
+ f_print_string_dynamic_partial(f_standard_output, data->buffer, data->objects.array[i]);
+ fprintf(f_standard_output, "%c", f_string_eol);
+ break;
+ }
+
+ at++;
+ }
+ } // for
return f_none;
}
}
if (depths.array[0].index_at > 0) {
- if (names[depths.array[0].value_at]) {
- if (depths.array[0].value_at >= data->objects.used) {
- if (data->parameters[fss_extended_read_parameter_total].result == f_console_result_found) {
- fprintf(f_standard_output, "0%c", f_string_eol);
- }
-
- return f_none;
+ if (depths.array[0].value_at >= data->objects.used) {
+ if (names[depths.array[0].value_at] && data->parameters[fss_extended_read_parameter_total].result == f_console_result_found) {
+ fprintf(f_standard_output, "0%c", f_string_eol);
}
- else if (data->parameters[fss_extended_read_parameter_total].result == f_console_result_found) {
- if (data->contents.array[depths.array[0].value_at].used == 0) {
- fprintf(f_standard_output, "0%c", f_string_eol);
- }
- else {
- fprintf(f_standard_output, "1%c", f_string_eol);
- }
- return f_none;
- }
+ return f_none;
+ }
+
+ f_array_length at = 0;
+ f_array_length i = 0;
+
+ for (; i < data->objects.used; i++) {
+ if (names[i]) {
+ if (at == depths.array[0].value_at) {
+ if (data->parameters[fss_extended_read_parameter_total].result == f_console_result_found) {
+ if (data->contents.array[i].used == 0) {
+ fprintf(f_standard_output, "0%c", f_string_eol);
+ }
+ else {
+ fprintf(f_standard_output, "1%c", f_string_eol);
+ }
+
+ return f_none;
+ }
+
+ if (data->parameters[fss_extended_read_parameter_line].result == f_console_result_additional) {
+ if (line == 0) {
+ if (data->contents.array[i].used > 0) {
+ f_string_length j = 0;
+
+ if (data->parameters[fss_extended_read_parameter_select].result == f_console_result_additional) {
+ 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 {
+ for (j = 0; j < data->contents.array[i].used; j++) {
+ f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[i].array[j]);
+
+ if (j + 1 < data->contents.array[i].used) {
+ printf(" ");
+ }
+ } // for
- if (data->parameters[fss_extended_read_parameter_line].result == f_console_result_additional) {
- if (line == 0) {
- if (data->contents.array[depths.array[0].value_at].used > 0) {
+ fprintf(f_standard_output, "%c", f_string_eol);
+ }
+ }
+ else if (include_empty) {
+ fprintf(f_standard_output, "%c", f_string_eol);
+ }
+ }
+
+ return f_none;
+ }
+
+ if (data->contents.array[i].used > 0) {
f_string_length j = 0;
if (data->parameters[fss_extended_read_parameter_select].result == f_console_result_additional) {
- if (select < data->contents.array[depths.array[0].value_at].used) {
- f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[depths.array[0].value_at].array[select]);
+ 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 {
- for (j = 0; j < data->contents.array[depths.array[0].value_at].used; j++) {
- f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[depths.array[0].value_at].array[j]);
+ for (j = 0; j < data->contents.array[i].used; j++) {
+ f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[i].array[j]);
- if (j + 1 < data->contents.array[depths.array[0].value_at].used) {
+ if (j + 1 < data->contents.array[i].used) {
printf(" ");
}
} // for
else if (include_empty) {
fprintf(f_standard_output, "%c", f_string_eol);
}
- }
-
- return f_none;
- }
-
- if (data->contents.array[depths.array[0].value_at].used > 0) {
- f_string_length j = 0;
- if (data->parameters[fss_extended_read_parameter_select].result == f_console_result_additional) {
- if (select < data->contents.array[depths.array[0].value_at].used) {
- f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[depths.array[0].value_at].array[select]);
- fprintf(f_standard_output, "%c", f_string_eol);
- } else if (include_empty) {
- fprintf(f_standard_output, "%c", f_string_eol);
- }
+ break;
}
- else {
- for (j = 0; j < data->contents.array[depths.array[0].value_at].used; j++) {
- f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[depths.array[0].value_at].array[j]);
-
- if (j + 1 < data->contents.array[depths.array[0].value_at].used) {
- printf(" ");
- }
- } // for
- fprintf(f_standard_output, "%c", f_string_eol);
- }
+ at++;
}
- else if (include_empty) {
- fprintf(f_standard_output, "%c", f_string_eol);
- }
- }
+ } // for
return f_none;
}