puts.c 317 B

1234567891011121314151617181920
  1. /*
  2. * puts.c - print a string onto the standard output stream
  3. */
  4. /* $Id$ */
  5. #include <stdio.h>
  6. int
  7. puts(register const char *s)
  8. {
  9. register FILE *file = stdout;
  10. register int i = 0;
  11. while (*s) {
  12. if (putc(*s++, file) == EOF) return EOF;
  13. else i++;
  14. }
  15. if (putc('\n', file) == EOF) return EOF;
  16. return i + 1;
  17. }