146098Sbostic /*- 246098Sbostic * Copyright (c) 1990 The Regents of the University of California. 346098Sbostic * 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*46274Storek static char sccsid[] = "@(#)puts.c 5.5 (Berkeley) 02/05/91"; 1346098Sbostic #endif /* LIBC_SCCS and not lint */ 1422141Smckusick 1546214Sbostic #include <sys/cdefs.h> 1646098Sbostic #include <stdio.h> 1746098Sbostic #include <string.h> 1846098Sbostic #include "fvwrite.h" 192027Swnj 2046098Sbostic /* 2146098Sbostic * Write the given string to stdout, appending a newline. 2246098Sbostic */ 232027Swnj puts(s) 2446098Sbostic char const *s; 252027Swnj { 2646098Sbostic size_t c = strlen(s); 2746098Sbostic struct __suio uio; 2846098Sbostic struct __siov iov[2]; 292027Swnj 30*46274Storek iov[0].iov_base = (void *)s; 3146098Sbostic iov[0].iov_len = c; 3246098Sbostic iov[1].iov_base = "\n"; 3346098Sbostic iov[1].iov_len = 1; 3446098Sbostic uio.uio_resid = c + 1; 3546098Sbostic uio.uio_iov = &iov[0]; 3646098Sbostic uio.uio_iovcnt = 2; 3746098Sbostic return (__sfvwrite(stdout, &uio) ? EOF : '\n'); 382027Swnj } 39