Thus, something like my_function -s 0 -s 1 would be able to process both -s 0 and -s 1.
Previously, only the last -s option would have been processed.
const f_bool has_additional;
const f_u_int type;
f_u_int result;
- f_string_length additional;
+ f_string_lengths additional;
f_string_length length;
} f_console_parameter;
#define f_console_parameter_initialize(symbol_short, symbol_long, symbol_extra, symbol_other, has_additional, type_value, length) \
- { symbol_short, symbol_long, symbol_extra, symbol_other, has_additional, type_value, f_console_result_none, 0, length }
+ { symbol_short, symbol_long, symbol_extra, symbol_other, has_additional, type_value, f_console_result_none, f_string_lengths_initialize, length }
#endif // _di_f_console_parameter_
#ifndef _di_f_console_identify_
f_resize_string_lengths(allocation_status, extra_initiator, extra_initiator.size + f_console_default_allocation_step);
if (f_macro_test_for_allocation_errors(allocation_status)) {
+ f_string_length i = 0;
+
+ while (i < total_parameters) {
+ f_delete_string_lengths(status, parameters[i].additional);
+ i++;
+ } // while
+
f_delete_string_lengths(status, extra_initiator);
return allocation_status;
}
f_resize_string_lengths(allocation_status, extra_initiator, extra_initiator.size + f_console_default_allocation_step);
if (f_macro_test_for_allocation_errors(allocation_status)) {
+ f_string_length i = 0;
+
+ while (i < total_parameters) {
+ f_delete_string_lengths(status, parameters[i].additional);
+ i++;
+ } // while
+
f_delete_string_lengths(status, extra_initiator);
return allocation_status;
}
f_status allocation_status = f_status_initialize;
f_resize_string_lengths(allocation_status, extra_initiator, extra_initiator.size + f_console_default_allocation_step);
+
if (f_macro_test_for_allocation_errors(allocation_status)) {
+ f_string_length i = 0;
+
+ while (i < total_parameters) {
+ f_delete_string_lengths(status, parameters[i].additional);
+ i++;
+ } // while
+
f_delete_string_lengths(status, extra_initiator);
return allocation_status;
}
f_status allocation_status = f_status_initialize;
f_resize_string_lengths(allocation_status, extra_initiator, extra_initiator.size + f_console_default_allocation_step);
+
if (f_macro_test_for_allocation_errors(allocation_status)) {
+ f_string_length i = 0;
+
+ while (i < total_parameters) {
+ f_delete_string_lengths(status, parameters[i].additional);
+ i++;
+ } // while
+
f_delete_string_lengths(status, extra_initiator);
return allocation_status;
}
if (parameters[parameter_counter].type == f_console_type_other) {
if (parameters[parameter_counter].length > 0 && parameters[parameter_counter].symbol_other != 0) {
if (strncmp(argv[location], parameters[parameter_counter].symbol_other, parameters[parameter_counter].length + 1) == 0) {
+ f_status allocation_status = f_status_initialize;
+
+ if (parameters[parameter_counter].additional.used >= parameters[parameter_counter].additional.size) {
+ f_resize_string_lengths(allocation_status, parameters[parameter_counter].additional, parameters[parameter_counter].additional.size + f_console_default_allocation_step);
+ }
+
+ if (f_macro_test_for_allocation_errors(allocation_status)) {
+ f_string_length i = 0;
+
+ while (i < total_parameters) {
+ f_delete_string_lengths(status, parameters[i].additional);
+ i++;
+ } // while
+
+ f_delete_string_lengths(status, extra_initiator);
+ return allocation_status;
+ }
+
parameters[parameter_counter].result = f_console_result_found;
// when "other" is supplied, the extra will be recycled to represent the location of the "other" such that ordering can be determined by the caller
- parameters[parameter_counter].additional = location;
+ parameters[parameter_counter].additional.array[parameters[parameter_counter].additional.used] = location;
+ parameters[parameter_counter].additional.used++;
found = f_true;
break;
if (!found) {
if (extra_initiator.used > 0) {
- parameters[extra_initiator.array[0]].result = f_console_result_additional;
- parameters[extra_initiator.array[0]].additional = location;
+ f_status allocation_status = f_status_initialize;
+
+ if (parameters[extra_initiator.array[0]].additional.used >= parameters[extra_initiator.array[0]].additional.size) {
+ f_resize_string_lengths(allocation_status, parameters[extra_initiator.array[0]].additional, parameters[extra_initiator.array[0]].additional.size + f_console_default_allocation_step);
+ }
+
+ if (f_macro_test_for_allocation_errors(allocation_status)) {
+ f_string_length i = 0;
+
+ while (i < total_parameters) {
+ f_delete_string_lengths(status, parameters[i].additional);
+ i++;
+ } // while
+
+ f_delete_string_lengths(status, extra_initiator);
+ return allocation_status;
+ }
+
+ parameters[extra_initiator.array[0]].result = f_console_result_additional;
+ parameters[extra_initiator.array[0]].additional.array[parameters[extra_initiator.array[0]].additional.used] = location;
+ parameters[extra_initiator.array[0]].additional.used++;
extra_initiator.used--;
f_resize_string_lengths(allocation_status, (*remaining), remaining->size + f_console_default_allocation_step);
if (f_macro_test_for_allocation_errors(allocation_status)) {
+ f_string_length i = 0;
+
+ while (i < total_parameters) {
+ f_delete_string_lengths(status, parameters[i].additional);
+ i++;
+ } // while
+
f_delete_string_lengths(status, extra_initiator);
return allocation_status;
}
if (data->parameters[firewall_parameter_command_stop].result == f_console_result_found) {
if (found_command) {
- if (data->parameters[command].additional > data->parameters[firewall_parameter_command_stop].additional) {
+ if (data->parameters[command].additional.array[0] > data->parameters[firewall_parameter_command_stop].additional.array[0]) {
command = firewall_parameter_command_stop;
}
} else {
if (data->parameters[firewall_parameter_command_restart].result == f_console_result_found) {
if (found_command) {
- if (data->parameters[command].additional > data->parameters[firewall_parameter_command_restart].additional) {
+ if (data->parameters[command].additional.array[0] > data->parameters[firewall_parameter_command_restart].additional.array[0]) {
command = firewall_parameter_command_restart;
}
} else {
if (data->parameters[firewall_parameter_command_lock].result == f_console_result_found) {
if (found_command) {
- if (data->parameters[command].additional > data->parameters[firewall_parameter_command_lock].additional) {
+ if (data->parameters[command].additional.array[0] > data->parameters[firewall_parameter_command_lock].additional.array[0]) {
command = firewall_parameter_command_lock;
}
} else {
if (data->parameters[firewall_parameter_command_show].result == f_console_result_found) {
if (found_command) {
- if (data->parameters[command].additional > data->parameters[firewall_parameter_command_show].additional) {
+ if (data->parameters[command].additional.array[0] > data->parameters[firewall_parameter_command_show].additional.array[0]) {
command = firewall_parameter_command_show;
}
} else {
#ifndef _di_firewall_delete_data_
f_return_status firewall_delete_data(firewall_data *data) {
- f_status status = f_status_initialize;
+ f_status status = f_status_initialize;
+ f_string_length i = 0;
+
+ while (i < firewall_total_parameters) {
+ f_delete_string_lengths(status, data->parameters[i].additional);
+ i++;
+ } // while
f_delete_fss_contents(status, data->contents);
f_delete_fss_objects(status, data->objects);
f_string_length original_size = data->file_position.total_elements;
if (data->parameters[fss_basic_list_read_parameter_count].result == f_console_result_additional) {
- target = (f_string_length) atoll(argv[data->parameters[fss_basic_list_read_parameter_count].additional]);
+ target = (f_string_length) atoll(argv[data->parameters[fss_basic_list_read_parameter_count].additional.array[0]]);
}
if (data->process_pipe) {
if (data->contents.array[current].used > 0) {
f_string_length counter = data->contents.array[current].array[0].start;
f_string_length position = 0;
- f_string_length target = (f_string_length) atoll(argv[data->parameters[fss_basic_list_read_parameter_line].additional]);
+ f_string_length target = (f_string_length) atoll(argv[data->parameters[fss_basic_list_read_parameter_line].additional.array[0]]);
f_string_location range = f_string_location_initialize;
// use an invalid range to communicate range not found
f_string_length argv_length = f_string_length_initialize;
if (data->parameters[fss_basic_list_read_parameter_name].result == f_console_result_additional) {
- argv_length = strlen(argv[data->parameters[fss_basic_list_read_parameter_name].additional]);
+ argv_length = strlen(argv[data->parameters[fss_basic_list_read_parameter_name].additional.array[0]]);
if (data->parameters[fss_basic_list_read_parameter_object].result == f_console_result_none) {
for (; current < data->objects.used; current++) {
name_length = data->objects.array[current].stop - data->objects.array[current].start + 1;
if (name_length == argv_length) {
- if (fl_compare_strings(data->buffer.string + data->objects.array[current].start, argv[data->parameters[fss_basic_list_read_parameter_name].additional], name_length, argv_length) == f_equal_to) {
+ if (fl_compare_strings(data->buffer.string + data->objects.array[current].start, argv[data->parameters[fss_basic_list_read_parameter_name].additional.array[0]], name_length, argv_length) == f_equal_to) {
if (data->parameters[fss_basic_list_read_parameter_size].result == f_console_result_found) {
if (data->contents.array[current].used > 0) {
if (data->contents.array[current].used > 0) {
f_string_length counter = data->contents.array[current].array[0].start;
f_string_length position = 0;
- f_string_length target = (f_string_length) atoll(argv[data->parameters[fss_basic_list_read_parameter_line].additional]);
+ f_string_length target = (f_string_length) atoll(argv[data->parameters[fss_basic_list_read_parameter_line].additional.array[0]]);
f_string_location range = f_string_location_initialize;
// use an invalid range to communicate range not found
name_length = data->contents.array[current].array[0].stop - data->contents.array[current].array[0].start + 1;
if (name_length == argv_length) {
- if (fl_compare_strings(data->buffer.string + data->contents.array[current].array[0].start, argv[data->parameters[fss_basic_list_read_parameter_name].additional], name_length, argv_length) == f_equal_to) {
+ if (fl_compare_strings(data->buffer.string + data->contents.array[current].array[0].start, argv[data->parameters[fss_basic_list_read_parameter_name].additional.array[0]], name_length, argv_length) == f_equal_to) {
if (data->parameters[fss_basic_list_read_parameter_count].result == f_console_result_none || (data->parameters[fss_basic_list_read_parameter_count].result == f_console_result_additional && found == target)) {
f_print_partial_dynamic_string(f_standard_output, data->buffer, data->objects.array[current]);
fprintf(f_standard_output, "\n");
#ifndef _di_fss_basic_list_read_delete_data_
f_return_status fss_basic_list_read_delete_data(fss_basic_list_read_data *data) {
- f_status status = f_status_initialize;
+ f_status status = f_status_initialize;
+ f_string_length i = 0;
+
+ while (i < fss_basic_list_read_total_parameters) {
+ f_delete_string_lengths(status, data->parameters[i].additional);
+ i++;
+ } // while
f_delete_fss_contents(status, data->contents);
f_delete_fss_objects(status, data->objects);
f_string_length original_size = data->file_position.total_elements;
if (data->parameters[fss_basic_read_parameter_count].result == f_console_result_additional) {
- target = (f_string_length) atoll(argv[data->parameters[fss_basic_read_parameter_count].additional]);
+ target = (f_string_length) atoll(argv[data->parameters[fss_basic_read_parameter_count].additional.array[0]]);
}
if (data->process_pipe) {
f_string_length argv_length = f_string_length_initialize;
if (data->parameters[fss_basic_read_parameter_name].result == f_console_result_additional) {
- argv_length = strlen(argv[data->parameters[fss_basic_read_parameter_name].additional]);
+ argv_length = strlen(argv[data->parameters[fss_basic_read_parameter_name].additional.array[0]]);
if (data->parameters[fss_basic_read_parameter_object].result == f_console_result_none) {
for (; current < data->objects.used; current++) {
name_length = data->objects.array[current].stop - data->objects.array[current].start + 1;
if (name_length == argv_length) {
- if (fl_compare_strings(data->buffer.string + data->objects.array[current].start, argv[data->parameters[fss_basic_read_parameter_name].additional], name_length, argv_length) == f_equal_to) {
+ if (fl_compare_strings(data->buffer.string + data->objects.array[current].start, argv[data->parameters[fss_basic_read_parameter_name].additional.array[0]], name_length, argv_length) == f_equal_to) {
if (data->parameters[fss_basic_read_parameter_count].result == f_console_result_none || (data->parameters[fss_basic_read_parameter_count].result == f_console_result_additional && found == target)) {
if (data->parameters[fss_basic_read_parameter_total].result == f_console_result_found) {
name_length = data->contents.array[current].array[0].stop - data->contents.array[current].array[0].start + 1;
if (name_length == argv_length) {
- if (fl_compare_strings(data->buffer.string + data->contents.array[current].array[0].start, argv[data->parameters[fss_basic_read_parameter_name].additional], name_length, argv_length) == f_equal_to) {
+ if (fl_compare_strings(data->buffer.string + data->contents.array[current].array[0].start, argv[data->parameters[fss_basic_read_parameter_name].additional.array[0]], name_length, argv_length) == f_equal_to) {
if (data->parameters[fss_basic_read_parameter_count].result == f_console_result_none || (data->parameters[fss_basic_read_parameter_count].result == f_console_result_additional && found == target)) {
f_print_partial_dynamic_string(f_standard_output, data->buffer, data->objects.array[current]);
fprintf(f_standard_output, "\n");
#ifndef _di_fss_basic_read_delete_data_
f_return_status fss_basic_read_delete_data(fss_basic_read_data *data) {
- f_status status = f_status_initialize;
+ f_status status = f_status_initialize;
+ f_string_length i = 0;
+
+ while (i < fss_basic_read_total_parameters) {
+ f_delete_string_lengths(status, data->parameters[i].additional);
+ i++;
+ } // while
f_delete_fss_contents(status, data->contents);
f_delete_fss_objects(status, data->objects);
f_string_length original_size = data->file_position.total_elements;
if (data->parameters[fss_extended_read_parameter_count].result == f_console_result_additional) {
- target = (f_string_length) atoll(argv[data->parameters[fss_extended_read_parameter_count].additional]);
+ target = (f_string_length) atoll(argv[data->parameters[fss_extended_read_parameter_count].additional.array[0]]);
}
if (data->parameters[fss_extended_read_parameter_select].result == f_console_result_additional) {
- select = (f_string_length) atoll(argv[data->parameters[fss_extended_read_parameter_select].additional]);
+ select = (f_string_length) atoll(argv[data->parameters[fss_extended_read_parameter_select].additional.array[0]]);
}
if (data->process_pipe) {
f_string_length argv_length = f_string_length_initialize;
if (data->parameters[fss_extended_read_parameter_name].result == f_console_result_additional) {
- argv_length = strlen(argv[data->parameters[fss_extended_read_parameter_name].additional]);
+ argv_length = strlen(argv[data->parameters[fss_extended_read_parameter_name].additional.array[0]]);
if (data->parameters[fss_extended_read_parameter_object].result == f_console_result_none) {
for (; current < data->objects.used; current++) {
name_length = data->objects.array[current].stop - data->objects.array[current].start + 1;
if (name_length == argv_length) {
- if (fl_compare_strings(data->buffer.string + data->objects.array[current].start, argv[data->parameters[fss_extended_read_parameter_name].additional], name_length, argv_length) == f_equal_to) {
+ if (fl_compare_strings(data->buffer.string + data->objects.array[current].start, argv[data->parameters[fss_extended_read_parameter_name].additional.array[0]], name_length, argv_length) == f_equal_to) {
if (data->parameters[fss_extended_read_parameter_count].result == f_console_result_none || (data->parameters[fss_extended_read_parameter_count].result == f_console_result_additional && found == target)) {
if (data->parameters[fss_extended_read_parameter_total].result == f_console_result_found) {
name_length = data->contents.array[current].array[select].stop - data->contents.array[current].array[select].start + 1;
if (name_length == argv_length) {
- if (fl_compare_strings(data->buffer.string + data->contents.array[current].array[select].start, argv[data->parameters[fss_extended_read_parameter_name].additional], name_length, argv_length) == f_equal_to) {
+ if (fl_compare_strings(data->buffer.string + data->contents.array[current].array[select].start, argv[data->parameters[fss_extended_read_parameter_name].additional.array[0]], name_length, argv_length) == f_equal_to) {
if (data->parameters[fss_extended_read_parameter_count].result == f_console_result_none || (data->parameters[fss_extended_read_parameter_count].result == f_console_result_additional && found == target)) {
f_print_partial_dynamic_string(f_standard_output, data->buffer, data->objects.array[current]);
fprintf(f_standard_output, "\n");
#ifndef _di_fss_extended_read_delete_data_
f_return_status fss_extended_read_delete_data(fss_extended_read_data *data) {
- f_status status = f_status_initialize;
+ f_status status = f_status_initialize;
+ f_string_length i = 0;
+
+ while (i < fss_extended_read_total_parameters) {
+ f_delete_string_lengths(status, data->parameters[i].additional);
+ i++;
+ } // while
f_delete_fss_contents(status, data->contents);
f_delete_fss_objects(status, data->objects);
#ifndef _di_fss_return_code_delete_data_
f_return_status fss_return_code_delete_data(fss_return_code_data *data) {
- f_status status = f_status_initialize;
+ f_status status = f_status_initialize;
+ f_string_length i = 0;
+
+ while (i < fss_return_code_total_parameters) {
+ f_delete_string_lengths(status, data->parameters[i].additional);
+ i++;
+ } // while
f_delete_string_lengths(status, data->remaining);
fll_delete_color_context(status, data->context);
#ifndef _di_return_code_delete_data_
f_return_status return_code_delete_data(return_code_data *data) {
- f_status status = f_status_initialize;
+ f_status status = f_status_initialize;
+ f_string_length i = 0;
+
+ while (i < return_code_total_parameters) {
+ f_delete_string_lengths(status, data->parameters[i].additional);
+ i++;
+ } // while
f_delete_string_lengths(status, data->remaining);
fll_delete_color_context(status, data->context);