fputws.c (6a068746777241722b2b32c5d0bc443a2a64d80b) fputws.c (86727cc9c641d61be9930e7409e718bed1a553f7)
1/*-
2 * Copyright (c) 2002-2004 Tim J. Robbins.
3 * All rights reserved.
4 *
5 * Copyright (c) 2011 The FreeBSD Foundation
6 * All rights reserved.
7 * Portions of this software were developed by David Chisnall
8 * under sponsorship from the FreeBSD Foundation.

--- 53 unchanged lines hidden (view full) ---

62 uio.uio_iovcnt = 1;
63 iov.iov_base = buf;
64 wsp = ws;
65 do {
66 nbytes = l->__wcsnrtombs(buf, &wsp, SIZE_T_MAX, sizeof(buf),
67 &fp->_mbstate);
68 if (nbytes == (size_t)-1)
69 goto error;
1/*-
2 * Copyright (c) 2002-2004 Tim J. Robbins.
3 * All rights reserved.
4 *
5 * Copyright (c) 2011 The FreeBSD Foundation
6 * All rights reserved.
7 * Portions of this software were developed by David Chisnall
8 * under sponsorship from the FreeBSD Foundation.

--- 53 unchanged lines hidden (view full) ---

62 uio.uio_iovcnt = 1;
63 iov.iov_base = buf;
64 wsp = ws;
65 do {
66 nbytes = l->__wcsnrtombs(buf, &wsp, SIZE_T_MAX, sizeof(buf),
67 &fp->_mbstate);
68 if (nbytes == (size_t)-1)
69 goto error;
70 iov.iov_len = uio.uio_resid = nbytes;
70 uio.uio_resid = iov.iov_len = nbytes;
71 if (__sfvwrite(fp, &uio) != 0)
72 goto error;
73 } while (wsp != NULL);
74 FUNLOCKFILE(fp);
75 return (0);
76
77error:
78 FUNLOCKFILE(fp);
79 return (-1);
80}
81
82int
83fputws(const wchar_t * __restrict ws, FILE * __restrict fp)
84{
85 return fputws_l(ws, fp, __get_locale());
86}
71 if (__sfvwrite(fp, &uio) != 0)
72 goto error;
73 } while (wsp != NULL);
74 FUNLOCKFILE(fp);
75 return (0);
76
77error:
78 FUNLOCKFILE(fp);
79 return (-1);
80}
81
82int
83fputws(const wchar_t * __restrict ws, FILE * __restrict fp)
84{
85 return fputws_l(ws, fp, __get_locale());
86}