#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include "lprintf.h"
#ifdef WIN32
#define vsnprintf _vsnprintf
#define snprintf _snprintf
#endif


int lprintf( char *buffer, int bfsize, char *format, ... )
{
	int r;
	if (buffer && format && bfsize) {
		va_list arg_list;
		va_start(arg_list, format);

		r = vsnprintf( buffer, bfsize, format, arg_list);
		if (r<0) buffer[bfsize-1] = 0;
	}
	return -1;
}
