Files
MNRS-BM-BSP/libwrap/sys/puts.c
T
2026-11-11 16:02:12 +01:00

17 lines
418 B
C

#include "weak_under_alias.h"
#include <string.h>
#include <unistd.h>
extern ssize_t _bsp_write(int, const void*, size_t);
int __wrap_puts(const char* s) {
if(!s) return -1;
const char* str = s;
while(*str)
++str;
if (_bsp_write(STDOUT_FILENO, s, str - s) != str - s)
return -1;
return _bsp_write(STDOUT_FILENO, "\n", 1) == 1 ? 0 : -1;
}
weak_under_alias(puts);