fxlibc/src/libc/stdio/puts.c

19 lines
330 B
C
Raw Normal View History

2021-05-09 17:34:00 +02:00
#include <stdio.h>
#include <string.h>
#include <unistd.h>
2020-09-17 19:27:01 +02:00
2020-10-14 15:18:10 +02:00
/*
** puts() writes the string s and a trailing newline to stdout.
** FIXME: check last write error !
*/
2020-09-17 19:27:01 +02:00
int puts(const char *s)
{
size_t size;
size_t n;
size = strlen(s);
n = write(STDOUT_FILENO, s, size);
2020-10-14 15:18:10 +02:00
write(STDOUT_FILENO, "\n", 1);
2020-09-17 19:27:01 +02:00
return (-(n == size));
}