smol-gilbraltar/nolibc/puts.c

18 lines
368 B
C
Raw Normal View History

2024-12-20 22:45:12 +00:00
#include <string.h>
#include <unistd.h>
2024-12-23 00:46:17 +00:00
extern void gilbraltar_serial_write(const char *, size_t);
2024-12-20 22:45:12 +00:00
int puts(const char *s)
{
size_t len = strlen(s);
2024-12-23 00:46:17 +00:00
gilbraltar_serial_write(s, len);
2024-12-20 22:45:12 +00:00
return (int)(len); // We should never have a string length above MAX_INT, do we?
}
int putchar(int chr)
{
2024-12-23 00:46:17 +00:00
gilbraltar_serial_write((char *) &chr, 1);
2024-12-20 22:45:12 +00:00
return (1);
}