mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Cleanup
This commit is contained in:
parent
1fb0cad7b9
commit
70f69899fc
3 changed files with 52 additions and 1 deletions
23
src/print.c
23
src/print.c
|
|
@ -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("");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue