146098Sbostic /*- 2*61180Sbostic * Copyright (c) 1990, 1993 3*61180Sbostic * The Regents of the University of California. All rights reserved. 446098Sbostic * 546098Sbostic * This code is derived from software contributed to Berkeley by 646098Sbostic * Chris Torek. 746098Sbostic * 846098Sbostic * %sccs.include.redist.c% 946098Sbostic */ 1046098Sbostic 1126659Sdonn #if defined(LIBC_SCCS) && !defined(lint) 12*61180Sbostic static char sccsid[] = "@(#)puts.c 8.1 (Berkeley) 06/04/93"; 1346098Sbostic #endif /* LIBC_SCCS and not lint */ 1422141Smckusick 1546098Sbostic #include <stdio.h> 1646098Sbostic #include <string.h> 1746098Sbostic #include "fvwrite.h" 182027Swnj 1946098Sbostic /* 2046098Sbostic * Write the given string to stdout, appending a newline. 2146098Sbostic */ puts(s)222027Swnjputs(s) 2346098Sbostic char const *s; 242027Swnj { 2546098Sbostic size_t c = strlen(s); 2646098Sbostic struct __suio uio; 2746098Sbostic struct __siov iov[2]; 282027Swnj 2946274Storek iov[0].iov_base = (void *)s; 3046098Sbostic iov[0].iov_len = c; 3146098Sbostic iov[1].iov_base = "\n"; 3246098Sbostic iov[1].iov_len = 1; 3346098Sbostic uio.uio_resid = c + 1; 3446098Sbostic uio.uio_iov = &iov[0]; 3546098Sbostic uio.uio_iovcnt = 2; 3646098Sbostic return (__sfvwrite(stdout, &uio) ? EOF : '\n'); 372027Swnj } 38