1 /* Copyright (c) 2002-2006 Lucent Technologies; see LICENSE */
9 sprint(char *buf, char *fmt, ...)
15 len = 1<<30; /* big number, but sprint is deprecated anyway */
17 * on PowerPC, the stack is near the top of memory, so
18 * we must be sure not to overflow a 32-bit pointer.
20 * careful! gcc-4.2 assumes buf+len < buf can never be true and
21 * optimizes the test away. casting to uintptr works around this bug.
23 if((uintptr)buf+len < (uintptr)buf)
24 len = -(uintptr)buf-1;
27 n = vsnprint(buf, len, fmt, args);