1/*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Chris Torek. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 24 unchanged lines hidden (view full) --- 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 */ 36 37#if defined(LIBC_SCCS) && !defined(lint) 38static char sccsid[] = "@(#)vfprintf.c 8.1 (Berkeley) 6/4/93"; 39#endif /* LIBC_SCCS and not lint */ 40#include <sys/cdefs.h> |
41__FBSDID("$FreeBSD: head/lib/libc/stdio/vfprintf.c 113196 2003-04-07 03:17:39Z ache $"); |
42 43/* 44 * Actual printf innards. 45 * 46 * This code is large and complicated... 47 */ 48 49#include "namespace.h" --- 329 unchanged lines hidden (view full) --- 379 p = wcsarg; 380 memset(&mbs, 0, sizeof(mbs)); 381 while (mbp - convbuf < nbytes) { 382 clen = wcrtomb(mbp, *p++, &mbs); 383 if (clen == 0 || clen == (size_t)-1) 384 break; 385 mbp += clen; 386 } |
387 if (clen == (size_t)-1) { 388 free(convbuf); |
389 return (NULL); |
390 } 391 *mbp = '\0'; |
392 393 return (convbuf); 394} 395 396/* 397 * MT-safe version 398 */ 399int --- 1231 unchanged lines hidden --- |