Blob


1 /* Copyright (c) 2002-2006 Lucent Technologies; see LICENSE */
2 #include <stdarg.h>
3 #include <fmt.h>
4 #include "plan9.h"
5 #include "fmt.h"
6 #include "fmtdef.h"
8 int
9 sprint(char *buf, char *fmt, ...)
10 {
11 int n;
12 uint len;
13 va_list args;
15 len = 1<<30; /* big number, but sprint is deprecated anyway */
16 /*
17 * on PowerPC, the stack is near the top of memory, so
18 * we must be sure not to overflow a 32-bit pointer.
19 */
20 if(buf+len < buf)
21 len = -(uintptr)buf-1;
23 va_start(args, fmt);
24 n = vsnprint(buf, len, fmt, args);
25 va_end(args);
26 return n;
27 }