Commit | Line | Data |
---|---|---|
411867e7 KB |
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 | ||
2ce81398 | 11 | #if defined(LIBC_SCCS) && !defined(lint) |
cb631443 | 12 | static char sccsid[] = "@(#)puts.c 5.6 (Berkeley) %G%"; |
411867e7 | 13 | #endif /* LIBC_SCCS and not lint */ |
b8f253e8 | 14 | |
411867e7 KB |
15 | #include <stdio.h> |
16 | #include <string.h> | |
17 | #include "fvwrite.h" | |
76a1433e | 18 | |
411867e7 KB |
19 | /* |
20 | * Write the given string to stdout, appending a newline. | |
21 | */ | |
76a1433e | 22 | puts(s) |
411867e7 | 23 | char const *s; |
76a1433e | 24 | { |
411867e7 KB |
25 | size_t c = strlen(s); |
26 | struct __suio uio; | |
27 | struct __siov iov[2]; | |
76a1433e | 28 | |
5e355e2d | 29 | iov[0].iov_base = (void *)s; |
411867e7 KB |
30 | iov[0].iov_len = c; |
31 | iov[1].iov_base = "\n"; | |
32 | iov[1].iov_len = 1; | |
33 | uio.uio_resid = c + 1; | |
34 | uio.uio_iov = &iov[0]; | |
35 | uio.uio_iovcnt = 2; | |
36 | return (__sfvwrite(stdout, &uio) ? EOF : '\n'); | |
76a1433e | 37 | } |