[A] Added ft_set_default_printf_field_separator funciton
This commit is contained in:
@@ -324,6 +324,11 @@ int ft_wprintf_ln(ft_table_t *table, const wchar_t *fmt, ...)
|
||||
|
||||
#endif
|
||||
|
||||
void ft_set_default_printf_field_separator(char separator)
|
||||
{
|
||||
g_col_separator = separator;
|
||||
}
|
||||
|
||||
|
||||
static int ft_write_impl(ft_table_t *table, const char *cell_content)
|
||||
{
|
||||
|
@@ -4,6 +4,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
char g_col_separator = FORT_DEFAULT_COL_SEPARATOR;
|
||||
|
||||
/*****************************************************************************
|
||||
* LIBFORT helpers
|
||||
@@ -139,7 +140,7 @@ size_t number_of_columns_in_format_string(const char *fmt)
|
||||
size_t separator_counter = 0;
|
||||
const char *pos = fmt;
|
||||
while (1) {
|
||||
pos = strchr(pos, FORT_COL_SEPARATOR);
|
||||
pos = strchr(pos, g_col_separator);
|
||||
if (pos == NULL)
|
||||
break;
|
||||
|
||||
@@ -157,7 +158,7 @@ size_t number_of_columns_in_format_wstring(const wchar_t *fmt)
|
||||
size_t separator_counter = 0;
|
||||
const wchar_t *pos = fmt;
|
||||
while (1) {
|
||||
pos = wcschr(pos, FORT_COL_SEPARATOR);
|
||||
pos = wcschr(pos, g_col_separator);
|
||||
if (pos == NULL)
|
||||
break;
|
||||
|
||||
|
@@ -22,7 +22,8 @@
|
||||
#endif /* FT_AMALGAMED_SORCE */
|
||||
|
||||
|
||||
#define FORT_COL_SEPARATOR '|'
|
||||
#define FORT_DEFAULT_COL_SEPARATOR '|'
|
||||
extern char g_col_separator;
|
||||
|
||||
#define FORT_COL_SEPARATOR_LENGTH 1
|
||||
|
||||
|
@@ -629,7 +629,7 @@ fort_row_t *create_row_from_string(const char *str)
|
||||
base_pos = str_copy;
|
||||
number_of_separators = 0;
|
||||
while (*pos) {
|
||||
pos = STRCHR(pos, FORT_COL_SEPARATOR);
|
||||
pos = STRCHR(pos, g_col_separator);
|
||||
if (pos != NULL) {
|
||||
*(pos) = zero_char;
|
||||
++pos;
|
||||
@@ -718,7 +718,7 @@ fort_row_t *create_row_from_wstring(const wchar_t *str)
|
||||
base_pos = str_copy;
|
||||
number_of_separators = 0;
|
||||
while (*pos) {
|
||||
pos = STRCHR(pos, FORT_COL_SEPARATOR);
|
||||
pos = STRCHR(pos, g_col_separator);
|
||||
if (pos != NULL) {
|
||||
*(pos) = zero_char;
|
||||
++pos;
|
||||
|
Reference in New Issue
Block a user