puts.c (290B)
1 2 #include <stdio.h> 3 4 #include "ioprivate.h" 5 6 7 int fputs(const char *s, FILE *f) 8 { 9 int c; 10 while ((c = *s++) != 0) { 11 if (putc(c, f) < 0) 12 return EOF; 13 } 14 return 0; 15 } 16 17 int puts(const char *s) 18 { 19 if (fputs(s, stdout) < 0) 20 return EOF; 21 if (putchar('\n') < 0) 22 return EOF; 23 return 0; 24 } 25