// Switch to the appropriate terminal color mode.
{
- char *environment = getenv("TERM"); // @todo make these strings static!
+ char *environment = getenv(f_color_terminal_name_s.string);
- if (!environment || strncmp(environment, "linux", 6) == 0) {
+ if (!environment || strncmp(environment, f_color_terminal_value_linux_s.string, f_color_terminal_value_linux_s.used) == 0) {
macro_f_color_t_set_linux(context->list);
}
else {
const f_string_static_t f_color_string_code_bright_white_bg_s = macro_f_string_static_t_initialize(F_color_string_code_bright_white_bg_s, 0, F_color_string_code_bright_white_bg_s_length);
#endif // _di_f_color_strings_s_
+#ifndef _di_f_color_terminal_s_
+ const f_string_static_t f_color_terminal_name_s = macro_f_string_static_t_initialize(F_color_terminal_name_s, 0, F_color_terminal_name_s_length);
+ const f_string_static_t f_color_terminal_value_linux_s = macro_f_string_static_t_initialize(F_color_terminal_value_linux_s, 0, F_color_terminal_value_linux_s_length);
+#endif // _di_f_color_terminal_s_
+
#ifndef _di_f_color_set_string_empty_s_
const f_color_set_t f_color_set_empty_s = macro_f_color_set_t_initialize(&f_string_empty_s, &f_string_empty_s);
#endif // _di_f_color_set_string_empty_s_
#endif // _di_f_color_code_t_
/**
+ * Terminal environment variable strings that may relate to color processing.
+ *
+ * f_color_terminal_*:
+ * - name: The standard terminal environment variable name.
+ * - value_linux: The value representing the Linux terminal.
+ */
+#ifndef _di_f_color_terminal_s_
+ #define F_color_terminal_name_s "TERM"
+ #define F_color_terminal_value_linux_s "linux"
+
+ #define F_color_terminal_name_s_length 4
+ #define F_color_terminal_value_linux_s_length 5
+
+ extern const f_string_static_t f_color_terminal_name_s;
+ extern const f_string_static_t f_color_terminal_value_linux_s;
+#endif // _di_f_color_terminal_s_
+
+/**
* Provide a global color related strings.
*
* F_color_string_*: