fputws.c (8fa0b743820f61c661ba5f3ea0e3be0dc137910e) fputws.c (177628ce757cf1a3f7d4b9a70dc4682d22e50ebc)
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.

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

65 wsp = ws;
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;
71 if (__sfvwrite(fp, &uio) != 0)
72 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.

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

65 wsp = ws;
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;
71 if (__sfvwrite(fp, &uio) != 0)
72 goto error;
73 } while (ws != NULL);
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}
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}