ack/lang/cem/libcc.ansi/core/stdio/puts.c

28 lines
358 B
C
Raw Normal View History

1989-05-30 13:34:25 +00:00
/*
* puts.c - print a string onto the standard output stream
*/
1994-06-24 14:02:31 +00:00
/* $Id$ */
1989-05-30 13:34:25 +00:00
2018-06-21 20:33:47 +00:00
#include <stdio.h>
1989-05-30 13:34:25 +00:00
2018-06-23 16:54:40 +00:00
#if ACKCONF_WANT_STDIO
2018-06-21 20:33:47 +00:00
int puts(register const char* s)
1989-05-30 13:34:25 +00:00
{
2018-06-21 20:33:47 +00:00
register FILE* file = stdout;
1989-12-18 15:04:14 +00:00
register int i = 0;
2018-06-21 20:33:47 +00:00
while (*s)
{
if (putc(*s++, file) == EOF)
return EOF;
else
i++;
1989-12-18 15:04:14 +00:00
}
2018-06-21 20:33:47 +00:00
if (putc('\n', file) == EOF)
return EOF;
1989-12-18 15:04:14 +00:00
return i + 1;
1989-05-30 13:34:25 +00:00
}
2018-06-23 16:54:40 +00:00
#endif