The version function is used between all programs in this project.
Move that functionality into its own library: fl_program.
build_compiler gcc
build_linker ar
build_libraries -lc -lfll_0
-build_sources_library colors.c console.c directory.c errors.c file.c fss.c fss_basic.c fss_basic_list.c fss_extended.c serialized.c strings.c
+build_sources_library colors.c console.c directory.c errors.c file.c fss.c fss_basic.c fss_basic_list.c fss_extended.c program.c serialized.c strings.c
build_sources_program
-build_sources_headers colors.h console.h directory.h errors.h file.h fss.h fss_basic.h fss_basic_list.h fss_errors.h fss_extended.h fss_macro.h serialized.h strings.h
+build_sources_headers colors.h console.h directory.h errors.h file.h fss.h fss_basic.h fss_basic_list.h fss_errors.h fss_extended.h fss_macro.h program.h serialized.h strings.h
build_shared yes
build_static yes
--- /dev/null
+#include <level_1/program.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_fl_program_print_version_
+ f_return_status fl_program_print_version(const f_string version) {
+ printf("%s\n", version);
+
+ return f_none;
+ }
+#endif // _di_fl_program_print_version_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 1
+ *
+ * Project: Program
+ * API Version: 0.5
+ * Licenses: lgplv2.1
+ *
+ * Provide functions commonly used by FLL based programs.
+ */
+#ifndef _FL_program_h
+#define _FL_program_h
+
+// libc include
+#include <stdio.h>
+
+// fll-0 includes
+#include <level_0/errors.h>
+#include <level_0/strings.h>
+#include <level_0/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_fl_program_print_version_
+ /**
+ * Print version.
+ *
+ * @param version
+ * The version number to print.
+ *
+ * @return
+ * f_none on success.
+ * Error bit is set on error.
+ */
+ extern f_return_status fl_program_print_version(const f_string version);
+#endif // _di_fl_program_print_version_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _FL_program_h
--- /dev/null
+f_types
+f_errors
+f_strings
--- /dev/null
+# fss-0000
+
+project_name fl_program
+project_level 1
+
+version_major 0
+version_minor 5
+version_micro 0
+
+build_compiler gcc
+build_linker ar
+build_libraries -lc
+build_sources_library program.c
+build_sources_program
+build_sources_headers program.h
+build_shared yes
+build_static yes
+
+flags_all -z now
+flags_shared
+flags_static
+flags_library -fPIC
+flags_program -fPIE
extern "C" {
#endif
-// version printed may be used by scripts, so this will only print the version number and a newline, no extra information or colors
-#ifndef _di_firewall_print_version_
- f_return_status firewall_print_version(const firewall_data data) {
- printf("%s\n", firewall_version);
-
- return f_none;
- }
-#endif // _firewall_print_version_
-
#ifndef _di_firewall_print_help_
f_return_status firewall_print_help(const firewall_data data) {
printf("\n");
firewall_print_help(*data);
}
else if (data->parameters[firewall_parameter_version].result == f_console_result_found) {
- firewall_print_version(*data);
+ fl_program_print_version(firewall_version);
}
else {
// now determine which command was placed first
#include <level_1/console.h>
#include <level_1/directory.h>
#include <level_1/file.h>
+#include <level_1/program.h>
#include <level_1/strings.h>
// fll-2 includes
}
#endif // _di_firewall_data_
-#ifndef _di_firewall_print_version_
- /**
- * Print version.
- */
- extern f_return_status firewall_print_version(const firewall_data data);
-#endif // _di_firewall_print_version_
-
#ifndef _di_firewall_print_help_
/**
* Print help.
-f_types
+f_console
f_errors
-f_strings
+f_fss
f_memory
f_pipe
f_print
-f_console
-f_fss
-fl_console
-fl_file
-fl_strings
+f_strings
+f_types
fl_colors
+fl_console
fl_directory
+fl_file
fl_fss
+fl_program
+fl_strings
fll_colors
-fll_fss
fll_execute
+fll_fss
build_compiler gcc
build_linker ar
-build_libraries -lfll_colors -lfll_fss -lfll_execute -lfl_directory -lfl_colors -lfl_strings -lfl_file -lfl_console -lfl_fss -lf_pipe -lf_file -lf_print -lf_conversion -lf_console -lf_memory -lc
+build_libraries -lfll_colors -lfll_fss -lfll_execute -lfl_directory -lfl_colors -lfl_strings -lfl_file -lfl_console -lfl_fss -lfl_program -lf_pipe -lf_file -lf_print -lf_conversion -lf_console -lf_memory -lc
build_sources_library firewall.c private-firewall.c
build_sources_program main.c
build_sources_headers firewall.h
extern "C" {
#endif
-// version printed may be used by scripts, so this will only print the version number and a newline, no extra information or colors
-#ifndef _di_fss_basic_list_read_print_version_
- f_return_status fss_basic_list_read_print_version(const fss_basic_list_read_data data) {
- printf("%s\n", fss_basic_list_read_version);
-
- return f_none;
- }
-#endif // _fss_basic_list_read_print_version_
-
#ifndef _di_fss_basic_list_read_print_help_
f_return_status fss_basic_list_read_print_help(const fss_basic_list_read_data data) {
printf("\n");
fss_basic_list_read_print_help(*data);
}
else if (data->parameters[fss_basic_list_read_parameter_version].result == f_console_result_found) {
- fss_basic_list_read_print_version(*data);
+ fl_program_print_version(fss_basic_list_read_version);
}
else if (data->remaining.used > 0 || data->process_pipe) {
f_string_length counter = 0;
#include <level_1/console.h>
#include <level_1/directory.h>
#include <level_1/file.h>
+#include <level_1/program.h>
#include <level_1/strings.h>
// fll-2 includes
}
#endif // _di_fss_basic_list_read_data_
-#ifndef _di_fss_basic_list_read_print_version_
- /**
- * Print version.
- */
- extern f_return_status fss_basic_list_read_print_version(const fss_basic_list_read_data data);
-#endif // _di_fss_basic_list_read_print_version_
-
#ifndef _di_fss_basic_list_read_print_help_
/**
* Print help.
-f_types
+f_console
f_errors
-f_strings
+f_fss
f_memory
f_pipe
f_print
-f_console
-f_fss
-fl_console
-fl_file
-fl_strings
+f_strings
+f_types
fl_colors
+fl_console
fl_directory
+fl_file
fl_fss
+fl_program
+fl_strings
fll_colors
-fll_fss
fll_execute
+fll_fss
build_compiler gcc
build_linker ar
-build_libraries -lfll_colors -lfll_fss -lfll_execute -lfl_directory -lfl_colors -lfl_strings -lfl_file -lfl_console -lfl_fss -lf_pipe -lf_file -lf_print -lf_conversion -lf_console -lf_memory -lc
+build_libraries -lfll_colors -lfll_fss -lfll_execute -lfl_directory -lfl_colors -lfl_strings -lfl_file -lfl_console -lfl_program -lfl_fss -lf_pipe -lf_file -lf_print -lf_conversion -lf_console -lf_memory -lc
build_sources_library fss_basic_list_read.c
build_sources_program main.c
build_sources_headers fss_basic_list_read.h
extern "C" {
#endif
-// version printed may be used by scripts, so this will only print the version number and a newline, no extra information or colors
-#ifndef _di_fss_basic_list_write_print_version_
- f_return_status fss_basic_list_write_print_version(const fss_basic_list_write_data data) {
- printf("%s\n", fss_basic_list_write_version);
-
- return f_none;
- }
-#endif // _fss_basic_list_write_print_version_
-
#ifndef _di_fss_basic_list_write_print_help_
f_return_status fss_basic_list_write_print_help(const fss_basic_list_write_data data) {
printf("\n");
fss_basic_list_write_print_help(*data);
}
else if (data->parameters[fss_basic_list_write_parameter_version].result == f_console_result_found) {
- fss_basic_list_write_print_version(*data);
+ fl_program_print_version(fss_basic_list_write_version);
}
else {
f_array_length counter = 0;
#include <level_1/errors.h>
#include <level_1/file.h>
#include <level_1/fss_basic_list.h>
+#include <level_1/program.h>
#include <level_1/strings.h>
// fll-2 includes
}
#endif // _di_fss_basic_list_write_data_
-#ifndef _di_fss_basic_list_write_print_version_
- /**
- * Print version.
- */
- extern f_return_status fss_basic_list_write_print_version(const fss_basic_list_write_data data);
-#endif // _di_fss_basic_list_write_print_version_
-
#ifndef _di_fss_basic_list_write_print_help_
/**
* Print help.
-f_types
+f_console
f_errors
-f_strings
+f_fss
f_memory
f_pipe
f_print
-f_console
-f_fss
-fl_console
-fl_file
-fl_strings
+f_strings
+f_types
fl_colors
+fl_console
fl_directory
+fl_file
fl_fss
+fl_program
+fl_strings
fll_colors
-fll_fss
fll_execute
+fll_fss
build_compiler gcc
build_linker ar
-build_libraries -lfll_colors -lfll_fss -lfl_fss -lfl_file -lfl_errors -lfl_colors -lfl_console -lf_file -lf_print -lf_pipe -lf_conversion -lf_console -lf_memory -lc
+build_libraries -lfll_colors -lfll_fss -lfl_fss -lfl_file -lfl_errors -lfl_colors -lfl_console -lfl_program -lf_file -lf_print -lf_pipe -lf_conversion -lf_console -lf_memory -lc
build_sources_library fss_basic_list_write.c
build_sources_program main.c
build_sources_headers fss_basic_list_write.h
extern "C" {
#endif
-// version printed may be used by scripts, so this will only print the version number and a newline, no extra information or colors
-#ifndef _di_fss_basic_read_print_version_
- f_return_status fss_basic_read_print_version(const fss_basic_read_data data) {
- printf("%s\n", fss_basic_read_version);
-
- return f_none;
- }
-#endif // _fss_basic_read_print_version_
-
#ifndef _di_fss_basic_read_print_help_
f_return_status fss_basic_read_print_help(const fss_basic_read_data data) {
printf("\n");
fss_basic_read_print_help(*data);
}
else if (data->parameters[fss_basic_read_parameter_version].result == f_console_result_found) {
- fss_basic_read_print_version(*data);
+ fl_program_print_version(fss_basic_read_version);
}
else if (data->remaining.used > 0 || data->process_pipe) {
f_string_length counter = 0;
#include <level_1/console.h>
#include <level_1/directory.h>
#include <level_1/file.h>
+#include <level_1/program.h>
#include <level_1/strings.h>
// fll-2 includes
}
#endif // _di_fss_basic_read_data_
-#ifndef _di_fss_basic_read_print_version_
- /**
- * Print version.
- */
- extern f_return_status fss_basic_read_print_version(const fss_basic_read_data data);
-#endif // _di_fss_basic_read_print_version_
-
#ifndef _di_fss_basic_read_print_help_
/**
* Print help.
-f_types
+f_console
f_errors
-f_strings
+f_fss
f_memory
f_pipe
f_print
-f_console
-f_fss
-fl_console
-fl_file
-fl_strings
+f_strings
+f_types
fl_colors
+fl_console
fl_directory
+fl_file
fl_fss
+fl_program
+fl_strings
fll_colors
-fll_fss
fll_execute
+fll_fss
build_compiler gcc
build_linker ar
-build_libraries -lfll_colors -lfll_fss -lfll_execute -lfl_directory -lfl_colors -lfl_strings -lfl_file -lfl_console -lfl_fss -lf_print -lf_file -lf_pipe -lf_conversion -lf_console -lf_memory -lc
+build_libraries -lfll_colors -lfll_fss -lfll_execute -lfl_directory -lfl_colors -lfl_strings -lfl_file -lfl_console -lfl_program -lfl_fss -lf_print -lf_file -lf_pipe -lf_conversion -lf_console -lf_memory -lc
build_sources_library fss_basic_read.c
build_sources_program main.c
build_sources_headers fss_basic_read.h
extern "C" {
#endif
-// version printed may be used by scripts, so this will only print the version number and a newline, no extra information or colors
-#ifndef _di_fss_basic_write_print_version_
- f_return_status fss_basic_write_print_version(const fss_basic_write_data data) {
- printf("%s\n", fss_basic_write_version);
-
- return f_none;
- }
-#endif // _fss_basic_write_print_version_
-
#ifndef _di_fss_basic_write_print_help_
f_return_status fss_basic_write_print_help(const fss_basic_write_data data) {
printf("\n");
fss_basic_write_print_help(*data);
}
else if (data->parameters[fss_basic_write_parameter_version].result == f_console_result_found) {
- fss_basic_write_print_version(*data);
+ fl_program_print_version(fss_basic_write_version);
}
else {
f_array_length counter = 0;
#include <level_1/console.h>
#include <level_1/errors.h>
#include <level_1/file.h>
+#include <level_1/program.h>
#include <level_1/strings.h>
// fll-2 includes
}
#endif // _di_fss_basic_write_data_
-#ifndef _di_fss_basic_write_print_version_
- /**
- * Print version.
- */
- extern f_return_status fss_basic_write_print_version(const fss_basic_write_data data);
-#endif // _di_fss_basic_write_print_version_
-
#ifndef _di_fss_basic_write_print_help_
/**
* Print help.
-f_types
+f_console
f_errors
-f_strings
+f_fss
f_memory
f_pipe
f_print
-f_console
-f_fss
-fl_console
-fl_file
-fl_strings
+f_strings
+f_types
fl_colors
+fl_console
fl_directory
+fl_file
fl_fss
+fl_program
+fl_strings
fll_colors
-fll_fss
fll_execute
+fll_fss
build_compiler gcc
build_linker ar
-build_libraries -lfll_colors -lfll_fss -lfl_fss -lfl_file -lfl_errors -lfl_colors -lfl_console -lf_file -lf_print -lf_pipe -lf_conversion -lf_console -lf_memory -lc
+build_libraries -lfll_colors -lfll_fss -lfl_fss -lfl_file -lfl_errors -lfl_colors -lfl_console -lfl_program -lf_file -lf_print -lf_pipe -lf_conversion -lf_console -lf_memory -lc
build_sources_library fss_basic_write.c
build_sources_program main.c
build_sources_headers fss_basic_write.h
extern "C" {
#endif
-// version printed may be used by scripts, so this will only print the version number and a newline, no extra information or colors
-#ifndef _di_fss_extended_read_print_version_
- f_return_status fss_extended_read_print_version(const fss_extended_read_data data) {
- printf("%s\n", fss_extended_read_version);
-
- return f_none;
- }
-#endif // _fss_extended_read_print_version_
-
#ifndef _di_fss_extended_read_print_help_
f_return_status fss_extended_read_print_help(const fss_extended_read_data data) {
printf("\n");
fss_extended_read_print_help(*data);
}
else if (data->parameters[fss_extended_read_parameter_version].result == f_console_result_found) {
- fss_extended_read_print_version(*data);
+ fl_program_print_version(fss_extended_read_version);
}
else if (data->remaining.used > 0 || data->process_pipe) {
f_string_length counter = 0;
#include <level_1/console.h>
#include <level_1/directory.h>
#include <level_1/file.h>
+#include <level_1/program.h>
#include <level_1/strings.h>
// fll-2 includes
}
#endif // _di_fss_extended_read_data_
-#ifndef _di_fss_extended_read_print_version_
- /**
- * Print version.
- */
- extern f_return_status fss_extended_read_print_version(const fss_extended_read_data data);
-#endif // _di_fss_extended_read_print_version_
-
#ifndef _di_fss_extended_read_print_help_
/**
* Print help.
-f_types
+f_console
f_errors
-f_strings
+f_fss
f_memory
f_pipe
f_print
-f_console
-f_fss
-fl_console
-fl_file
-fl_strings
+f_strings
+f_types
fl_colors
+fl_console
fl_directory
+fl_file
fl_fss
+fl_program
+fl_strings
fll_colors
-fll_fss
fll_execute
+fll_fss
build_compiler gcc
build_linker ar
-build_libraries -lfll_colors -lfll_fss -lfll_execute -lfl_directory -lfl_colors -lfl_strings -lfl_file -lfl_console -lfl_fss -lf_pipe -lf_file -lf_print -lf_conversion -lf_console -lf_memory -lc
+build_libraries -lfll_colors -lfll_fss -lfll_execute -lfl_directory -lfl_colors -lfl_strings -lfl_file -lfl_console -lfl_program -lfl_fss -lf_pipe -lf_file -lf_print -lf_conversion -lf_console -lf_memory -lc
build_sources_library fss_extended_read.c
build_sources_program main.c
build_sources_headers fss_extended_read.h
extern "C" {
#endif
-// version printed may be used by scripts, so this will only print the version number and a newline, no extra information or colors
-#ifndef _di_fss_extended_write_print_version_
- f_return_status fss_extended_write_print_version(const fss_extended_write_data data) {
- printf("%s\n", fss_extended_write_version);
-
- return f_none;
- }
-#endif // _fss_extended_write_print_version_
-
#ifndef _di_fss_extended_write_print_help_
f_return_status fss_extended_write_print_help(const fss_extended_write_data data) {
printf("\n");
fss_extended_write_print_help(*data);
}
else if (data->parameters[fss_extended_write_parameter_version].result == f_console_result_found) {
- fss_extended_write_print_version(*data);
+ fl_program_print_version(fss_extended_write_version);
}
else {
f_array_length counter = 0;
#include <level_1/errors.h>
#include <level_1/file.h>
#include <level_1/fss_extended.h>
+#include <level_1/program.h>
#include <level_1/strings.h>
// fll-2 includes
}
#endif // _di_fss_extended_write_data_
-#ifndef _di_fss_extended_write_print_version_
- /**
- * Print version.
- */
- extern f_return_status fss_extended_write_print_version(const fss_extended_write_data data);
-#endif // _di_fss_extended_write_print_version_
-
#ifndef _di_fss_extended_write_print_help_
/**
* Print help.
-f_types
+f_console
f_errors
-f_strings
+f_fss
f_memory
f_pipe
f_print
-f_console
-f_fss
-fl_console
-fl_file
-fl_strings
+f_strings
+f_types
fl_colors
+fl_console
fl_directory
+fl_file
fl_fss
+fl_program
+fl_strings
fll_colors
-fll_fss
fll_execute
+fll_fss
build_compiler gcc
build_linker ar
-build_libraries -lfll_colors -lfll_fss -lfl_fss -lfl_file -lfl_errors -lfl_colors -lfl_console -lf_file -lf_print -lf_pipe -lf_conversion -lf_console -lf_memory -lc
+build_libraries -lfll_colors -lfll_fss -lfl_fss -lfl_file -lfl_errors -lfl_colors -lfl_console -lfl_program -lf_file -lf_print -lf_pipe -lf_conversion -lf_console -lf_memory -lc
build_sources_library fss_extended_write.c
build_sources_program main.c
build_sources_headers fss_extended_write.h
extern "C" {
#endif
-// version printed may be used by scripts, so this will only print the version number and a newline, no extra information or colors
-#ifndef _di_fss_return_code_print_version_
- f_return_status fss_return_code_print_version(const fss_return_code_data data) {
- printf("%s\n", fss_return_code_version);
-
- return f_none;
- }
-#endif // _fss_return_code_print_version_
-
#ifndef _di_fss_return_code_print_help_
f_return_status fss_return_code_print_help(const fss_return_code_data data) {
printf("\n");
fss_return_code_print_help(*data);
}
else if (data->parameters[fss_return_code_parameter_version].result == f_console_result_found) {
- fss_return_code_print_version(*data);
+ fl_program_print_version(fss_return_code_version);
}
else if (data->parameters[fss_return_code_parameter_is_error].result == f_console_result_found && data->remaining.used > 0) {
f_array_length counter = 0;
#include <level_1/colors.h>
#include <level_1/console.h>
#include <level_1/errors.h>
+#include <level_1/program.h>
#include <level_1/strings.h>
// fll-2 includes
}
#endif // _di_fss_return_code_data_
-#ifndef _di_fss_return_code_print_version_
- /**
- * Print version.
- */
- extern f_return_status fss_return_code_print_version(const fss_return_code_data data);
-#endif // _di_fss_return_code_print_version_
-
#ifndef _di_fss_return_code_print_help_
/**
* Print help.
-f_types
+f_console
f_errors
-f_strings
+f_fss
+f_memory
f_pipe
f_print
-f_console
-f_fss
+f_strings
+f_types
+fl_colors
fl_console
+fl_directory
fl_file
-fl_strings
-fl_colors
fl_fss
+fl_program
+fl_strings
fll_colors
+fll_execute
fll_fss
build_compiler gcc
build_linker ar
-build_libraries -lfll_colors -lfll_fss -lfl_fss -lfl_errors -lfl_colors -lfl_console -lf_print -lf_pipe -lf_conversion -lf_console -lf_memory -lc
+build_libraries -lfll_colors -lfll_fss -lfl_fss -lfl_errors -lfl_colors -lfl_console -lfl_program -lf_print -lf_pipe -lf_conversion -lf_console -lf_memory -lc
build_sources_library fss_return_code.c
build_sources_program main.c
build_sources_headers fss_return_code.h
-f_types
+f_console
f_errors
-f_strings
+f_fss
f_memory
f_pipe
f_print
-f_console
-f_fss
-fl_console
-fl_file
-fl_strings
+f_strings
+f_types
fl_colors
+fl_console
fl_directory
+fl_file
fl_fss
+fl_program
+fl_strings
fll_colors
-fll_fss
fll_execute
+fll_fss
build_compiler gcc
build_linker ar
-build_libraries -lfll_colors -lfll_fss -lfll_execute -lfl_directory -lfl_colors -lfl_strings -lfl_file -lfl_console -lfl_fss -lf_pipe -lf_file -lf_print -lf_conversion -lf_console -lf_memory -lc
+build_libraries -lfll_colors -lfll_fss -lfll_execute -lfl_directory -lfl_colors -lfl_strings -lfl_file -lfl_console -lfl_program -lfl_fss -lf_pipe -lf_file -lf_print -lf_conversion -lf_console -lf_memory -lc
build_sources_library init.c private-init.c
build_sources_program main.c
build_sources_headers init.h
extern "C" {
#endif
-// version printed may be used by scripts, so this will only print the version number and a newline, no extra information or colors
-#ifndef _di_return_code_print_version_
- f_return_status return_code_print_version(const return_code_data data) {
- printf("%s\n", return_code_version);
-
- return f_none;
- }
-#endif // _return_code_print_version_
-
#ifndef _di_return_code_print_help_
f_return_status return_code_print_help(const return_code_data data) {
printf("\n");
return_code_print_help(*data);
}
else if (data->parameters[return_code_parameter_version].result == f_console_result_found) {
- return_code_print_version(*data);
+ fl_program_print_version(return_code_version);
}
else if (data->parameters[return_code_parameter_is_error].result == f_console_result_found && data->remaining.used > 0) {
f_array_length counter = 0;
#include <level_1/colors.h>
#include <level_1/console.h>
#include <level_1/errors.h>
+#include <level_1/program.h>
#include <level_1/strings.h>
// fll-2 includes
}
#endif // _di_return_code_data_
-#ifndef _di_return_code_print_version_
- /**
- * Print version.
- */
- extern f_return_status return_code_print_version(const return_code_data data);
-#endif // _di_return_code_print_version_
-
#ifndef _di_return_code_print_help_
/**
* Print help.
-f_types
+f_console
f_errors
-f_strings
f_pipe
f_print
-f_console
+f_strings
+f_types
+fl_colors
fl_console
fl_file
+fl_program
fl_strings
-fl_colors
fll_colors
build_compiler gcc
build_linker ar
-build_libraries -lfll_colors -lfl_errors -lfl_colors -lfl_console -lf_print -lf_pipe -lf_conversion -lf_console -lf_memory -lc
+build_libraries -lfll_colors -lfl_errors -lfl_colors -lfl_console -lfl_program -lf_print -lf_pipe -lf_conversion -lf_console -lf_memory -lc
build_sources_library return_code.c
build_sources_program main.c
build_sources_headers return_code.h