This commit is contained in:
Martin Lund 2022-07-25 12:48:20 +02:00
parent 1fb0cad7b9
commit 70f69899fc
3 changed files with 52 additions and 1 deletions

View file

@ -20,7 +20,9 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include "options.h"
#include "print.h"
@ -50,3 +52,24 @@ void print_init_ansi_formatting()
sprintf(ansi_format, "\e[1;38;5;%dm", option.color);
}
}
void tio_printf_array(const char *array)
{
int i = 0, j = 0;
tio_printf("");
while (array[i])
{
if (array[i] == '\n')
{
const char *line = &array[j];
char *line_copy = strndup(line, i-j);
tio_printf_raw("%s\r", line_copy);
free(line_copy);
j = i;
}
i++;
}
tio_printf("");
}