|
darope@0
|
1 |
// vi: set ts=4 sw=4 : |
|
darope@0
|
2 |
// vim: set tw=75 : |
|
darope@0
|
3 |
|
|
darope@0
|
4 |
// Selected portions of dlls/util.cpp from SDK 2.1. |
|
darope@0
|
5 |
// Functions copied from there as needed... |
|
darope@0
|
6 |
// And modified to avoid buffer overflows (argh). |
|
darope@0
|
7 |
|
|
darope@0
|
8 |
/*** |
|
darope@0
|
9 |
* |
|
darope@0
|
10 |
* Copyright (c) 1999, 2000 Valve LLC. All rights reserved. |
|
darope@0
|
11 |
* |
|
darope@0
|
12 |
* This product contains software technology licensed from Id |
|
darope@0
|
13 |
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. |
|
darope@0
|
14 |
* All Rights Reserved. |
|
darope@0
|
15 |
* |
|
darope@0
|
16 |
* Use, distribution, and modification of this source code and/or resulting |
|
darope@0
|
17 |
* object code is restricted to non-commercial enhancements to products from |
|
darope@0
|
18 |
* Valve LLC. All other use, distribution, or modification is prohibited |
|
darope@0
|
19 |
* without written permission from Valve LLC. |
|
darope@0
|
20 |
* |
|
darope@0
|
21 |
****/ |
|
darope@0
|
22 |
/* |
|
darope@0
|
23 |
|
|
darope@0
|
24 |
===== util.cpp ======================================================== |
|
darope@0
|
25 |
|
|
darope@0
|
26 |
Utility code. Really not optional after all. |
|
darope@0
|
27 |
|
|
darope@0
|
28 |
*/ |
|
darope@0
|
29 |
|
|
darope@0
|
30 |
#include <extdll.h> |
|
darope@0
|
31 |
#include <enginecallback.h> // ALERT() |
|
darope@0
|
32 |
|
|
darope@0
|
33 |
#include "osdep.h" // win32 vsnprintf, etc |
|
darope@0
|
34 |
|
|
darope@0
|
35 |
//========================================================= |
|
darope@0
|
36 |
// UTIL_LogPrintf - Prints a logged message to console. |
|
darope@0
|
37 |
// Preceded by LOG: ( timestamp ) < message > |
|
darope@0
|
38 |
//========================================================= |
|
darope@0
|
39 |
void UTIL_LogPrintf( char *fmt, ... ) |
|
darope@0
|
40 |
{ |
|
darope@0
|
41 |
va_list argptr; |
|
darope@0
|
42 |
static char string[1024]; |
|
darope@0
|
43 |
|
|
darope@0
|
44 |
va_start ( argptr, fmt ); |
|
darope@0
|
45 |
vsnprintf ( string, sizeof(string), fmt, argptr ); |
|
darope@0
|
46 |
va_end ( argptr ); |
|
darope@0
|
47 |
|
|
darope@0
|
48 |
// Print to server console |
|
darope@0
|
49 |
ALERT( at_logged, "%s", string ); |
|
darope@0
|
50 |
} |