public/mms_sample_ext/stub_util.cpp

00001 /**
00002  * vim: set ts=4 :
00003  * ======================================================
00004  * Metamod:Source Stub Plugin
00005  * Written by AlliedModders LLC.
00006  * ======================================================
00007  *
00008  * This software is provided 'as-is', without any express or implied warranty.
00009  * In no event will the authors be held liable for any damages arising from 
00010  * the use of this software.
00011  *
00012  * This stub plugin is public domain.
00013  *
00014  * Version: $Id$
00015  */
00016 
00017 #include <stdio.h>
00018 #include <stdarg.h>
00019 #include "stub_util.h"
00020 
00021 size_t UTIL_Format(char *buffer, size_t maxlength, const char *fmt, ...)
00022 {
00023           va_list ap;
00024 
00025           va_start(ap, fmt);
00026           size_t len = vsnprintf(buffer, maxlength, fmt, ap);
00027           va_end(ap);
00028 
00029           if (len >= maxlength)
00030           {
00031                     len = maxlength - 1;
00032                     buffer[len] = '\0';
00033           }
00034 
00035           return len;
00036 }
00037 
00038 

Generated on Sun Dec 28 23:26:25 2008 for SourceMod SDK by  doxygen 1.5.1