39 lines
825 B
C++
39 lines
825 B
C++
|
/**
|
||
|
* vim: set ts=4 :
|
||
|
* ======================================================
|
||
|
* Metamod:Source Stub Plugin
|
||
|
* Written by AlliedModders LLC.
|
||
|
* ======================================================
|
||
|
*
|
||
|
* This software is provided 'as-is', without any express or implied warranty.
|
||
|
* In no event will the authors be held liable for any damages arising from
|
||
|
* the use of this software.
|
||
|
*
|
||
|
* This stub plugin is public domain.
|
||
|
*
|
||
|
* Version: $Id$
|
||
|
*/
|
||
|
|
||
|
#include <stdio.h>
|
||
|
#include <stdarg.h>
|
||
|
#include "stub_util.h"
|
||
|
|
||
|
size_t UTIL_Format(char *buffer, size_t maxlength, const char *fmt, ...)
|
||
|
{
|
||
|
va_list ap;
|
||
|
|
||
|
va_start(ap, fmt);
|
||
|
size_t len = vsnprintf(buffer, maxlength, fmt, ap);
|
||
|
va_end(ap);
|
||
|
|
||
|
if (len >= maxlength)
|
||
|
{
|
||
|
len = maxlength - 1;
|
||
|
buffer[len] = '\0';
|
||
|
}
|
||
|
|
||
|
return len;
|
||
|
}
|
||
|
|
||
|
|