Relocate help and version flag assignment checks across programs.
Setup individual help printing for each supported "--as" parameter in fss_write.
return;
}
}
-
- if (main->parameters.array[byte_dump_parameter_help_e].result & f_console_result_found_e) {
- setting->flag |= byte_dump_main_flag_help_e;
-
- return;
- }
-
- if (main->parameters.array[byte_dump_parameter_version_e].result & f_console_result_found_e) {
- setting->flag |= byte_dump_main_flag_version_e;
-
- return;
- }
}
main->output.to.id = F_type_descriptor_output_d;
main->output.to.stream = F_type_output_d;
main->output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d;
+ if (main->parameters.array[byte_dump_parameter_help_e].result & f_console_result_found_e) {
+ setting->flag |= byte_dump_main_flag_help_e;
+
+ return;
+ }
+
+ if (main->parameters.array[byte_dump_parameter_version_e].result & f_console_result_found_e) {
+ setting->flag |= byte_dump_main_flag_version_e;
+
+ return;
+ }
+
f_string_static_t * const args = main->parameters.arguments.array;
if (main->parameters.array[byte_dump_parameter_strip_invalid_e].result & f_console_result_found_e) {
return;
}
}
-
- if (main->parameters.array[control_parameter_help_e].result & f_console_result_found_e) {
- setting->flag |= control_main_flag_help_e;
-
- return;
- }
-
- if (main->parameters.array[control_parameter_version_e].result & f_console_result_found_e) {
- setting->flag |= control_main_flag_version_e;
-
- return;
- }
}
main->output.to.id = F_type_descriptor_output_d;
main->output.to.stream = F_type_output_d;
main->output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d;
+ if (main->parameters.array[control_parameter_help_e].result & f_console_result_found_e) {
+ setting->flag |= control_main_flag_help_e;
+
+ return;
+ }
+
+ if (main->parameters.array[control_parameter_version_e].result & f_console_result_found_e) {
+ setting->flag |= control_main_flag_version_e;
+
+ return;
+ }
+
f_string_static_t * const args = main->parameters.arguments.array;
if (main->parameters.array[control_parameter_strip_invalid_e].result & f_console_result_found_e) {
return;
}
}
-
- if (main->parameters.array[controller_parameter_help_e].result & f_console_result_found_e) {
- setting->flag |= controller_main_flag_help_e;
-
- return;
- }
-
- if (main->parameters.array[controller_parameter_version_e].result & f_console_result_found_e) {
- setting->flag |= controller_main_flag_version_e;
-
- return;
- }
}
main->output.to.id = F_type_descriptor_output_d;
main->output.to.stream = F_type_output_d;
main->output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d;
+ if (main->parameters.array[controller_parameter_help_e].result & f_console_result_found_e) {
+ setting->flag |= controller_main_flag_help_e;
+
+ return;
+ }
+
+ if (main->parameters.array[controller_parameter_version_e].result & f_console_result_found_e) {
+ setting->flag |= controller_main_flag_version_e;
+
+ return;
+ }
+
f_string_static_t * const args = main->parameters.arguments.array;
if (main->parameters.array[controller_parameter_strip_invalid_e].result & f_console_result_found_e) {
return;
}
}
-
- if (main->parameters.array[fake_parameter_help_e].result & f_console_result_found_e) {
- setting->flag |= fake_main_flag_help_e;
-
- return;
- }
-
- if (main->parameters.array[fake_parameter_version_e].result & f_console_result_found_e) {
- setting->flag |= fake_main_flag_version_e;
-
- return;
- }
}
main->output.to.id = F_type_descriptor_output_d;
main->output.to.stream = F_type_output_d;
main->output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d;
+ if (main->parameters.array[fake_parameter_help_e].result & f_console_result_found_e) {
+ setting->flag |= fake_main_flag_help_e;
+
+ return;
+ }
+
+ if (main->parameters.array[fake_parameter_version_e].result & f_console_result_found_e) {
+ setting->flag |= fake_main_flag_version_e;
+
+ return;
+ }
+
f_string_static_t * const args = main->parameters.arguments.array;
if (main->parameters.array[fake_parameter_strip_invalid_e].result & f_console_result_found_e) {
return;
}
}
-
- if (main->parameters.array[firewall_parameter_help_e].result & f_console_result_found_e) {
- setting->flag |= firewall_main_flag_help_e;
-
- return;
- }
-
- if (main->parameters.array[firewall_parameter_version_e].result & f_console_result_found_e) {
- setting->flag |= firewall_main_flag_version_e;
-
- return;
- }
}
main->output.to.id = F_type_descriptor_output_d;
main->output.to.stream = F_type_output_d;
main->output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d;
+ if (main->parameters.array[firewall_parameter_help_e].result & f_console_result_found_e) {
+ setting->flag |= firewall_main_flag_help_e;
+
+ return;
+ }
+
+ if (main->parameters.array[firewall_parameter_version_e].result & f_console_result_found_e) {
+ setting->flag |= firewall_main_flag_version_e;
+
+ return;
+ }
+
f_string_static_t * const args = main->parameters.arguments.array;
if (main->parameters.array[firewall_parameter_strip_invalid_e].result & f_console_result_found_e) {
return;
}
}
-
- if (main->parameters.array[fss_basic_list_read_parameter_help_e].result & f_console_result_found_e) {
- setting->flag |= fss_basic_list_read_main_flag_help_e;
-
- return;
- }
-
- if (main->parameters.array[fss_basic_list_read_parameter_version_e].result & f_console_result_found_e) {
- setting->flag |= fss_basic_list_read_main_flag_version_e;
-
- return;
- }
}
main->output.to.id = F_type_descriptor_output_d;
main->output.to.stream = F_type_output_d;
main->output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d;
+ if (main->parameters.array[fss_basic_list_read_parameter_help_e].result & f_console_result_found_e) {
+ setting->flag |= fss_basic_list_read_main_flag_help_e;
+
+ return;
+ }
+
+ if (main->parameters.array[fss_basic_list_read_parameter_version_e].result & f_console_result_found_e) {
+ setting->flag |= fss_basic_list_read_main_flag_version_e;
+
+ return;
+ }
+
f_string_static_t * const args = main->parameters.arguments.array;
if (main->parameters.array[fss_basic_list_read_parameter_strip_invalid_e].result & f_console_result_found_e) {
return;
}
}
-
- if (main->parameters.array[fss_basic_list_write_parameter_help_e].result & f_console_result_found_e) {
- setting->flag |= fss_basic_list_write_main_flag_help_e;
-
- return;
- }
-
- if (main->parameters.array[fss_basic_list_write_parameter_version_e].result & f_console_result_found_e) {
- setting->flag |= fss_basic_list_write_main_flag_version_e;
-
- return;
- }
}
main->output.to.id = F_type_descriptor_output_d;
main->output.to.stream = F_type_output_d;
main->output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d;
+ if (main->parameters.array[fss_basic_list_write_parameter_help_e].result & f_console_result_found_e) {
+ setting->flag |= fss_basic_list_write_main_flag_help_e;
+
+ return;
+ }
+
+ if (main->parameters.array[fss_basic_list_write_parameter_version_e].result & f_console_result_found_e) {
+ setting->flag |= fss_basic_list_write_main_flag_version_e;
+
+ return;
+ }
+
f_string_static_t * const args = main->parameters.arguments.array;
if (main->parameters.array[fss_basic_list_write_parameter_strip_invalid_e].result & f_console_result_found_e) {
return;
}
}
-
- if (main->parameters.array[fss_basic_read_parameter_help_e].result & f_console_result_found_e) {
- setting->flag |= fss_basic_read_main_flag_help_e;
-
- return;
- }
-
- if (main->parameters.array[fss_basic_read_parameter_version_e].result & f_console_result_found_e) {
- setting->flag |= fss_basic_read_main_flag_version_e;
-
- return;
- }
}
main->output.to.id = F_type_descriptor_output_d;
main->output.to.stream = F_type_output_d;
main->output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d;
+ if (main->parameters.array[fss_basic_read_parameter_help_e].result & f_console_result_found_e) {
+ setting->flag |= fss_basic_read_main_flag_help_e;
+
+ return;
+ }
+
+ if (main->parameters.array[fss_basic_read_parameter_version_e].result & f_console_result_found_e) {
+ setting->flag |= fss_basic_read_main_flag_version_e;
+
+ return;
+ }
+
f_string_static_t * const args = main->parameters.arguments.array;
if (main->parameters.array[fss_basic_read_parameter_strip_invalid_e].result & f_console_result_found_e) {
return;
}
}
-
- if (main->parameters.array[fss_basic_write_parameter_help_e].result & f_console_result_found_e) {
- setting->flag |= fss_basic_write_main_flag_help_e;
-
- return;
- }
-
- if (main->parameters.array[fss_basic_write_parameter_version_e].result & f_console_result_found_e) {
- setting->flag |= fss_basic_write_main_flag_version_e;
-
- return;
- }
}
main->output.to.id = F_type_descriptor_output_d;
main->output.to.stream = F_type_output_d;
main->output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d;
+ if (main->parameters.array[fss_basic_write_parameter_help_e].result & f_console_result_found_e) {
+ setting->flag |= fss_basic_write_main_flag_help_e;
+
+ return;
+ }
+
+ if (main->parameters.array[fss_basic_write_parameter_version_e].result & f_console_result_found_e) {
+ setting->flag |= fss_basic_write_main_flag_version_e;
+
+ return;
+ }
+
f_string_static_t * const args = main->parameters.arguments.array;
if (main->parameters.array[fss_basic_write_parameter_strip_invalid_e].result & f_console_result_found_e) {
return;
}
}
-
- if (main->parameters.array[fss_embedded_list_read_parameter_help_e].result & f_console_result_found_e) {
- setting->flag |= fss_embedded_list_read_main_flag_help_e;
-
- return;
- }
-
- if (main->parameters.array[fss_embedded_list_read_parameter_version_e].result & f_console_result_found_e) {
- setting->flag |= fss_embedded_list_read_main_flag_version_e;
-
- return;
- }
}
main->output.to.id = F_type_descriptor_output_d;
main->output.to.stream = F_type_output_d;
main->output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d;
+ if (main->parameters.array[fss_embedded_list_read_parameter_help_e].result & f_console_result_found_e) {
+ setting->flag |= fss_embedded_list_read_main_flag_help_e;
+
+ return;
+ }
+
+ if (main->parameters.array[fss_embedded_list_read_parameter_version_e].result & f_console_result_found_e) {
+ setting->flag |= fss_embedded_list_read_main_flag_version_e;
+
+ return;
+ }
+
f_string_static_t * const args = main->parameters.arguments.array;
if (main->parameters.array[fss_embedded_list_read_parameter_strip_invalid_e].result & f_console_result_found_e) {
return;
}
}
-
- if (main->parameters.array[fss_embedded_list_write_parameter_help_e].result & f_console_result_found_e) {
- setting->flag |= fss_embedded_list_write_main_flag_help_e;
-
- return;
- }
-
- if (main->parameters.array[fss_embedded_list_write_parameter_version_e].result & f_console_result_found_e) {
- setting->flag |= fss_embedded_list_write_main_flag_version_e;
-
- return;
- }
}
main->output.to.id = F_type_descriptor_output_d;
main->output.to.stream = F_type_output_d;
main->output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d;
+ if (main->parameters.array[fss_embedded_list_write_parameter_help_e].result & f_console_result_found_e) {
+ setting->flag |= fss_embedded_list_write_main_flag_help_e;
+
+ return;
+ }
+
+ if (main->parameters.array[fss_embedded_list_write_parameter_version_e].result & f_console_result_found_e) {
+ setting->flag |= fss_embedded_list_write_main_flag_version_e;
+
+ return;
+ }
+
f_string_static_t * const args = main->parameters.arguments.array;
if (main->parameters.array[fss_embedded_list_write_parameter_strip_invalid_e].result & f_console_result_found_e) {
return;
}
}
-
- if (main->parameters.array[fss_extended_list_read_parameter_help_e].result & f_console_result_found_e) {
- setting->flag |= fss_extended_list_read_main_flag_help_e;
-
- return;
- }
-
- if (main->parameters.array[fss_extended_list_read_parameter_version_e].result & f_console_result_found_e) {
- setting->flag |= fss_extended_list_read_main_flag_version_e;
-
- return;
- }
}
main->output.to.id = F_type_descriptor_output_d;
main->output.to.stream = F_type_output_d;
main->output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d;
+ if (main->parameters.array[fss_extended_list_read_parameter_help_e].result & f_console_result_found_e) {
+ setting->flag |= fss_extended_list_read_main_flag_help_e;
+
+ return;
+ }
+
+ if (main->parameters.array[fss_extended_list_read_parameter_version_e].result & f_console_result_found_e) {
+ setting->flag |= fss_extended_list_read_main_flag_version_e;
+
+ return;
+ }
+
f_string_static_t * const args = main->parameters.arguments.array;
if (main->parameters.array[fss_extended_list_read_parameter_strip_invalid_e].result & f_console_result_found_e) {
return;
}
}
-
- if (main->parameters.array[fss_extended_list_write_parameter_help_e].result & f_console_result_found_e) {
- setting->flag |= fss_extended_list_write_main_flag_help_e;
-
- return;
- }
-
- if (main->parameters.array[fss_extended_list_write_parameter_version_e].result & f_console_result_found_e) {
- setting->flag |= fss_extended_list_write_main_flag_version_e;
-
- return;
- }
}
main->output.to.id = F_type_descriptor_output_d;
main->output.to.stream = F_type_output_d;
main->output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d;
+ if (main->parameters.array[fss_extended_list_write_parameter_help_e].result & f_console_result_found_e) {
+ setting->flag |= fss_extended_list_write_main_flag_help_e;
+
+ return;
+ }
+
+ if (main->parameters.array[fss_extended_list_write_parameter_version_e].result & f_console_result_found_e) {
+ setting->flag |= fss_extended_list_write_main_flag_version_e;
+
+ return;
+ }
+
f_string_static_t * const args = main->parameters.arguments.array;
if (main->parameters.array[fss_extended_list_write_parameter_strip_invalid_e].result & f_console_result_found_e) {
return;
}
}
-
- if (main->parameters.array[fss_extended_read_parameter_help_e].result & f_console_result_found_e) {
- setting->flag |= fss_extended_read_main_flag_help_e;
-
- return;
- }
-
- if (main->parameters.array[fss_extended_read_parameter_version_e].result & f_console_result_found_e) {
- setting->flag |= fss_extended_read_main_flag_version_e;
-
- return;
- }
}
main->output.to.id = F_type_descriptor_output_d;
main->output.to.stream = F_type_output_d;
main->output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d;
+ if (main->parameters.array[fss_extended_read_parameter_help_e].result & f_console_result_found_e) {
+ setting->flag |= fss_extended_read_main_flag_help_e;
+
+ return;
+ }
+
+ if (main->parameters.array[fss_extended_read_parameter_version_e].result & f_console_result_found_e) {
+ setting->flag |= fss_extended_read_main_flag_version_e;
+
+ return;
+ }
+
f_string_static_t * const args = main->parameters.arguments.array;
if (main->parameters.array[fss_extended_read_parameter_strip_invalid_e].result & f_console_result_found_e) {
return;
}
}
-
- if (main->parameters.array[fss_extended_write_parameter_help_e].result & f_console_result_found_e) {
- setting->flag |= fss_extended_write_main_flag_help_e;
-
- return;
- }
-
- if (main->parameters.array[fss_extended_write_parameter_version_e].result & f_console_result_found_e) {
- setting->flag |= fss_extended_write_main_flag_version_e;
-
- return;
- }
}
main->output.to.id = F_type_descriptor_output_d;
main->output.to.stream = F_type_output_d;
main->output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d;
+ if (main->parameters.array[fss_extended_write_parameter_help_e].result & f_console_result_found_e) {
+ setting->flag |= fss_extended_write_main_flag_help_e;
+
+ return;
+ }
+
+ if (main->parameters.array[fss_extended_write_parameter_version_e].result & f_console_result_found_e) {
+ setting->flag |= fss_extended_write_main_flag_version_e;
+
+ return;
+ }
+
f_string_static_t * const args = main->parameters.arguments.array;
if (main->parameters.array[fss_extended_write_parameter_strip_invalid_e].result & f_console_result_found_e) {
return;
}
}
-
- if (main->parameters.array[fss_identify_parameter_help_e].result & f_console_result_found_e) {
- setting->flag |= fss_identify_main_flag_help_e;
-
- return;
- }
-
- if (main->parameters.array[fss_identify_parameter_version_e].result & f_console_result_found_e) {
- setting->flag |= fss_identify_main_flag_version_e;
-
- return;
- }
}
main->output.to.id = F_type_descriptor_output_d;
main->output.to.stream = F_type_output_d;
main->output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d;
+ if (main->parameters.array[fss_identify_parameter_help_e].result & f_console_result_found_e) {
+ setting->flag |= fss_identify_main_flag_help_e;
+
+ return;
+ }
+
+ if (main->parameters.array[fss_identify_parameter_version_e].result & f_console_result_found_e) {
+ setting->flag |= fss_identify_main_flag_version_e;
+
+ return;
+ }
+
f_string_static_t * const args = main->parameters.arguments.array;
if (main->parameters.array[fss_identify_parameter_strip_invalid_e].result & f_console_result_found_e) {
return;
}
}
-
- if (main->parameters.array[fss_payload_read_parameter_help_e].result & f_console_result_found_e) {
- setting->flag |= fss_payload_read_main_flag_help_e;
-
- return;
- }
-
- if (main->parameters.array[fss_payload_read_parameter_version_e].result & f_console_result_found_e) {
- setting->flag |= fss_payload_read_main_flag_version_e;
-
- return;
- }
}
main->output.to.id = F_type_descriptor_output_d;
main->output.to.stream = F_type_output_d;
main->output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d;
+ if (main->parameters.array[fss_payload_read_parameter_help_e].result & f_console_result_found_e) {
+ setting->flag |= fss_payload_read_main_flag_help_e;
+
+ return;
+ }
+
+ if (main->parameters.array[fss_payload_read_parameter_version_e].result & f_console_result_found_e) {
+ setting->flag |= fss_payload_read_main_flag_version_e;
+
+ return;
+ }
+
f_string_static_t * const args = main->parameters.arguments.array;
if (main->parameters.array[fss_payload_read_parameter_strip_invalid_e].result & f_console_result_found_e) {
return;
}
}
-
- if (main->parameters.array[fss_payload_write_parameter_help_e].result & f_console_result_found_e) {
- setting->flag |= fss_payload_write_main_flag_help_e;
-
- return;
- }
-
- if (main->parameters.array[fss_payload_write_parameter_version_e].result & f_console_result_found_e) {
- setting->flag |= fss_payload_write_main_flag_version_e;
-
- return;
- }
}
main->output.to.id = F_type_descriptor_output_d;
main->output.to.stream = F_type_output_d;
main->output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d;
+ if (main->parameters.array[fss_payload_write_parameter_help_e].result & f_console_result_found_e) {
+ setting->flag |= fss_payload_write_main_flag_help_e;
+
+ return;
+ }
+
+ if (main->parameters.array[fss_payload_write_parameter_version_e].result & f_console_result_found_e) {
+ setting->flag |= fss_payload_write_main_flag_version_e;
+
+ return;
+ }
+
if (main->parameters.array[fss_payload_write_parameter_file_e].result & f_console_result_value_e && main->parameters.array[fss_payload_write_parameter_file_e].values.used) {
if (main->parameters.array[fss_payload_write_parameter_file_e].values.used > 1) {
setting->status = F_status_set_error(F_parameter);
#ifndef _di_fss_write_basic_strings_
const f_string_static_t fss_write_basic_standard_s = macro_f_string_static_t_initialize(FSS_WRITE_basic_standard_s, 0, FSS_WRITE_basic_standard_s_length);
+ const f_string_static_t fss_write_basic_program_name_s = macro_f_string_static_t_initialize(FSS_WRITE_basic_program_name_s, 0, FSS_WRITE_basic_program_name_s_length);
+ const f_string_static_t fss_write_basic_program_name_long_s = macro_f_string_static_t_initialize(FSS_WRITE_basic_program_name_long_s, 0, FSS_WRITE_basic_program_name_long_s_length);
+
const f_string_static_t fss_write_format_code_short_0000_s = macro_f_string_static_t_initialize(FSS_WRITE_format_code_short_0000_s, 0, FSS_WRITE_format_code_short_0000_s_length);
const f_string_static_t fss_write_format_code_long_0000_s = macro_f_string_static_t_initialize(FSS_WRITE_format_code_long_0000_s, 0, FSS_WRITE_format_code_long_0000_s_length);
const f_string_static_t fss_write_format_code_human_0000_s = macro_f_string_static_t_initialize(FSS_WRITE_format_code_human_0000_s, 0, FSS_WRITE_format_code_human_0000_s_length);
#ifndef _di_fss_write_basic_strings_
#define FSS_WRITE_basic_standard_s "FSS-0000 (Basic)"
+ #define FSS_WRITE_basic_program_name_s "fss_basic_write"
+ #define FSS_WRITE_basic_program_name_long_s "FSS Basic Write"
+
#define FSS_WRITE_format_code_short_0000_s "0000"
#define FSS_WRITE_format_code_long_0000_s "fss-0000"
#define FSS_WRITE_format_code_human_0000_s "basic"
#define FSS_WRITE_basic_standard_s_length 16
+ #define FSS_WRITE_basic_program_name_s_length 15
+ #define FSS_WRITE_basic_program_name_long_s_length 15
+
#define FSS_WRITE_format_code_short_0000_s_length 4
#define FSS_WRITE_format_code_long_0000_s_length 8
#define FSS_WRITE_format_code_human_0000_s_length 5
extern const f_string_static_t fss_write_basic_standard_s;
+ extern const f_string_static_t fss_write_basic_program_name_s;
+ extern const f_string_static_t fss_write_basic_program_name_long_s;
+
extern const f_string_static_t fss_write_format_code_short_0000_s;
extern const f_string_static_t fss_write_format_code_long_0000_s;
extern const f_string_static_t fss_write_format_code_human_0000_s;
setting.process_help = &fss_write_basic_process_help;
setting.process_pipe = &fss_write_basic_process_pipe;
setting.process_normal = &fss_write_basic_process_normal;
+ setting.program_name = &fss_write_basic_program_name_s;
+ setting.program_name_long = &fss_write_basic_program_name_long_s;
f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize;
data.parameters.array = parameters;
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
- fss_write_setting_load(arguments, &data, &setting);
+ fss_write_setting_load(arguments, &data, &setting, 0);
}
fss_write_basic_main(&data, &setting);
f_print_dynamic_raw(setting->line_first, print.to);
- fll_program_print_help_header(print, fss_write_program_name_long_s, fss_write_program_version_s);
+ fll_program_print_help_header(print, setting->program_name_long ? *setting->program_name_long : fss_write_program_name_long_s, fss_write_program_version_s);
fss_write_print_help(setting, print);
f_print_dynamic_raw(f_string_eol_s, print.to);
- fll_program_print_help_usage(print, fss_write_program_name_s, f_string_empty_s);
+ fll_program_print_help_usage(print, setting->program_name ? *setting->program_name : fss_write_program_name_s, f_string_empty_s);
- // @todo
+ fss_write_print_help_pipe(setting, print);
+
+ fl_print_format("%r The FSS-0000 (Basic) specification does not support multi-line Content, therefore the parameter '%[%r%r%]'", print.to, f_string_eol_s, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_prepend_s, print.set->notable);
+ fl_print_format(" does nothing.%r%r", print.to, f_string_eol_s, f_string_eol_s);
+
+ fl_print_format(" This program does not use the parameter '%[%r%r%]', which therefore does nothing.%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_ignore_s, print.set->notable, f_string_eol_s);
+ fl_print_format(" This parameter requires two values.%r", print.to, f_string_eol_s);
f_print_dynamic_raw(setting->line_last, print.to);
#ifndef _di_fss_write_basic_list_strings_
const f_string_static_t fss_write_basic_list_standard_s = macro_f_string_static_t_initialize(FSS_WRITE_basic_list_standard_s, 0, FSS_WRITE_basic_list_standard_s_length);
+ const f_string_static_t fss_write_basic_list_program_name_s = macro_f_string_static_t_initialize(FSS_WRITE_basic_list_program_name_s, 0, FSS_WRITE_basic_list_program_name_s_length);
+ const f_string_static_t fss_write_basic_list_program_name_long_s = macro_f_string_static_t_initialize(FSS_WRITE_basic_list_program_name_long_s, 0, FSS_WRITE_basic_list_program_name_long_s_length);
+
const f_string_static_t fss_write_format_code_short_0002_s = macro_f_string_static_t_initialize(FSS_WRITE_format_code_short_0002_s, 0, FSS_WRITE_format_code_short_0002_s_length);
const f_string_static_t fss_write_format_code_long_0002_s = macro_f_string_static_t_initialize(FSS_WRITE_format_code_long_0002_s, 0, FSS_WRITE_format_code_long_0002_s_length);
const f_string_static_t fss_write_format_code_human_0002_s = macro_f_string_static_t_initialize(FSS_WRITE_format_code_human_0002_s, 0, FSS_WRITE_format_code_human_0002_s_length);
#ifndef _di_fss_write_basic_list_strings_
#define FSS_WRITE_basic_list_standard_s "FSS-0002 (Basic List)"
+ #define FSS_WRITE_basic_list_program_name_s "fss_basic_list_write"
+ #define FSS_WRITE_basic_list_program_name_long_s "FSS Basic List Write"
+
#define FSS_WRITE_format_code_short_0002_s "0002"
#define FSS_WRITE_format_code_long_0002_s "fss-0002"
#define FSS_WRITE_format_code_human_0002_s "basic list"
#define FSS_WRITE_basic_list_standard_s_length 21
+ #define FSS_WRITE_basic_list_program_name_s_length 20
+ #define FSS_WRITE_basic_list_program_name_long_s_length 20
+
#define FSS_WRITE_format_code_short_0002_s_length 4
#define FSS_WRITE_format_code_long_0002_s_length 8
#define FSS_WRITE_format_code_human_0002_s_length 10
extern const f_string_static_t fss_write_basic_list_standard_s;
+ extern const f_string_static_t fss_write_basic_list_program_name_s;
+ extern const f_string_static_t fss_write_basic_list_program_name_long_s;
+
extern const f_string_static_t fss_write_format_code_short_0002_s;
extern const f_string_static_t fss_write_format_code_long_0002_s;
extern const f_string_static_t fss_write_format_code_human_0002_s;
setting.process_help = &fss_write_basic_list_process_help;
setting.process_pipe = &fss_write_basic_list_process_pipe;
setting.process_normal = &fss_write_basic_list_process_normal;
+ setting.program_name = &fss_write_basic_list_program_name_s;
+ setting.program_name_long = &fss_write_basic_list_program_name_long_s;
f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize;
data.parameters.array = parameters;
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
- fss_write_setting_load(arguments, &data, &setting);
+ fss_write_setting_load(arguments, &data, &setting, 0);
}
fss_write_basic_list_main(&data, &setting);
f_print_dynamic_raw(setting->line_first, print.to);
- fll_program_print_help_header(print, fss_write_program_name_long_s, fss_write_program_version_s);
+ fll_program_print_help_header(print, setting->program_name_long ? *setting->program_name_long : fss_write_program_name_long_s, fss_write_program_version_s);
fss_write_print_help(setting, print);
f_print_dynamic_raw(f_string_eol_s, print.to);
- fll_program_print_help_usage(print, fss_write_program_name_s, f_string_empty_s);
+ fll_program_print_help_usage(print, setting->program_name ? *setting->program_name : fss_write_program_name_s, f_string_empty_s);
- // @todo
+ fss_write_print_help_pipe(setting, print);
+
+ fl_print_format("%r The FSS-0002 (Basic List) specification does not support quoted names, therefore the parameters '%[%r%r%]'", print.to, f_string_eol_s, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_single_s, print.set->notable);
+ fl_print_format(" and '%[%r%r%]' do nothing.%r%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_double_s, print.set->notable, f_string_eol_s, f_string_eol_s);
+
+ fl_print_format(" This program does not use the parameter '%[%r%r%]', which therefore does nothing.%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_ignore_s, print.set->notable, f_string_eol_s);
+ fl_print_format(" This parameter requires two values.%r", print.to, f_string_eol_s);
f_print_dynamic_raw(setting->line_last, print.to);
#ifndef _di_fss_write_embedded_list_strings_
const f_string_static_t fss_write_embedded_list_standard_s = macro_f_string_static_t_initialize(FSS_WRITE_embedded_list_standard_s, 0, FSS_WRITE_embedded_list_standard_s_length);
+ const f_string_static_t fss_write_embedded_list_program_name_s = macro_f_string_static_t_initialize(FSS_WRITE_embedded_list_program_name_s, 0, FSS_WRITE_embedded_list_program_name_s_length);
+ const f_string_static_t fss_write_embedded_list_program_name_long_s = macro_f_string_static_t_initialize(FSS_WRITE_embedded_list_program_name_long_s, 0, FSS_WRITE_embedded_list_program_name_long_s_length);
+
const f_string_static_t fss_write_format_code_short_0008_s = macro_f_string_static_t_initialize(FSS_WRITE_format_code_short_0008_s, 0, FSS_WRITE_format_code_short_0008_s_length);
const f_string_static_t fss_write_format_code_long_0008_s = macro_f_string_static_t_initialize(FSS_WRITE_format_code_long_0008_s, 0, FSS_WRITE_format_code_long_0008_s_length);
const f_string_static_t fss_write_format_code_human_0008_s = macro_f_string_static_t_initialize(FSS_WRITE_format_code_human_0008_s, 0, FSS_WRITE_format_code_human_0008_s_length);
#ifndef _di_fss_write_embedded_list_strings_
#define FSS_WRITE_embedded_list_standard_s "FSS-0008 (Embedded List)"
- #define FSS_WRITE_embedded_list_standard_s_length 24
-
- extern const f_string_static_t fss_write_embedded_list_standard_s;
+ #define FSS_WRITE_embedded_list_program_name_s "fss_embedded_list_write"
+ #define FSS_WRITE_embedded_list_program_name_long_s "FSS Embedded List Write"
#define FSS_WRITE_format_code_short_0008_s "0008"
#define FSS_WRITE_format_code_long_0008_s "fss-0008"
#define FSS_WRITE_format_code_human_0008_s "basic"
- #define FSS_WRITE_basic_standard_s_length 16
+ #define FSS_WRITE_embedded_list_standard_s_length 24
+
+ #define FSS_WRITE_embedded_list_program_name_s_length 23
+ #define FSS_WRITE_embedded_list_program_name_long_s_length 23
#define FSS_WRITE_format_code_short_0008_s_length 4
#define FSS_WRITE_format_code_long_0008_s_length 8
#define FSS_WRITE_format_code_human_0008_s_length 5
- extern const f_string_static_t fss_write_basic_standard_s;
+ extern const f_string_static_t fss_write_embedded_list_standard_s;
+
+ extern const f_string_static_t fss_write_embedded_list_program_name_s;
+ extern const f_string_static_t fss_write_embedded_list_program_name_long_s;
extern const f_string_static_t fss_write_format_code_short_0008_s;
extern const f_string_static_t fss_write_format_code_long_0008_s;
setting.process_help = &fss_write_embedded_list_process_help;
setting.process_pipe = &fss_write_embedded_list_process_pipe;
setting.process_normal = &fss_write_embedded_list_process_normal;
+ setting.program_name = &fss_write_embedded_list_program_name_s;
+ setting.program_name_long = &fss_write_embedded_list_program_name_long_s;
f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize;
data.parameters.array = parameters;
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
- fss_write_setting_load(arguments, &data, &setting);
+ fss_write_setting_load(arguments, &data, &setting, 0);
}
fss_write_embedded_list_main(&data, &setting);
f_print_dynamic_raw(setting->line_first, print.to);
- fll_program_print_help_header(print, fss_write_program_name_long_s, fss_write_program_version_s);
+ fll_program_print_help_header(print, setting->program_name_long ? *setting->program_name_long : fss_write_program_name_long_s, fss_write_program_version_s);
fss_write_print_help(setting, print);
f_print_dynamic_raw(f_string_eol_s, print.to);
- fll_program_print_help_usage(print, fss_write_program_name_s, f_string_empty_s);
+ fll_program_print_help_usage(print, setting->program_name ? *setting->program_name : fss_write_program_name_s, f_string_empty_s);
- // @todo
+ fss_write_print_help_pipe(setting, print);
+
+ fl_print_format("%r The FSS-0008 (Embedded List) specification does not support quoted names, therefore the parameters '%[%r%r%]'", print.to, f_string_eol_s, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_single_s, print.set->notable);
+ fl_print_format(" and '%[%r%r%]' do nothing.%r%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_double_s, print.set->notable, f_string_eol_s, f_string_eol_s);
+
+ fl_print_format(" The parameter '%[%r%r%]' designates to not escape any valid nested Object or Content within some Content.%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_ignore_s, print.set->notable, f_string_eol_s);
+ fl_print_format(" This parameter requires two values.%r", print.to, f_string_eol_s);
+ fl_print_format(" This parameter is not used for ignoring anything from the input pipe.%r", print.to, f_string_eol_s);
+ fl_print_format(" This parameter must be specified after a '%[%r%r%]'", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_content_s, print.set->notable);
+ fl_print_format(" parameter and this applies only to the Content represented by that specific '%[%r%r%]' parameter.%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_content_s, print.set->notable, f_string_eol_s);
f_print_dynamic_raw(setting->line_last, print.to);
#ifndef _di_fss_write_extended_strings_
const f_string_static_t fss_write_extended_standard_s = macro_f_string_static_t_initialize(FSS_WRITE_extended_standard_s, 0, FSS_WRITE_extended_standard_s_length);
+ const f_string_static_t fss_write_extended_program_name_s = macro_f_string_static_t_initialize(FSS_WRITE_extended_program_name_s, 0, FSS_WRITE_extended_program_name_s_length);
+ const f_string_static_t fss_write_extended_program_name_long_s = macro_f_string_static_t_initialize(FSS_WRITE_extended_program_name_long_s, 0, FSS_WRITE_extended_program_name_long_s_length);
+
const f_string_static_t fss_write_format_code_short_0001_s = macro_f_string_static_t_initialize(FSS_WRITE_format_code_short_0001_s, 0, FSS_WRITE_format_code_short_0001_s_length);
const f_string_static_t fss_write_format_code_long_0001_s = macro_f_string_static_t_initialize(FSS_WRITE_format_code_long_0001_s, 0, FSS_WRITE_format_code_long_0001_s_length);
const f_string_static_t fss_write_format_code_human_0001_s = macro_f_string_static_t_initialize(FSS_WRITE_format_code_human_0001_s, 0, FSS_WRITE_format_code_human_0001_s_length);
#ifndef _di_fss_write_extended_strings_
#define FSS_WRITE_extended_standard_s "FSS-0001 (Extended)"
+ #define FSS_WRITE_extended_program_name_s "fss_extended_write"
+ #define FSS_WRITE_extended_program_name_long_s "FSS Extended Write"
+
#define FSS_WRITE_format_code_short_0001_s "0001"
#define FSS_WRITE_format_code_long_0001_s "fss-0001"
#define FSS_WRITE_format_code_human_0001_s "extended"
#define FSS_WRITE_extended_standard_s_length 19
+ #define FSS_WRITE_extended_program_name_s_length 18
+ #define FSS_WRITE_extended_program_name_long_s_length 18
+
#define FSS_WRITE_format_code_short_0001_s_length 4
#define FSS_WRITE_format_code_long_0001_s_length 8
#define FSS_WRITE_format_code_human_0001_s_length 8
extern const f_string_static_t fss_write_extended_standard_s;
+ extern const f_string_static_t fss_write_extended_program_name_s;
+ extern const f_string_static_t fss_write_extended_program_name_long_s;
+
extern const f_string_static_t fss_write_format_code_short_0001_s;
extern const f_string_static_t fss_write_format_code_long_0001_s;
extern const f_string_static_t fss_write_format_code_human_0001_s;
setting.process_help = &fss_write_extended_process_help;
setting.process_pipe = &fss_write_extended_process_pipe;
setting.process_normal = &fss_write_extended_process_normal;
+ setting.program_name = &fss_write_extended_program_name_s;
+ setting.program_name_long = &fss_write_extended_program_name_long_s;
f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize;
data.parameters.array = parameters;
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
- fss_write_setting_load(arguments, &data, &setting);
+ fss_write_setting_load(arguments, &data, &setting, 0);
}
fss_write_extended_main(&data, &setting);
f_print_dynamic_raw(setting->line_first, print.to);
- fll_program_print_help_header(print, fss_write_program_name_long_s, fss_write_program_version_s);
+ fll_program_print_help_header(print, setting->program_name_long ? *setting->program_name_long : fss_write_program_name_long_s, fss_write_program_version_s);
fss_write_print_help(setting, print);
f_print_dynamic_raw(f_string_eol_s, print.to);
- fll_program_print_help_usage(print, fss_write_program_name_s, f_string_empty_s);
+ fll_program_print_help_usage(print, setting->program_name ? *setting->program_name : fss_write_program_name_s, f_string_empty_s);
- // @todo
+ fss_write_print_help_pipe(setting, print);
+
+ fl_print_format("%r The FSS-0001 (Extended) specification does not support multi-line Content, therefore the parameter '%[%r%r%]'", print.to, f_string_eol_s, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_prepend_s, print.set->notable);
+ fl_print_format(" does nothing.%r%r", print.to, f_string_eol_s, f_string_eol_s);
+
+ fl_print_format(" This program does not use the parameter '%[%r%r%]', which therefore does nothing.%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_ignore_s, print.set->notable, f_string_eol_s);
+ fl_print_format(" This parameter requires two values.%r", print.to, f_string_eol_s);
f_print_dynamic_raw(setting->line_last, print.to);
#ifndef _di_fss_write_extended_list_strings_
const f_string_static_t fss_write_extended_list_standard_s = macro_f_string_static_t_initialize(FSS_WRITE_extended_list_standard_s, 0, FSS_WRITE_extended_list_standard_s_length);
+ const f_string_static_t fss_write_extended_list_program_name_s = macro_f_string_static_t_initialize(FSS_WRITE_extended_list_program_name_s, 0, FSS_WRITE_extended_list_program_name_s_length);
+ const f_string_static_t fss_write_extended_list_program_name_long_s = macro_f_string_static_t_initialize(FSS_WRITE_extended_list_program_name_long_s, 0, FSS_WRITE_extended_list_program_name_long_s_length);
+
const f_string_static_t fss_write_format_code_short_0003_s = macro_f_string_static_t_initialize(FSS_WRITE_format_code_short_0003_s, 0, FSS_WRITE_format_code_short_0003_s_length);
const f_string_static_t fss_write_format_code_long_0003_s = macro_f_string_static_t_initialize(FSS_WRITE_format_code_long_0003_s, 0, FSS_WRITE_format_code_long_0003_s_length);
const f_string_static_t fss_write_format_code_human_0003_s = macro_f_string_static_t_initialize(FSS_WRITE_format_code_human_0003_s, 0, FSS_WRITE_format_code_human_0003_s_length);
#ifndef _di_fss_write_extended_list_strings_
#define FSS_WRITE_extended_list_standard_s "FSS-0003 (Extended List)"
+ #define FSS_WRITE_extended_list_program_name_s "fss_extended_list_write"
+ #define FSS_WRITE_extended_list_program_name_long_s "FSS Extended List Write"
+
#define FSS_WRITE_format_code_short_0003_s "0003"
#define FSS_WRITE_format_code_long_0003_s "fss-0003"
#define FSS_WRITE_format_code_human_0003_s "extended list"
#define FSS_WRITE_extended_list_standard_s_length 24
+ #define FSS_WRITE_extended_list_program_name_s_length 23
+ #define FSS_WRITE_extended_list_program_name_long_s_length 23
+
#define FSS_WRITE_format_code_short_0003_s_length 4
#define FSS_WRITE_format_code_long_0003_s_length 8
#define FSS_WRITE_format_code_human_0003_s_length 13
extern const f_string_static_t fss_write_extended_list_standard_s;
+ extern const f_string_static_t fss_write_extended_list_program_name_s;
+ extern const f_string_static_t fss_write_extended_list_program_name_long_s;
+
extern const f_string_static_t fss_write_format_code_short_0003_s;
extern const f_string_static_t fss_write_format_code_long_0003_s;
extern const f_string_static_t fss_write_format_code_human_0003_s;
setting.process_help = &fss_write_extended_list_process_help;
setting.process_pipe = &fss_write_extended_list_process_pipe;
setting.process_normal = &fss_write_extended_list_process_normal;
+ setting.program_name = &fss_write_extended_list_program_name_s;
+ setting.program_name_long = &fss_write_extended_list_program_name_long_s;
f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize;
data.parameters.array = parameters;
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
- fss_write_setting_load(arguments, &data, &setting);
+ fss_write_setting_load(arguments, &data, &setting, 0);
}
fss_write_extended_list_main(&data, &setting);
f_print_dynamic_raw(setting->line_first, print.to);
- fll_program_print_help_header(print, fss_write_program_name_long_s, fss_write_program_version_s);
+ fll_program_print_help_header(print, setting->program_name_long ? *setting->program_name_long : fss_write_program_name_long_s, fss_write_program_version_s);
fss_write_print_help(setting, print);
f_print_dynamic_raw(f_string_eol_s, print.to);
- fll_program_print_help_usage(print, fss_write_program_name_s, f_string_empty_s);
+ fll_program_print_help_usage(print, setting->program_name ? *setting->program_name : fss_write_program_name_s, f_string_empty_s);
- // @todo
+ fss_write_print_help_pipe(setting, print);
+
+ fl_print_format("%r The FSS-0003 (Extended List) specification does not support quoted names, therefore the parameters '%[%r%r%]'", print.to, f_string_eol_s, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_single_s, print.set->notable);
+ fl_print_format(" and '%[%r%r%]' do nothing.%r%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_double_s, print.set->notable, f_string_eol_s, f_string_eol_s);
+
+ fl_print_format(" The parameter '%[%r%r%]' designates to not escape any valid nested Object or Content within some Content.%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_ignore_s, print.set->notable, f_string_eol_s);
+ fl_print_format(" This parameter requires two values.%r", print.to, f_string_eol_s);
+ fl_print_format(" This parameter is not used for ignoring anything from the input pipe.%r", print.to, f_string_eol_s);
+ fl_print_format(" This parameter must be specified after a '%[%r%r%]'", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_content_s, print.set->notable);
+ fl_print_format(" parameter and this applies only to the Content represented by that specific '%[%r%r%]' parameter.%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_content_s, print.set->notable, f_string_eol_s);
f_print_dynamic_raw(setting->line_last, print.to);
#endif // _di_fss_write_setting_delete_
#ifndef _di_fss_write_setting_load_
- void fss_write_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting) {
+ void fss_write_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting, void (*callback)(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting)) {
if (!main || !setting) return;
return;
}
}
-
- if (main->parameters.array[fss_write_parameter_help_e].result & f_console_result_found_e) {
- setting->flag |= fss_write_main_flag_help_e;
-
- return;
- }
-
- if (main->parameters.array[fss_write_parameter_version_e].result & f_console_result_found_e) {
- setting->flag |= fss_write_main_flag_version_e;
-
- return;
- }
}
main->output.to.id = F_type_descriptor_output_d;
main->output.to.stream = F_type_output_d;
main->output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d;
- if (main->parameters.array[fss_write_parameter_file_e].result & f_console_result_value_e && main->parameters.array[fss_write_parameter_file_e].values.used) {
- // @todo check the "-a/--as" and select format or fallback to FSS-0000 Basic (support either digits "0000"/"0001" or simple names "basic"/"basic_list".
- // Fallback only happens if -a/--as is not disabled, otherwise the callback function should be pre-defined.
+ if (main->parameters.array[fss_write_parameter_help_e].result & f_console_result_found_e) {
+ setting->flag |= fss_write_main_flag_help_e;
}
- else if (main->parameters.array[fss_write_parameter_as_e].result & f_console_result_found_e) {
- setting->status = F_status_set_error(F_parameter);
- fss_write_print_line_first_locked(setting, main->error);
- fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_file_s);
- fss_write_print_line_last_locked(setting, main->error);
+ if (main->parameters.array[fss_write_parameter_version_e].result & f_console_result_found_e) {
+ setting->flag |= fss_write_main_flag_version_e;
+ }
- return;
+ if (callback) {
+ callback(arguments, main, setting);
+ if (F_status_is_error(setting->status)) return;
+
+ if (setting->status == F_done) {
+ setting->status = F_none;
+
+ return;
+ }
}
+ if (main->parameters.array[fss_write_parameter_help_e].result & f_console_result_found_e) return;
+ if (main->parameters.array[fss_write_parameter_version_e].result & f_console_result_found_e) return;
+
if (main->parameters.array[fss_write_parameter_file_e].result & f_console_result_value_e && main->parameters.array[fss_write_parameter_file_e].values.used) {
if (main->parameters.array[fss_write_parameter_file_e].values.used > 1) {
setting->status = F_status_set_error(F_parameter);
#endif // _di_fss_write_defines_
/**
- * Designate the supported formats for the main (fss_write) program.
- *
- * These are intended to be used for communicating or selecting an "--as" option.
- *
- * The digit value of the codes are intended to exactly match the numeric representation.
- *
- * fss_write_format_code_*_e:
- * - 0000: The FSS-0000 (Basic) format.
- * - 0001: The FSS-0001 (Extended) format.
- * - 0002: The FSS-0002 (Basic List) format.
- * - 0003: The FSS-0003 (Extended List) format.
- * - 0008: The FSS-0008 (Embedded List) format.
- * - 000e: The FSS-000E (Payload) format.
- */
-#ifndef _di_fss_write_formats_
- enum {
- fss_write_format_code_0000_e = 0x0,
- fss_write_format_code_0001_e = 0x1,
- fss_write_format_code_0002_e = 0x2,
- fss_write_format_code_0003_e = 0x3,
- fss_write_format_code_0008_e = 0x8,
- fss_write_format_code_000e_e = 0xe,
- };
-#endif // _di_fss_write_formats_
-
-/**
* A collection of static strings associated with FSS Payload Write.
*/
#ifndef _di_fss_write_strings_
f_string_dynamics_t objects;
f_string_dynamics_t contents;
+ const f_string_static_t *program_name;
+ const f_string_static_t *program_name_long;
+
void (*process_help)(fll_program_data_t * const main, void * const setting);
void (*process_normal)(fll_program_data_t * const main, void * const setting);
void (*process_pipe)(fll_program_data_t * const main, void * const setting);
0, \
0, \
0, \
+ 0, \
+ 0, \
}
#endif // _di_fss_write_setting_t_
* Errors (with error bit) from: f_string_dynamics_resize().
* Errors (with error bit) from: fll_program_parameter_process_context().
* Errors (with error bit) from: fll_program_parameter_process_verbosity().
+ * @param callback
+ * (optional) Designate a function to call after performing the initial processing, but before printing help.
+ * If the function returns F_done, then this function immediately returns, resetting status to F_none.
+ * Set to NULL to disable.
*
* @see f_console_parameter_process()
* @see f_file_stream_open()
* @see fll_program_parameter_process_verbosity()
*/
#ifndef _di_fss_write_setting_load_
- extern void fss_write_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting);
+ extern void fss_write_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting, void (*callback)(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting));
#endif // _di_fss_write_setting_load_
/**
fll_program_data_t data = fll_program_data_t_initialize;
fss_write_setting_t setting = fss_write_setting_t_initialize;
setting.state.data = (void *) &data;
-
- // Default to Basic.
- setting.process_help = &fss_write_main_process_help;
- setting.process_pipe = &fss_write_basic_process_pipe;
- setting.process_normal = &fss_write_basic_process_normal;
+ setting.program_name = &fss_write_program_name_s;
+ setting.program_name_long = &fss_write_program_name_long_s;
f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize;
data.parameters.array = parameters;
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
- fss_write_setting_load(arguments, &data, &setting);
+ fss_write_setting_load(arguments, &data, &setting, &fss_write_main_setting_load_as);
}
fss_write_main(&data, &setting);
fll_program_print_help_usage(main->message, fss_write_program_name_s, f_string_empty_s);
+ fss_write_print_help_pipe(setting, main->message);
+
f_print_dynamic_raw(f_string_eol_s, main->message.to);
- fl_print_format(" The '%[%r%r%]' parameter supports the following standards with the specified possible case-sensitive values%r", main->message.to, main->message.set->notable, f_console_symbol_long_normal_s, fss_write_long_as_s, main->message.set->notable, f_string_eol_s);
+ fl_print_format(" The '%[%r%r%]' parameter supports the following standards with the specified possible case-sensitive values:%r", main->message.to, main->message.set->notable, f_console_symbol_long_normal_s, fss_write_long_as_s, main->message.set->notable, f_string_eol_s);
// FSS-0000 (Basic)
fl_print_format(" - As %[%r%] format: ", main->message.to, main->message.set->notable, fss_write_basic_standard_s, main->message.set->notable);
f_file_stream_unlock(main->message.to);
}
#endif // _di_fss_write_main_process_help_
+
+#ifndef _di_fss_write_main_setting_load_as_
+ void fss_write_main_setting_load_as(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting) {
+
+ if (!main || !setting || F_status_is_error(setting->status) || (setting->flag & fss_write_main_flag_version_e)) return;
+
+ setting->program_name = &fss_write_program_name_s;
+ setting->program_name_long = &fss_write_program_name_long_s;
+ setting->process_help = &fss_write_main_process_help;
+ setting->process_pipe = &fss_write_basic_process_pipe;
+ setting->process_normal = &fss_write_basic_process_normal;
+
+ if (main->parameters.array[fss_write_parameter_as_e].result & f_console_result_value_e && main->parameters.array[fss_write_parameter_as_e].values.used) {
+
+ f_array_length_t index = 0;
+ f_string_static_t *argv = main->parameters.arguments.array;
+
+ for (f_array_length_t i = 0; i < main->parameters.array[fss_write_parameter_as_e].values.used; ++i) {
+
+ index = main->parameters.array[fss_write_parameter_as_e].values.array[i];
+
+ if (fl_string_dynamic_compare(argv[index], fss_write_format_code_short_0000_s) == F_equal_to ||
+ fl_string_dynamic_compare(argv[index], fss_write_format_code_long_0000_s) == F_equal_to ||
+ fl_string_dynamic_compare(argv[index], fss_write_format_code_human_0000_s) == F_equal_to) {
+
+ setting->program_name = &fss_write_basic_program_name_s;
+ setting->program_name_long = &fss_write_basic_program_name_long_s;
+ setting->process_help = &fss_write_basic_process_help;
+ setting->process_pipe = &fss_write_basic_process_pipe;
+ setting->process_normal = &fss_write_basic_process_normal;
+ }
+ else if (fl_string_dynamic_compare(argv[index], fss_write_format_code_short_0001_s) == F_equal_to ||
+ fl_string_dynamic_compare(argv[index], fss_write_format_code_long_0001_s) == F_equal_to ||
+ fl_string_dynamic_compare(argv[index], fss_write_format_code_human_0001_s) == F_equal_to) {
+
+ setting->program_name = &fss_write_extended_program_name_s;
+ setting->program_name_long = &fss_write_extended_program_name_long_s;
+ setting->process_help = &fss_write_extended_process_help;
+ setting->process_pipe = &fss_write_extended_process_pipe;
+ setting->process_normal = &fss_write_extended_process_normal;
+ }
+ else if (fl_string_dynamic_compare(argv[index], fss_write_format_code_short_0002_s) == F_equal_to ||
+ fl_string_dynamic_compare(argv[index], fss_write_format_code_long_0002_s) == F_equal_to ||
+ fl_string_dynamic_compare(argv[index], fss_write_format_code_human_0002_s) == F_equal_to) {
+
+ setting->program_name = &fss_write_basic_list_program_name_s;
+ setting->program_name_long = &fss_write_basic_list_program_name_long_s;
+ setting->process_help = &fss_write_basic_list_process_help;
+ setting->process_pipe = &fss_write_basic_list_process_pipe;
+ setting->process_normal = &fss_write_basic_list_process_normal;
+ }
+ else if (fl_string_dynamic_compare(argv[index], fss_write_format_code_short_0003_s) == F_equal_to ||
+ fl_string_dynamic_compare(argv[index], fss_write_format_code_long_0003_s) == F_equal_to ||
+ fl_string_dynamic_compare(argv[index], fss_write_format_code_human_0003_s) == F_equal_to) {
+
+ setting->program_name = &fss_write_extended_list_program_name_s;
+ setting->program_name_long = &fss_write_extended_list_program_name_long_s;
+ setting->process_help = &fss_write_extended_list_process_help;
+ setting->process_pipe = &fss_write_extended_list_process_pipe;
+ setting->process_normal = &fss_write_extended_list_process_normal;
+ }
+ else if (fl_string_dynamic_compare(argv[index], fss_write_format_code_short_0008_s) == F_equal_to ||
+ fl_string_dynamic_compare(argv[index], fss_write_format_code_long_0008_s) == F_equal_to ||
+ fl_string_dynamic_compare(argv[index], fss_write_format_code_human_0008_s) == F_equal_to) {
+
+ setting->program_name = &fss_write_embedded_list_program_name_s;
+ setting->program_name_long = &fss_write_embedded_list_program_name_long_s;
+ setting->process_help = &fss_write_embedded_list_process_help;
+ setting->process_pipe = &fss_write_embedded_list_process_pipe;
+ setting->process_normal = &fss_write_embedded_list_process_normal;
+ }
+ else if (fl_string_dynamic_compare(argv[index], fss_write_format_code_short_000e_s) == F_equal_to ||
+ fl_string_dynamic_compare(argv[index], fss_write_format_code_long_000e_s) == F_equal_to ||
+ fl_string_dynamic_compare(argv[index], fss_write_format_code_human_000e_s) == F_equal_to) {
+
+ setting->program_name = &fss_write_payload_program_name_s;
+ setting->program_name_long = &fss_write_payload_program_name_long_s;
+ setting->process_help = &fss_write_payload_process_help;
+ setting->process_pipe = &fss_write_payload_process_pipe;
+ setting->process_normal = &fss_write_payload_process_normal;
+
+ }
+ else {
+ // @todo print error
+
+ setting->status = F_status_set_error(F_parameter);
+ }
+ } // for
+
+ if (F_status_is_error(setting->status)) {
+ if (setting->flag & fss_write_main_flag_help_e) {
+ fss_write_main_process_help(main, setting);
+ }
+
+ return;
+ }
+ }
+ else if (main->parameters.array[fss_write_parameter_as_e].result & f_console_result_found_e) {
+ setting->status = F_status_set_error(F_parameter);
+
+ if (setting->flag & fss_write_main_flag_help_e) {
+ fss_write_main_process_help(main, setting);
+
+ return;
+ }
+
+ fss_write_print_line_first_locked(setting, main->error);
+ fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_as_s);
+ fss_write_print_line_last_locked(setting, main->error);
+
+ return;
+ }
+ }
+#endif // _di_fss_write_main_setting_load_as_
extern void fss_write_main_process_help(fll_program_data_t * const main, void * const setting);
#endif // _di_fss_write_main_process_help_
+/**
+ * Perform the standard program setting load process for the "--as" parameter.
+ *
+ * This should be called before fss_write_setting_load() is called to ensure "--as" gets processed before "--help".
+ *
+ * This prints error messages as appropriate.
+ *
+ * If either main or setting is NULL, then this immediately retuns without doing anything.
+ *
+ * @param arguments
+ * The parameters passed to the process (often referred to as command line arguments).
+ * @param main
+ * The main program data.
+ * @param setting
+ * The main program settings.
+ *
+ * This alters setting.process_help, setting.process_normal, and setting.process_pipe.
+ *
+ * This alters setting.status:
+ * F_none on success.
+ * F_interrupt on (exit) signal received.
+ *
+ * F_parameter (with error bit) if main is NULL or setting is NULL.
+ *
+ * This alters setting.status:
+ * F_none on success.
+ * F_data_not on success but nothing was provided to operate with.
+ *
+ * Errors (with error bit) from: f_console_parameter_process().
+ * Errors (with error bit) from: f_file_stream_open().
+ * Errors (with error bit) from: f_string_dynamics_resize().
+ * Errors (with error bit) from: fll_program_parameter_process_context().
+ * Errors (with error bit) from: fll_program_parameter_process_verbosity().
+ *
+ * @see f_console_parameter_process()
+ * @see f_file_stream_open()
+ * @see f_string_dynamics_resize()
+ * @see fll_program_parameter_process_context()
+ * @see fll_program_parameter_process_verbosity()
+ *
+ * @see fss_write_setting_load()
+ */
+#ifndef _di_fss_write_main_setting_load_as_
+ extern void fss_write_main_setting_load_as(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting);
+#endif // _di_fss_write_main_setting_load_as_
+
#ifdef __cplusplus
} // extern "C"
#endif
}
#endif // _di_fss_write_print_help_
+#ifndef _di_fss_write_print_help_pipe_
+ void fss_write_print_help_pipe(fss_write_setting_t * const setting, const fl_print_t print) {
+
+ fl_print_format("%r The pipe uses the Backspace character '%[\\b%]' (%[U+0008%]) to designate the start of a Content.%r", print.to, f_string_eol_s, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s);
+ fl_print_format(" The pipe uses the Form Feed character '%[\\f%]' (%[U+000C%]) to designate the end of the last Content.%r", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s);
+ fl_print_format(" The pipe uses the Vertical Line character '%[\\v%]' (%[U+000B%]) is used to ignore a Content range (use this both before and after the range).%r", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s);
+ fl_print_format(" For the pipe, an Object is terminated by either a Backspace character '%[\\b%]' (%[U+0008%])", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable);
+ fl_print_format(" or a Form Feed character '%[\\f%]' (%[U+000C%]).%r", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s);
+ fl_print_format(" The end of the pipe represents the end of any Object or Content.%r", print.to, f_string_eol_s);
+
+ }
+#endif // _di_fss_write_print_help_pipe_
+
#ifndef _di_fss_write_print_line_first_locked_
f_status_t fss_write_print_line_first_locked(fss_write_setting_t * const setting, const fl_print_t print) {
#endif // _di_fss_write_print_help_
/**
+ * Print standard parts of the help regarding pipe usage.
+ *
+ * This is expected to be called as part of the help printing and does not perform any locking.
+ *
+ * @param setting
+ * The main program settings.
+ *
+ * This does not alter setting.status.
+ * @param print
+ * The output structure to print to.
+ */
+#ifndef _di_fss_write_print_help_pipe_
+ extern void fss_write_print_help_pipe(fss_write_setting_t * const setting, const fl_print_t print);
+#endif // _di_fss_write_print_help_pipe_
+
+/**
* Print first new line, unless verbosity says otherwise.
*
* This is generally either the first line in the program or the first line printed before an error message.
#ifndef _di_fss_write_payload_strings_
const f_string_static_t fss_write_payload_standard_s = macro_f_string_static_t_initialize(FSS_WRITE_payload_standard_s, 0, FSS_WRITE_payload_standard_s_length);
+ const f_string_static_t fss_write_payload_program_name_s = macro_f_string_static_t_initialize(FSS_WRITE_payload_program_name_s, 0, FSS_WRITE_payload_program_name_s_length);
+ const f_string_static_t fss_write_payload_program_name_long_s = macro_f_string_static_t_initialize(FSS_WRITE_payload_program_name_long_s, 0, FSS_WRITE_payload_program_name_long_s_length);
+
const f_string_static_t fss_write_format_code_short_000e_s = macro_f_string_static_t_initialize(FSS_WRITE_format_code_short_000e_s, 0, FSS_WRITE_format_code_short_000e_s_length);
const f_string_static_t fss_write_format_code_long_000e_s = macro_f_string_static_t_initialize(FSS_WRITE_format_code_long_000e_s, 0, FSS_WRITE_format_code_long_000e_s_length);
const f_string_static_t fss_write_format_code_human_000e_s = macro_f_string_static_t_initialize(FSS_WRITE_format_code_human_000e_s, 0, FSS_WRITE_format_code_human_000e_s_length);
#ifndef _di_fss_write_payload_strings_
#define FSS_WRITE_payload_standard_s "FSS-000E (Payload)"
+ #define FSS_WRITE_payload_program_name_s "fss_payload_write"
+ #define FSS_WRITE_payload_program_name_long_s "FSS Payload Write"
+
#define FSS_WRITE_format_code_short_000e_s "000e"
#define FSS_WRITE_format_code_long_000e_s "fss-000e"
#define FSS_WRITE_format_code_human_000e_s "payload"
#define FSS_WRITE_payload_standard_s_length 18
+ #define FSS_WRITE_payload_program_name_s_length 17
+ #define FSS_WRITE_payload_program_name_long_s_length 17
+
#define FSS_WRITE_format_code_short_000e_s_length 4
#define FSS_WRITE_format_code_long_000e_s_length 8
#define FSS_WRITE_format_code_human_000e_s_length 7
extern const f_string_static_t fss_write_payload_standard_s;
+ extern const f_string_static_t fss_write_payload_program_name_s;
+ extern const f_string_static_t fss_write_payload_program_name_long_s;
+
extern const f_string_static_t fss_write_format_code_short_000e_s;
extern const f_string_static_t fss_write_format_code_long_000e_s;
extern const f_string_static_t fss_write_format_code_human_000e_s;
setting.process_help = &fss_write_payload_process_help;
setting.process_pipe = &fss_write_payload_process_pipe;
setting.process_normal = &fss_write_payload_process_normal;
+ setting.program_name = &fss_write_payload_program_name_s;
+ setting.program_name_long = &fss_write_payload_program_name_long_s;
f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize;
data.parameters.array = parameters;
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
- fss_write_setting_load(arguments, &data, &setting);
+ fss_write_setting_load(arguments, &data, &setting, 0);
}
fss_write_main(&data, &setting);
f_print_dynamic_raw(setting->line_first, print.to);
- fll_program_print_help_header(print, fss_write_program_name_long_s, fss_write_program_version_s);
+ fll_program_print_help_header(print, setting->program_name_long ? *setting->program_name_long : fss_write_program_name_long_s, fss_write_program_version_s);
fss_write_print_help(setting, print);
f_print_dynamic_raw(f_string_eol_s, print.to);
- fll_program_print_help_usage(print, fss_write_program_name_s, f_string_empty_s);
+ fll_program_print_help_usage(print, setting->program_name ? *setting->program_name : fss_write_program_name_s, f_string_empty_s);
- fl_print_format("%r The pipe uses the Backspace character '%[\\b%]' (%[U+0008%]) to designate the start of a Content.%r", print.to, f_string_eol_s, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s);
- fl_print_format(" The pipe uses the Form Feed character '%[\\f%]' (%[U+000C%]) to designate the end of the last Content.%r", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s);
- fl_print_format(" The pipe uses the Vertical Line character '%[\\v%]' (%[U+000B%]) is used to ignore a Content range, which does nothing in this program.%r", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s);
- fl_print_format(" For the pipe, an Object is terminated by either a Backspace character '%[\\b%]' (%[U+0008%])", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable);
- fl_print_format(" or a Form Feed character '%[\\f%]' (%[U+000C%]).%r", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s);
- fl_print_format(" The end of the pipe represents the end of any Object or Content.%r%r", print.to, f_string_eol_s, f_string_eol_s);
+ fss_write_print_help_pipe(setting, print);
- fl_print_format(" The FSS-000E (Payload) specification does not support quoted names, therefore the parameters '%[%r%r%]'", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_single_s, print.set->notable);
+ fl_print_format("%r The FSS-000E (Payload) specification does not support quoted names, therefore the parameters '%[%r%r%]'", print.to, f_string_eol_s, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_single_s, print.set->notable);
fl_print_format(" and '%[%r%r%]' do nothing.%r%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_double_s, print.set->notable, f_string_eol_s, f_string_eol_s);
fl_print_format(" This program does not use the parameter '%[%r%r%]', which therefore does nothing.%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_ignore_s, print.set->notable, f_string_eol_s);
setting->status = F_none;
if (setting->flag & iki_read_main_flag_help_e) {
- iki_read_print_help(setting, main->message);
+ iki_read_print_help(main, setting, main->message);
return;
}
return;
}
}
-
- if (main->parameters.array[iki_write_parameter_help_e].result & f_console_result_found_e) {
- setting->flag |= iki_write_main_flag_help_e;
-
- return;
- }
-
- if (main->parameters.array[iki_write_parameter_version_e].result & f_console_result_found_e) {
- setting->flag |= iki_write_main_flag_version_e;
-
- return;
- }
}
main->output.to.id = F_type_descriptor_output_d;
main->output.to.stream = F_type_output_d;
main->output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d;
+ if (main->parameters.array[iki_write_parameter_help_e].result & f_console_result_found_e) {
+ setting->flag |= iki_write_main_flag_help_e;
+
+ return;
+ }
+
+ if (main->parameters.array[iki_write_parameter_version_e].result & f_console_result_found_e) {
+ setting->flag |= iki_write_main_flag_version_e;
+
+ return;
+ }
+
if (main->parameters.array[iki_write_parameter_file_e].result & f_console_result_value_e && main->parameters.array[iki_write_parameter_file_e].values.used) {
if (main->parameters.array[iki_write_parameter_file_e].values.used > 1) {
setting->status = F_status_set_error(F_parameter);
}
}
- if (main->parameters.array[utf8_parameter_help_e].result & f_console_result_found_e) {
- setting->flag |= utf8_main_flag_help_e;
-
- return;
- }
-
- if (main->parameters.array[utf8_parameter_version_e].result & f_console_result_found_e) {
- setting->flag |= utf8_main_flag_version_e;
-
- return;
- }
-
// Identify and prioritize "from" mode parameters.
{
uint16_t choices_array[2] = { utf8_parameter_from_bytesequence_e, utf8_parameter_from_codepoint_e };
}
}
+ if (main->parameters.array[utf8_parameter_help_e].result & f_console_result_found_e) {
+ setting->flag |= utf8_main_flag_help_e;
+
+ return;
+ }
+
+ if (main->parameters.array[utf8_parameter_version_e].result & f_console_result_found_e) {
+ setting->flag |= utf8_main_flag_version_e;
+
+ return;
+ }
+
if (main->parameters.array[utf8_parameter_to_file_e].result & f_console_result_value_e) {
if (main->parameters.array[utf8_parameter_to_file_e].values.used > 1) {
setting->status = F_status_set_error(F_parameter);