// vi: set ts=4 sw=4 : // vim: set tw=75 : // sdk_util.cpp - utility routines from HL SDK util.cpp // Selected portions of dlls/util.cpp from SDK 2.1. // Functions copied from there as needed... // And modified to avoid buffer overflows (argh). // Also modified to remove dependency on CBaseEntity class. /*** * * Copyright (c) 1999, 2000 Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting * object code is restricted to non-commercial enhancements to products from * Valve LLC. All other use, distribution, or modification is prohibited * without written permission from Valve LLC. * ****/ /* ===== util.cpp ======================================================== Utility code. Really not optional after all. */ #include "precompiled.h" char* UTIL_VarArgs(char *format, ...) { va_list argptr; static char string[1024]; va_start(argptr, format); vsnprintf(string, sizeof(string), format, argptr); va_end(argptr); return string; } //========================================================= // UTIL_LogPrintf - Prints a logged message to console. // Preceded by LOG: ( timestamp ) < message > //========================================================= void UTIL_LogPrintf(char *fmt, ...) { va_list argptr; static char string[1024]; va_start(argptr, fmt); vsnprintf(string, sizeof(string), fmt, argptr); va_end(argptr); // Print to server console ALERT(at_logged, "%s", string); }