1 /*- 2 * Copyright (c) 1990 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Chris Torek. 7 * 8 * %sccs.include.redist.c% 9 */ 10 11 #if defined(LIBC_SCCS) && !defined(lint) 12 static char sccsid[] = "@(#)puts.c 5.3 (Berkeley) 01/20/91"; 13 #endif /* LIBC_SCCS and not lint */ 14 15 #include <sys/stdc.h> 16 #include <stdio.h> 17 #include <string.h> 18 #include "fvwrite.h" 19 20 /* 21 * Write the given string to stdout, appending a newline. 22 */ 23 puts(s) 24 char const *s; 25 { 26 size_t c = strlen(s); 27 struct __suio uio; 28 struct __siov iov[2]; 29 30 iov[0].iov_base = s; 31 iov[0].iov_len = c; 32 iov[1].iov_base = "\n"; 33 iov[1].iov_len = 1; 34 uio.uio_resid = c + 1; 35 uio.uio_iov = &iov[0]; 36 uio.uio_iovcnt = 2; 37 return (__sfvwrite(stdout, &uio) ? EOF : '\n'); 38 } 39