Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include <u.h>
2
#include <libc.h>
3
#include "fmtdef.h"
4
 
5
int
6
sprint(char *buf, char *fmt, ...)
7
{
8
	int n;
9
	uint len;
10
	va_list args;
11
 
12
	len = 1<<30;  /* big number, but sprint is deprecated anyway */
13
	/*
14
	 * on PowerPC, the stack is near the top of memory, so
15
	 * we must be sure not to overflow a 32-bit pointer.
16
	 */
17
	if((uintptr)buf+len < (uintptr)buf)
18
		len = -(uintptr)buf-1;
19
 
20
	va_start(args, fmt);
21
	n = vsnprint(buf, len, fmt, args);
22
	va_end(args);
23
	return n;
24
}